Skip to content

Surface network activity across profiler-cli#6175

Open
canova wants to merge 7 commits into
firefox-devtools:mainfrom
canova:cli-network
Open

Surface network activity across profiler-cli#6175
canova wants to merge 7 commits into
firefox-devtools:mainfrom
canova:cli-network

Conversation

@canova

@canova canova commented Jul 13, 2026

Copy link
Copy Markdown
Member

Main | Deploy preview

Fixes #6108.

Note that this depends on #6172, so please review that one first. The first commit is that PR, so please ignore it when reviewing this PR as well. I'll rebase this PR once that lands.

This PR adds network information to pq profile info and pq thread info. This also fixes a bunch of things things in the pq thread network, but they are all dependent on each other so it's very difficult to split.

Example profile https://share.firefox.dev/4aGPacn

Profile info and thread info looks like this:

$ pq profile info
[Thread: t-0 (GeckoMain) | View: Full profile | Full: 6.639s]

Name: Firefox 154 – macOS 26.4.1
Platform: macOS 26.4.1

This profile contains 1 threads across 1 processes.

Top processes and threads by CPU usage:
  p-0: Isolated Web Content [https://firefox.com] [pid 20956] [ts<11y → end] - 5213.899ms
    t-0: GeckoMain [tid 73435411] - 5213.899ms
    c-0: Memory - memory range in graph: 1.43GB [4313 samples]
    c-1: Process CPU [6622 samples]

CPU activity over time:
- 77% for 5102.3ms: [ts-1 → ts-z] (5.254ms - 6.637s)
  - 81% for 5093.3ms: [ts-3 → ts-y] (186.89ms - 6.443s)

Network activity: 11 unique requests (deduped across processes)
  In flight 20% of the profile (1.346s of 6.639s), peak 9 concurrent; 0 failed
  Slowest requests:
    m-1  1.345s  https://symbolication.services.mozilla.com/symbolicate/v5  [t-0]  1705.9KB
    m-2  1.339s  https://symbolication.services.mozilla.com/symbolicate/v5  [t-0]  101.7KB
    m-3  1.336s  https://symbolication.services.mozilla.com/symbolicate/v5  [t-0]  123.6KB
    m-4  708.27ms  https://symbolication.services.mozilla.com/symbolicate/v5  [t-0]  221.1KB
    m-5  705.86ms  https://symbolication.services.mozilla.com/symbolicate/v5  [t-0]  8.6KB
  By thread: t-0 https://firefox.com (11 reqs, 1.346s in flight)
$ pq thread info
[Thread: t-0 (GeckoMain) | View: Full profile | Full: 6.639s]

Name: https://firefox.com
TID: 73435411
Created at: ts<11Y
Ended at: still alive at end of recording

This thread contains 6622 samples and 49623 markers.

CPU activity over time:
- 77% for 5102.3ms: [ts-1 → ts-z] (5.254ms - 6.637s)
  - 81% for 5093.3ms: [ts-3 → ts-y] (186.89ms - 6.443s)

Network activity: 11 completed requests
  In flight 20% of the thread's range (1.346s of 6.639s), peak 9 concurrent; cache: 11 unknown; 0 failed
  Slowest requests:
    m-1  1.345s  https://symbolication.services.mozilla.com/symbolicate/v5  1705.9KB
    m-2  1.339s  https://symbolication.services.mozilla.com/symbolicate/v5  101.7KB
    m-3  1.336s  https://symbolication.services.mozilla.com/symbolicate/v5  123.6KB

@canova canova requested review from fatadel and mstange July 13, 2026 17:36
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.98214% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.62%. Comparing base (4cf61c8) to head (89aea62).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/network-summary.ts 96.62% 6 Missing ⚠️
src/profile-query/formatters/marker-info.ts 93.18% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6175      +/-   ##
==========================================
+ Coverage   83.49%   83.62%   +0.13%     
==========================================
  Files         344      345       +1     
  Lines       36868    37057     +189     
  Branches    10343    10370      +27     
==========================================
+ Hits        30782    30989     +207     
+ Misses       5659     5640      -19     
- Partials      427      428       +1     

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

canova added 7 commits July 14, 2026 10:57
Introduce src/profile-query/network-summary.ts with the small,
UI-independent building blocks used by every network consumer: interval
union (wall-clock in-flight time), peak concurrency, the long-lived
(long duration, tiny transfer) heuristic, and cache classification.
These are pure functions with no profile dependencies; the callers land
in the following commits.
The summary now leads with the interval-union in-flight wall-clock time
and peak concurrency, computed over all requests intersecting the range.
The phase totals are relabeled "summed across concurrent requests" so
they no longer read as wall-clock time (they previously showed e.g.
"Download: 24m3s" for a 2m28s profile).
Requests still in flight when the recording stopped are now included in
the request list and counted separately ("N request(s) did not complete
during the recording"). Their duration is measured until the end of the
recording, and durations are clamped to the current range so a request
that started before the range does not report more time than the profile
covers.
Requests are now sorted by in-range duration descending by default, with
--sort start to get chronological order back. A limited window (the
default 20 rows) previously showed the first 20 requests chronologically;
agents need the slowest ones. The order is reflected in the header and
exposed as an explicit `sort` field in JSON.
Requests with a long duration (> 30s) and a small or absent transfer are
flagged with a "(long-lived, low transfer)" suffix. The annotation is
informational only and never filters requests out.
Add a network-activity summary to the two entry-point commands so
wall-clock waiting is as visible as CPU usage. The headline metric is
the interval-union time in flight, plus peak concurrency, in-flight-at-
end counts, and the slowest requests carrying marker handles for
drill-down. Profile-wide numbers are deduped across processes since the
parent process copies every request. The section renders after CPU
activity in both commands.

Extends network-summary.ts with the per-thread and profile-wide
computation on top of the shared helpers, and updates the guide, JSON
schemas, and README so the agent-facing prompt teaches the new signals
(CPU-bound vs wait-bound, the in-flight metric, marker handles, the
long-lived streaming/long-poll annotation, and the --sort flag).
…summaries

Route `collectThreadNetwork` through the `gatherNetworkRecords` /
`clampInterval` / `clampedDurationMs` helpers that `profile info` and
`thread info` already use, and export them from network-summary.ts. This
drops the command's own inline copy of the gather / clamp / count /
cache logic, so there is a single source of truth for "what are this
thread's network requests."
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.

pq profile info and pq thread info should include a network summary

1 participant