-
Notifications
You must be signed in to change notification settings - Fork 6
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
Rename threads for more compact tracy visualization #49
Rename threads for more compact tracy visualization #49
Conversation
414d1c6
to
dbdf486
Compare
@pepeiborra @expipiplus1 what do you think, does it seem ergonomic enough? |
dbdf486
to
66f40e5
Compare
It looks great. Let me give it a go with one of my traces and report back |
inventDisplayTid tid st@(S {thread2displayThread}) = | ||
case HM.lookup tid thread2displayThread of | ||
Nothing -> | ||
let new_dtid = fromIntegral (HM.size thread2displayThread) |
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.
HM.size
is surprisingly O(n) so you probably want to memoize it
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.
Indeed surprising, I didn't realize that.
tracy 0.7.5 (Mac) segfaults for me when trying to load a trace converted using the new code. It works fine when the trace is converted when the threads are not renamed, i.e. using The trace was generated by HLS on a large project. A similar trace can be created using
edit the
|
Just span_id -> | ||
let (st', sp) = emitSpan serial span_id st | ||
in (st', [sp {spanFinishedAt = now}], []) | ||
(st'', display_tid) = inventDisplayTid tid st' |
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.
If I comment out line 310 (and fix the result state) my trace no longer crashes tracy.
Why invent a new displayTid
instead of reusing the same one used in the BeginSpan
frame? If the events are slightly out of order and the StopThread
event is processed before the EndSpan
event, the displayTid
used here will be completely wrong and crash Tracy.
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.
Good catch.
…already recorded in the first half-span
I think Tracy follows a convention that thread ids should only be positive, I'll add a |
This is great, thanks! |
Fixes #40