-
Notifications
You must be signed in to change notification settings - Fork 420
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
Compute the profiling start and end time for chrome tracing profiles #5187
Compute the profiling start and end time for chrome tracing profiles #5187
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5187 +/- ##
=======================================
Coverage 88.56% 88.57%
=======================================
Files 308 308
Lines 28011 28025 +14
Branches 7578 7585 +7
=======================================
+ Hits 24809 24823 +14
Misses 2985 2985
Partials 217 217 ☔ View full report in Codecov by Sentry. |
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.
Seems reasonable!
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.
This looks reasonable to me.
Do you know how the change in #4797 fits with this change too?
Thanks for the reviews!
Good question, I completely forgot about this one. But it looks like this is changing the |
* main: (173 commits) Profile format changes for flows and stack-based markers Update all Yarn dependencies (2024-11-06) (firefox-devtools#5189) Add new tests for title changes for the startTime and public annotation Do not include the profile startTime in window title if it's zero Compute the profiling start and end time for chrome tracing profiles (firefox-devtools#5187) Do not clip the favicons in call tree (firefox-devtools#5185) Make sure that the symbolicator-cli builds properly Remove the unnecessary check after making favicon non-null Add default icons for tab selector pages and extensions that don't have favicons Update all Yarn dependencies (2024-10-30) (firefox-devtools#5181) Update the Firefox versions that introduces the webchannel Add a test for the favicons webchannel retrieval path Upgrade the webchannel mock to version 4 Add comment explaining webchannel version 4 Make the favicons fetching and symbolication run in parallel Update a comment to explain a possible path Use ArrayBuffer instead of using TypedArray directly Remove the unneeded image mock Get the binary favicon data directly and batch the icon loading for data urls Use a static icon counter for favicon classes ...
[Nazım Can Altınova] Change the test-build-coverage script to use 'yarn test' instead of jest directly (#5180) [Nazım Can Altınova] Retrieve the page favicons from the browser and display it on the tab selector (#5166) [Nazım Can Altınova] Add default favicons to extensions and pages that don't have nay favicons (#5182) [Nazım Can Altınova] Do not clip the favicons in call tree (#5185) [Nazım Can Altınova] Compute the profiling start and end time for chrome tracing profiles (#5187) [Nazım Can Altınova] Do not include the profile startTime in window title if it's zero (#5188) [Markus Stange] Profile format changes for flows and stack-based markers (#5186) [Nazım Can Altınova] Fix some svg images for Chrome by replacing context-fill with the black color (#5201) [Nazım Can Altınova] Enable the tab selector (#5197) [Nazım Can Altınova] Do not make the parent process visible by default when something is selected in the tab selector (#5198)
Previously we were adding the
profilingStartTime
andprofilingEndTime
only when we were importing aCpuProfile
:profiler/src/profile-logic/import/chrome.js
Lines 680 to 685 in e0ab0b6
But we weren't doing it for the other tracing profiles because it wasn't as straightforward. This proved to be a problem when I was looking at the profiles where I captured using our chrome extension, but it's also the same when I capture a profile in the Chrome's performance tab and then import it.
For example look at this profile here: https://share.firefox.dev/3AieK8R
Even though the profile is only like 1.5-2 seconds long, I'm getting a 1m 12s profile because of some rouge tracing events from before the profiler has started. It looks like a bug in how chrome streams these tracing values.
If you import the same profile to Chrome, it actually finds the correct time range. Here's the raw trace file, you can try it yourself on your Chrome:
Trace.json
So this PR changes the algorithm to look for the
TracingStartedInBrowser
event and use its start time as theprofilingStartTime
. We don't have an event for theprofilingEndTime
. So I'm using the same logic we use to determine that. It didn't have a problem before so it makes sense to keep that the same.Example profiles (of the trace I linked above): Before / After
You can also use the example trace.json profile to import it yourself
For testing it looks like we only have snapshot tests for chrome tracing. It updated some profiles, but also it kept the older
profilingStartTime
s andprofilingEndTime
s frmo CpuProfiles. So I think this is enough coverage for it as well.