Negative time reported
Closed this issue · 4 comments
rogierschouten commented
This module reports negative times now and then. This is due to the measurement method. Maybe a better method would be to schedule a setImmediate() on the timeout and measure the lag of that?
aheckmann commented
Could you explain why that's better? I'm thinking the occasional negative value is due to how timers are implemented. Probably just return 0 if we go negative.
rogierschouten commented
You want to measure NodeJS cycle time right? What you're seeing now is cycletime + timer-noise. Measuring with setImmediate uses a simpler implementation underwater (hence less noise) and you will always get a positive outcome. In other words, you get closer to the value you want to measure.
aheckmann commented
nice. PR?
rogierschouten commented
DIY