-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chrome trace timestamp should be in microseconds not seconds. #8600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch.
A potentially important side discussion is needed here as I don't think this is necessarily always a question of scaling microseconds to seconds. From the code, it looks like the timer used in the event
module is based on timeit.default_timer
. From the python docs, timeit.default_timer
is always time.perf_counter
, which doesn't seem to guarantee the unit of the returned value, it's just "the clock with the highest available resolution". This means the resolution needs to be known to work out an appropriate scaling factor to get to the unit of seconds
.
I think there's two options:
- Use
time.perf_counter_ns
for timing, time would then always be reported in nanoseconds and scaling to seconds would always be via a constant factor. This also has the advantage of not losing precision through the use of afloat
type as the returned value. - Continue to use
timeit.default_timer
i.e.time.perf_counter
. Then querytime.get_clock_info('perf_counter')
to get the resolution of the timer, the inverse of which is the scaling to get to the unit ofseconds
.
Any thoughts @sklam ?
@stuartarchibald, even though The tracing format expect a |
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
Thanks! Following some OOB discussion, turns out this is all ok. The issue is that the tracer output needs to be in microseconds and the clocks are reporting in seconds even if not explicitly noted, so the scale factor is constant and there's no resolution issue or otherwise! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, changes look good. @guilhermeleobas did you perhaps want to test this as in #8599 ?
Thanks for confirming @guilhermeleobas ! |
Fix #8599.