-
Notifications
You must be signed in to change notification settings - Fork 450
Improve the import of profiles generated from clang -ftime-trace=file.json #5714
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5714 +/- ##
==========================================
- Coverage 85.66% 85.64% -0.02%
==========================================
Files 313 313
Lines 30985 31013 +28
Branches 8519 8449 -70
==========================================
+ Hits 26543 26562 +19
- Misses 4012 4021 +9
Partials 430 430 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
canova
left a comment
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 PR!
See my comment below about the beginEventDetail map, I don't think we need it, and ideally it should be gone, but also the current importer is very buggy, and because of it the marker payload/category logic is not working well. That's why it's unfair to ask a lot of changes that are not related to this patch in this PR. I'll file an issue and work on it as a follow-up.
| const key = | ||
| event.ph === 'e' && 'id' in event | ||
| ? `${event.pid}:${event.tid}:${event.id}:${name}` | ||
| : `${event.pid}:${event.tid}:${name}`; |
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.
Nit: Can we extract this key generation logic and use it in all 3 places?
Edit: After thinking more about that I wanna remove all these as per my other comment, but they are for a follow-up.
| // Map to store begin event detail field for pairing with end events. | ||
| // For async events (b/e), key is "pid:tid:id:name" | ||
| // For duration events (B/E), key is "pid:tid:name" | ||
| const beginEventDetail: Map<string, string> = new Map(); |
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.
I was very surprised that we needed a map here, because normally we merge the payloads of start and end markers:
profiler/src/profile-logic/marker-data.ts
Lines 588 to 604 in 2ce8ab6
| // In the case of separate markers for the start and end of an interval, | |
| // merge the payloads together, with the end data overriding the start. | |
| function mergeIntervalData( | |
| startData: MarkerPayload | null, | |
| endData: MarkerPayload | null | |
| ): MarkerPayload | null { | |
| if (startData === null) { | |
| return endData; | |
| } | |
| if (endData === null) { | |
| return startData; | |
| } | |
| return { | |
| ...startData, | |
| ...endData, | |
| }; | |
| } |
And this should have been enough. So locally I tried to remove it and noticed that it actually regressed the state.
Then I accidentally opened a can of worms, because it looks like even though we don't have marker payloads in a chrome event, we still assign a dummy payload to it here:
profiler/src/profile-logic/import/chrome.ts
Lines 1006 to 1010 in 2ce8ab6
| const newData = { | |
| ...argData, | |
| type: name, | |
| category: event.cat, | |
| }; |
It looks like it's just for the category, but wait, we don't actually show the category anywhere in the UI since we don't have a marker schema!
And the marker category itself is assigned to Other by default!
So because of the fact that we always assign a payload even when it doesn't have a payload is breaking this marker payload merge logic...
So even though I don't like this beginEventDetail map, since the chrome importer was broken before this PR, it's unfair to ask for a bigger change from you. I will merge this PR and then I will follow-up myself with proper fixes that:
- Put the category properly to the marker categories.
- Remove the dummy payload if the event doesn't have any data.
- Remove this
beginEventDetailall together with all the logic around it.
Another issue I had with this map is that it wouldn't work well with the nested markers. I don't know if it's possible to have any from clang or any other tool, but I think that's a source of bugs too. But considering that this map will go away, we shouldn't really spend a lot of time on it.
Changes: [Markus Stange] Use a longer test timeout when debugging with VS code. (#5679) [Markus Stange] Move Jest config from package.json to jest.config.js (#5680) [Markus Stange] Make binary profile format parsing use Uint8Array instead of ArrayBuffer (#5678) [Markus Stange] Use workbox-cli to generate the service worker (#5681) [Nazım Can Altınova] Migrate from Appveyor to GitHub Actions Windows runners (#5660) [Nazım Can Altınova] Remove some unused dependencies (#5696) [Nazım Can Altınova] Update the document links and sections (#5705) [Nazım Can Altınova] Clear selected and expanded call node paths on browser back button if it removes transforms (#5701) [Nazım Can Altınova] Properly type the Map and Set objects (#5623) [Valentin Gosu] Add priorityHeader field to network requests (#5707) [Nazım Can Altınova] Redirect unpublished url loads to the homepage similar to from-file (#5712) [Florian Quèze/Nazım Can Altınova] Add an importer for the text format taken as input by flamegraph.pl. (#5359) [Florian Quèze] Improve the import of profiles generated from clang -ftime-trace=file.json (#5714) [Markus Stange] Move React stuff out of marker schema logic module. (#5720) And thanks to our localizers: en-CA: chutten en-CA: Paul es-CL: ravmn fr: Théo Chevalier fur: Fabio Tomat ru: berry tr: Selim Şumlu zh-CN: Olvcpr423 zh-CN: wxie
2 changes:
Example profile: https://share.firefox.dev/4rW0x7q