COMMAND LINE · CI · AI AGENTS

Your app's performance,
without the window.

The Device Performance Monitor app is also a CLI. Give it a device and a package and it samples memory, CPU, threads and frame rate, writes JSON, and exits non-zero when a budget is blown — so CI can fail a build, and an AI agent can read the numbers back to you.

Generated from dpm 1.7.0 (29) · free · macOS 14 or later

WITH AN AI AGENT

Hand it to Claude Code, Codex or Cursor.

The agent runs dpm on your Mac and reads the JSON back to you. Copy a prompt, or drop the whole reference into your repo's AGENTS.md so the agent needs no prompt at all.

Check a flow for memory leaks

Use the dpm CLI (run `dpm help record` first). Run `dpm devices` to find my device, then record com.example.app for 120 seconds with `dpm record --platform android --package com.example.app --duration 120 --out session.json` while I use the app. When it finishes, read the summary in session.json and tell me whether app memory kept climbing or came back down, with the average and peak in MB.

Compare before and after my change

Use dpm to measure the impact of my current change on com.example.app. Record 60 seconds with `dpm record --platform android --package com.example.app --duration 60 --out after.json`. Then stash my changes, rebuild and install the app, record again to before.json, and restore my changes. Compare the summary sections of both files and give me a table of app memory and CPU (avg and peak) with the difference.

Add a performance gate to CI

Add a performance budget step to our CI workflow using the dpm CLI from Device Performance Monitor (`dpm help record` lists the flags). It should run `dpm record` for com.example.app with `--max-app-memory 400 --max-cpu 60 --out perf.json`, fail the job when dpm exits 1, and always upload perf.json as an artifact. Exit codes: 0 ok, 1 over budget, 2 bad usage, 3 no device or app, 4 write error.

Compare battery drain across branches

Use `dpm battery` to compare battery drain between main and my branch for com.example.app on the connected device. For each branch: check it out, build and install the app, then run `dpm battery --label <branch> --package com.example.app --duration 600 --out battery-<branch>.json`. Finally compare drainPerHour, avgTempC and peakTempC and tell me whether my branch is worse.

Or point the agent straight at the machine-readable reference — the same text as the commands below:

curl -s https://dpm.coursion.studio/cli.md

INSTALL

One link on your PATH.

Install the app, then open Settings → Command line → Install — it links dpm into /opt/homebrew/bin or /usr/local/bin and keeps pointing at the app as it updates.

brew install --cask coursion-studio/tools/device-performance-monitor

COMMANDS

Every command, every flag.

dpm record

Sample one app's live metrics and write a session JSON.

Samples the app for --duration seconds with the same collectors the app uses, then writes every sample plus a min/avg/max summary per metric. Budgets turn it into a CI gate: the command exits 1 when one is exceeded.

dpm record --platform <android|simulator|iosDevice> --package <id> --out <file.json> [options]
OptionMeaning
--platform <android|simulator|iosDevice>Where the app runs. required
--package <id>Package name or bundle identifier. required
--out <file.json>Where to write the session. Use - for stdout. required
--serial <id>Device serial or UDID. Default: the first ready device.
--duration <seconds>How long to sample. default 60
--interval <seconds>Time between samples. default 1
--max-app-memory <MB>Fail when peak app memory goes over this.
--max-cpu <%>Fail when average app CPU goes over this.
--quietOnly print errors.
dpm record --platform android --package com.example.app --duration 60 --out session.json
dpm record --platform android --package com.example.app \
  --duration 120 --max-app-memory 400 --max-cpu 60 --out ci.json

dpm battery

Record a labeled battery and thermal report.

Records drain rate, average and peak temperature and the charge curve under a label, so one run per branch can be diffed in CI. Android only. With --package it also reads the app's versionName.

dpm battery --label <name> --out <file.json> [options]
OptionMeaning
--label <name>What this run is, e.g. the branch. required
--out <file.json>Where to write the report. Use - for stdout. required
--serial <id>Device serial. Default: the first ready device.
--package <id>App to stamp the report with.
--duration <seconds>How long to record. default 600
--interval <seconds>Time between readings. default 5
--quietOnly print errors.
dpm battery --label "$(git branch --show-current)" \
  --package com.example.app --duration 600 --out battery.json

dpm devices

List connected devices and simulators.

Shows every device each installed toolchain can see, with the serial to pass as --serial. Platforms whose tool is missing are skipped.

dpm devices [options]
OptionMeaning
--platform <android|simulator|iosDevice>Only list one platform.
--jsonPrint JSON instead of a table.
dpm devices
dpm devices --platform android --json

dpm apps

List the apps installed on a device.

Prints package names you can pass to record. Only your own apps unless --all is given.

dpm apps --platform <android|simulator|iosDevice> [options]
OptionMeaning
--platform <android|simulator|iosDevice>Where to look. required
--serial <id>Device serial or UDID. Default: the first ready device.
--allInclude system apps.
--runningOnly apps that are running now.
--jsonPrint JSON instead of a table.
dpm apps --platform android --running
dpm apps --platform android --json

dpm docs

Print this reference as markdown or JSON.

Writes the full command reference — flags, defaults, exit codes and what the JSON contains — so an AI agent or a docs site can read it instead of guessing.

dpm docs [options]
OptionMeaning
--jsonPrint JSON instead of a table.
dpm docs > dpm.md
dpm docs --json

EXIT CODES

What CI reads.

CodeMeaning
0Success
1A budget was exceeded — the CI gate failed
2Bad usage — unknown command or option
3No tool, device or running app to read
4Could not write the output

A GitHub Actions gate

- name: Performance budget
  run: |
    brew install --cask coursion-studio/tools/device-performance-monitor
    DPM="/Applications/Device Performance Monitor.app/Contents/MacOS/Device Performance Monitor"
    "$DPM" record --platform android --package com.example.app \
      --duration 120 --max-app-memory 400 --max-cpu 60 --out perf.json
- uses: actions/upload-artifact@v4
  if: always()
  with: { name: perf, path: perf.json }