Skip to content

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

Draft
fatadel wants to merge 2 commits into
firefox-devtools:mainfrom
fatadel:profiler-cli-json-time-base
Draft

fatadel wants to merge 2 commits 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).

The first commit extracts adjustMarkerPayloadTimestamps from adjustMarkerTimestamps, so the CLI shifts payload timestamps with the same code that profile merging uses.

Closes #6458

The shifting of the timestamps of one marker payload is its own
exported function, so that it can be used without a raw marker table.

It replaces a shifted `cause` with a copy instead of changing the
object that the input payload also points to. The returned payloads are
the same as before, and the existing tests pass unchanged.
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. They are shifted with
adjustMarkerPayloadTimestamps, plus the timestamps that marker
derivation adds to IPC and Network payloads.

Text output is unchanged.
@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.00%. Comparing base (68f63c0) to head (426a73d).
⚠️ Report is 17 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-query/formatters/thread-info.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6459      +/-   ##
==========================================
+ Coverage   84.97%   85.00%   +0.03%     
==========================================
  Files         359      362       +3     
  Lines       39170    39680     +510     
  Branches    11115    11179      +64     
==========================================
+ Hits        33284    33731     +447     
- Misses       5449     5510      +61     
- Partials      437      439       +2     

☔ 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.

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

1 participant