Skip to content

Experiment with a command-line tool for querying profile contents#5663

Draft
mstange wants to merge 20 commits intofirefox-devtools:mainfrom
mstange:pq-cli-wip
Draft

Experiment with a command-line tool for querying profile contents#5663
mstange wants to merge 20 commits intofirefox-devtools:mainfrom
mstange:pq-cli-wip

Conversation

@mstange
Copy link
Copy Markdown
Contributor

@mstange mstange commented Nov 6, 2025

Sometimes I've wanted to inspect profiles from the command line, without loading them in the web UI.

Here's an experiment I've been working on, which creates a pq tool ("profile query"). To test, clone this branch and run yarn build-profile-query-cli - this creates a ./dist/pq.js artifact. Then somehow make it accessible via your path, for example by putting a shell script with the contents node ~/code/profiler/src/profile-query-cli/dist/pq.js "$@" into a bin directory in your path.

pq load 'https://share.firefox.dev/hash' or pq load profile.json.gz start a session.

Only tested on macOS so far. It uses unix domain sockets so it probably doesn't work on Windows atm.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 43.37596% with 1107 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.57%. Comparing base (2a7d07e) to head (b570f1a).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/formatters/marker-info.ts 4.65% 533 Missing ⚠️
src/profile-query/index.ts 39.08% 159 Missing ⚠️
src/profile-query/formatters/thread-info.ts 29.19% 114 Missing ⚠️
src/profile-query/cpu-activity.ts 0.00% 71 Missing ⚠️
src/profile-query/formatters/profile-info.ts 0.00% 57 Missing ⚠️
src/profile-query/loader.ts 0.00% 47 Missing ⚠️
src/selectors/profile.ts 46.34% 22 Missing ⚠️
src/profile-query/function-list.ts 90.00% 18 Missing ⚠️
src/profile-query/formatters/call-tree.ts 86.71% 17 Missing ⚠️
src/profile-query/marker-map.ts 11.76% 15 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5663      +/-   ##
==========================================
- Coverage   85.38%   83.57%   -1.82%     
==========================================
  Files         322      329       +7     
  Lines       32099    33816    +1717     
  Branches     8840     9233     +393     
==========================================
+ Hits        27408    28261     +853     
- Misses       4260     5127     +867     
+ Partials      431      428       -3     

☔ View full report in Codecov by Sentry.
📢 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 canova force-pushed the pq-cli-wip branch 5 times, most recently from 288f7da to c87bd3c Compare March 16, 2026 21:44
@canova canova force-pushed the pq-cli-wip branch 2 times, most recently from 88b628b to 1566123 Compare April 9, 2026 15:35
canova and others added 18 commits April 10, 2026 18:11
This is useful for cases where I want to drop all the "idle" category
samples, so I can focus on non-idle samples. Or it can be useful for
dropping the whole profiler overhead by removing the "profiler"
category.

I would like to use this transform in the pq cli tool, so we can remove
the idle category before finding the "top functions". Otherwise the idle
category just pollutes the output of the cli a lot.
A `yarn test:cli` script was added to run only the cli tests, but it
looks like the main tests are also running them since they match the
testMatch glob.
`pq thread select t-x` doesn't work without running `pq profile info`
first. If the pq session is restarted in between, we need to call it
again to make sure that we generate the thread handles etc.
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.

2 participants