-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commands run
run injects profiler code and launches the app in one step, always in --profile
mode. It connects to the Dart VM Service and saves profiler events to JSONL as the app runs.
# Minimal: inject + flutter run --profile
spm run --jsonl results.jsonl
# Specify repo root and output file
spm run -j results.jsonl -r ./my-app -o profiler.jsonl
# Custom flutter subcommand (everything after --flutter is forwarded)
spm run -j results.jsonl --flutter drive \
--driver=test_driver/integration_driver.dart \
--target=integration_test/integration_test.dart
# Run on a specific device
spm run -j results.jsonl -r ./my-app --flutter run -d <device-id>
# Skip injection when the project is already instrumented
spm run --no-inject --flutter run| Flag / Option | Short | Description |
|---|---|---|
--jsonl <path> |
-j |
JSONL manifest from analyze. Required unless --no-inject is set.
|
--repo <path> |
-r |
Flutter project root (defaults to ., the current directory). |
--output <path> |
-o |
Output JSONL for profiler data (defaults to spm/profiler_<timestamp>.jsonl). |
--no-inject |
Skip the inject/revert steps; assumes the project is already instrumented. | |
--verbose |
-v |
Print progress to stdout. |
--flutter [args…] |
Separator. Everything after it is forwarded to the Flutter CLI. |
There is no --mode flag. run always launches in --profile, so it collects
performance_metric events. To collect dataflow-metric events instead, inject
the project and launch it yourself in --debug (see Output Formats).
The forwarded Flutter command is assembled as <subcommand> --profile <extra-args>; with no
--flutter block it defaults to run --profile.
- SPM runs
flutter analyze(onlib), injects the profiler code, then launchesflutter <subcommand> --profile [extra-args]in the repo directory. - It scans stdout for the Dart VM Service URI (e.g.
http://127.0.0.1:8181/…). - It connects over WebSocket and subscribes to the
ext.spm.profilerextension stream. - Each profiler event emitted by
SpmProfilerin the running app is written as a JSONL record. - On app exit, SPM reports the total event count, reverts the injection (unless
--no-inject), and closes.
If the VM Service can't be reached, SPM logs that no profiler data will be captured and still runs the app.
Output Formats defines the performance_metric event schema. run always
runs in --profile, so this is what it produces.
Commands
Reference
Internals
Contributing