Skip to content

Use the meta.profilingStartTime and meta.profilingEndTime fields#4648

Merged
fqueze merged 1 commit into
firefox-devtools:mainfrom
fqueze:useProfilingStartTime
Jun 8, 2023
Merged

Use the meta.profilingStartTime and meta.profilingEndTime fields#4648
fqueze merged 1 commit into
firefox-devtools:mainfrom
fqueze:useProfilingStartTime

Conversation

@fqueze

@fqueze fqueze commented May 31, 2023

Copy link
Copy Markdown
Contributor

They can be used to decide what the profile root range should be. This fixes #4425 and handles most of #3458 (which can be refocused on what remains, ie. using meta.contentEarliestTime to show if/when the buffer overflowed).

Additionally, I tweaked the Profile Info panel to show when the profiler started and for how long it recorded, instead of showing when the parent process started. I'm also showing the uptime of the application when the profiler started (I think that information is more useful than the process start time).

Requesting review from Julien as I already put multiple PRs in Nazim's review queue, but I'm equally happy if Nazim wants to take it.

@fqueze fqueze requested a review from julienw May 31, 2023 04:59
@fqueze fqueze requested a review from a team as a code owner May 31, 2023 04:59
@codecov

codecov Bot commented Jun 7, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.14 🎉

Comparison is base (1885e0c) 88.48% compared to head (3f3b2c3) 88.62%.

❗ Current head 3f3b2c3 differs from pull request most recent head 2e5e256. Consider uploading reports for the commit 2e5e256 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4648      +/-   ##
==========================================
+ Coverage   88.48%   88.62%   +0.14%     
==========================================
  Files         295      294       -1     
  Lines       26266    26116     -150     
  Branches     7082     7050      -32     
==========================================
- Hits        23241    23145      -96     
+ Misses       2814     2766      -48     
+ Partials      211      205       -6     
Impacted Files Coverage Δ
src/test/fixtures/profiles/gecko-profile.js 100.00% <ø> (ø)
src/components/app/MenuButtons/MetaInfo.js 84.90% <100.00%> (+0.21%) ⬆️
src/components/app/WindowTitle.js 96.22% <100.00%> (+0.07%) ⬆️
src/profile-logic/process-profile.js 91.11% <100.00%> (+0.05%) ⬆️
src/profile-logic/profile-data.js 93.69% <100.00%> (+0.02%) ⬆️
src/profile-logic/sanitize.js 96.65% <100.00%> (+0.05%) ⬆️

... and 17 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@julienw julienw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me.

What do you think @flodolo?

Comment thread src/profile-logic/process-profile.js Outdated
thread,
jsTracer,
meta.categories
meta.categories || []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks spurious (and will still fail in this function), can you please revert this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just to silence flow errors. If I don't add the ProfileMeta type annotation on const meta: ProfileMeta, flow fails when I assign values to meta.profilingStartTime = because the profilingStartTime field doesn't exist on the literal object 'meta'. With the meta object annotated to 'ProfileMeta', flow is unhappy on this line because the categories field is optional in ProfileMeta, but convertJsTracerToThread won't take undefined.
Given that I'm not actually changing the behavior and that afaik jsTracer is dead code at this point, I thought this way of silencing the error was fine. Do you see another nicer way?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see :)
You can use geckoProfile.meta.categories directly here, and Flow will be happy.

Comment thread src/types/profile.js
Comment on lines +758 to +761
// When the recording started (in milliseconds after startTime).
profilingStartTime?: Milliseconds,
// When the recording ended (in milliseconds after startTime).
profilingEndTime?: Milliseconds,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be good to repeat these comments in the gecko-profile type file too

expect(processedMeta.sampleUnits).toEqual(geckoMeta.sampleUnits);
});

it('keeps the profilingStartTime and profilingEndTime', function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the new tests!

title += _formatDateTime(meta.startTime);
title += _formatDateTime(
meta.startTime + (meta.profilingStartTime || 0)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@fqueze fqueze force-pushed the useProfilingStartTime branch from 3f3b2c3 to f8963ef Compare June 8, 2023 22:07
@fqueze fqueze enabled auto-merge (squash) June 8, 2023 22:08
@fqueze fqueze force-pushed the useProfilingStartTime branch from f8963ef to 2e5e256 Compare June 8, 2023 22:09
@fqueze fqueze merged commit 7e4fbd6 into firefox-devtools:main Jun 8, 2023
@canova canova mentioned this pull request Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some markers are retained after sanitization and causing the time range to be calculated incorrectly

3 participants