Skip to content

Report all profiler-cli JSON times relative to the profile start - #6459

Open
fatadel wants to merge 1 commit into
firefox-devtools:mainfrom
fatadel:profiler-cli-json-time-base
Open

fatadel wants to merge 1 commit into
firefox-devtools:mainfrom
fatadel:profiler-cli-json-time-base

Conversation

@fatadel

@fatadel fatadel commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Main | Deploy preview

Some times in --json output were milliseconds since the profile start and others were raw profile timestamps. Now all of them are relative to the profile start, and only rootRange stays raw.

This covers view ranges and zoom results, counter buckets, thread and process lifetimes, CPU activity slices, network request starts, the page load navigation start, and the timestamps inside marker payloads (data and fields[].value).

Payload timestamps are found through the marker schema: every field with format: 'time' is shifted. The front-end IPC and Network schemas now declare their timestamp fields as hidden time fields for this.

Marker search in the web app skips time fields, so that a search for a number doesn't match the raw timestamps of IPC and Network markers.

Closes #6458

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.24%. Comparing base (68f63c0) to head (1e4b5e7).
⚠️ Report is 185 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/formatters/profile-info.ts 62.50% 2 Missing and 1 partial ⚠️
src/profile-logic/marker-schema.ts 66.66% 1 Missing ⚠️
src/profile-query/formatters/thread-info.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6459      +/-   ##
==========================================
+ Coverage   84.97%   85.24%   +0.27%     
==========================================
  Files         359      372      +13     
  Lines       39170    40804    +1634     
  Branches    11115    11702     +587     
==========================================
+ Hits        33284    34784    +1500     
- Misses       5449     5580     +131     
- Partials      437      440       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fatadel
fatadel force-pushed the profiler-cli-json-time-base branch from 426a73d to 807d471 Compare November 16, 2026 11:49
@fatadel
fatadel requested review from canova and mstange and removed request for canova November 16, 2026 11:50
@fatadel
fatadel marked this pull request as ready for review November 16, 2026 11:50
@fatadel
fatadel requested a review from canova November 16, 2026 11:50
@fatadel
fatadel force-pushed the profiler-cli-json-time-base branch 2 times, most recently from fba348b to 2610fec Compare November 16, 2026 16:57

@canova canova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let me know if my thinking is way off on the comment below. I feel like it took me a long time to understand and review, but I might be still missing somethign.

Comment thread src/profile-logic/process-profile.ts Outdated
Comment on lines +1691 to +1719
if (newData.type === 'Network') {
if (typeof newData.domainLookupStart === 'number') {
newData.domainLookupStart += delta;
}
if (typeof newData.domainLookupEnd === 'number') {
newData.domainLookupEnd += delta;
}
if (typeof newData.connectStart === 'number') {
newData.connectStart += delta;
}
if (typeof newData.tcpConnectEnd === 'number') {
newData.tcpConnectEnd += delta;
}
if (typeof newData.secureConnectionStart === 'number') {
newData.secureConnectionStart += delta;
}
if (typeof newData.connectEnd === 'number') {
newData.connectEnd += delta;
}
if (typeof newData.requestStart === 'number') {
newData.requestStart += delta;
}
if (typeof newData.responseStart === 'number') {
newData.responseStart += delta;
}
if (typeof newData.responseEnd === 'number') {
newData.responseEnd += delta;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can move them to the markerSchemaFrontEndOnlyWithoutPII with format: 'time'. So we don't have to hardcode them here or anywhere. We would need to do for IPC markers and network markers, right?

This way I believe we would remove the hardcoded fields from everywhere, and just shift all the things with format: 'time' which makes it more generic. I guess we wouldn't need an upgrader for this since it's all in the frontend schema, and we are essentially not changing the behavior.

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.

Thanks for your great suggestion, it does make sense to me! Yeah I think IPC and Network are the only ones that need that special handling. I tried implementing it this way now, please have a look when you have a chance.

Marker starts and ends, stack capture times and the counter sample
range were already milliseconds since the profile start, but the other
times in --json output were raw profile timestamps, offset from those
by rootRange.start. View ranges and zoom results, counter buckets,
thread and process lifetimes, CPU activity slices, network request
starts and the page load navigation start now use the same base.
rootRange stays raw.

The timestamps inside a marker's payload are rebased in `data` and in
`fields[].value` too, for every field that has the `time` format in the
marker schema. The front-end IPC and Network schemas declare their
timestamp fields as hidden `time` fields, so these are covered as well.

Marker search skips `time` fields. Otherwise a search for a number
would match the raw timestamps of the IPC and Network markers.
@fatadel
fatadel force-pushed the profiler-cli-json-time-base branch from 2610fec to 1e4b5e7 Compare December 4, 2026 09:41
@fatadel
fatadel requested review from canova and mstange December 4, 2026 12:01
@mstange

mstange commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Haven't looked at the code yet, but one thing that came to my mind recently was: What happens in other places where we shift timestamps? The two I know of are profile processing, and profile merging. Especially merging I would expect to already have to have full coverage of timestamps

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.

profiler-cli --json output mixes two time bases

3 participants