Experiment with a command-line tool for querying profile contents#5663
Draft
mstange wants to merge 32 commits intofirefox-devtools:mainfrom
Draft
Experiment with a command-line tool for querying profile contents#5663mstange wants to merge 32 commits intofirefox-devtools:mainfrom
mstange wants to merge 32 commits intofirefox-devtools:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5663 +/- ##
==========================================
- Coverage 85.38% 83.80% -1.58%
==========================================
Files 322 330 +8
Lines 32101 34102 +2001
Branches 8849 9450 +601
==========================================
+ Hits 27410 28580 +1170
- Misses 4260 5093 +833
+ Partials 431 429 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
288f7da to
c87bd3c
Compare
1566123 to
b570f1a
Compare
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.
Previously only filtering by marker was possible. This patch adds some more filtering options that will only be used in the cli for now. They are not exposed in the profiler web frontend.
On Windows, npm binaries (cross-env, jest, run-p, etc.) are installed as .cmd files and can't be found by spawnSync without shell: true. This caused all scripts using this wrapper to silently succeed without running anything, since spawnSync returns status: null on ENOENT, which Node.js treats as exit code 0. Fix by passing the command as a single joined string with shell: true, and add an explicit error check for result.error to catch spawn failures in the future.
cd573e7 to
d877f24
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pqtool ("profile query"). To test, clone this branch and runyarn build-profile-query-cli- this creates a./dist/pq.jsartifact. Then somehow make it accessible via your path, for example by putting a shell script with the contentsnode ~/code/profiler/src/profile-query-cli/dist/pq.js "$@"into abindirectory in your path.pq load 'https://share.firefox.dev/hash'orpq load profile.json.gzstart a session.Only tested on macOS so far. It uses unix domain sockets so it probably doesn't work on Windows atm.