Skip to content

Conversation

@schleyfox
Copy link
Collaborator

Previously, our counters on the number of GC runs were being read from a
static struct when constructing the stats event to emit. In blocks of
synchronous code, GC can run multiple times before control returns to
the event loop where the stats events will be constructed and emitted.
All events would then get the same values for the counters at the time
the events are created. This passes a copy of the counters with the
baton to fix this.

This also adds a us timestamp of when the gc run occurred, which can be
useful for sequencing events.

/cc @goatslacker @martinwin

Previously, our counters on the number of GC runs were being read from a
static struct when constructing the stats event to emit.  In blocks of
synchronous code, GC can run multiple times before control returns to
the event loop where the stats events will be constructed and emitted.
All events would then get the same values for the counters at the time
the events are created.  This passes a copy of the counters with the
baton to fix this.

This also adds a us timestamp of when the gc run occurred, which can be
useful for sequencing events.
Copy link
Collaborator

@martinwin martinwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man, it's been a long time since I've written C code.

@schleyfox schleyfox merged commit 17cf59a into master May 22, 2018
@schleyfox schleyfox deleted the fix-stats-race-condition branch May 22, 2018 19:33
@curvedriver
Copy link

Hi @schleyfox ,
I know your merge is more than two years ago XD but since that is the windows compatibility broken.

Is there really a need of gettimeofday() because sys/time.h doesn't exist on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants