Run any command like time(1) and report
GPU,
CPU, and
unified memory
utilization on Apple Silicon Macs. Colorized human reports on TTY;
-f format strings for scripts — with BrightDate timestamps
for log correlation.
gpucap forks and execs your command, polls metrics every
100 ms (configurable with --interval), then prints a
summary to stderr. Exit status matches the child process.
gpucap sleep 1
gpucap --color=bright -- ffmpeg -i in.mp4 out.mp4
gpucap --interval 50 make -j8
gpuexercise is a subcommand (not a separate binary) that
drives sustained GPU load via a Metal compute shader and feedback loop:
gpucap gpuexercise --percent 50 --seconds 10
gpucap gpuexercise -f 'target=%tG gpu=%gA/%gP elapsed=%e' -p 75 -s 5
macOS on Apple Silicon (M1/M2/M3/M4+), arm64 only. Reads AGX GPU metrics and unified memory statistics unavailable on Intel Macs or non-macOS platforms.
--color[=WHEN] — auto,
always, never, plain,
ansi, truecolor.
--color-scheme — default or
bright. Env: GPUCAP_COLOR,
GPUCAP_COLOR_SCHEME, plus NO_COLOR /
CLICOLOR.
Format vs. color:
When -f / --format (or
GPUCAP_FORMAT) is set, output is always plain text — even
if --color=always. This matches BrightDate ecosystem
conventions: human reports colorize on TTY; machine format strings stay
script-safe.
-f / --format
Custom format strings follow
BrightDate FORMAT-SPEC
where applicable, plus gpucap-specific utilization specifiers.
Set via -f or environment variable
GPUCAP_FORMAT.
gpucap -f '%gA,%gP,%uA,%uP,%hA,%hP,%e,%Ws,%Wt' sleep 1
gpucap -f 'cmd=%C x=%x gpu_peak=%gP start=%Ws' cargo build
All percentages output one decimal place, no % suffix.
| Specifier | Meaning |
|---|---|
| %gA / %gP | GPU average / peak % |
| %uA / %uP | CPU average / peak % (system-wide) |
| %hA / %hP | Unified memory average / peak % |
| %tG | Exercise target GPU % (gpuexercise only) |
Shared with btime -f — see FORMAT-SPEC tiers A–C.
| Specifier | Meaning | Output |
|---|---|---|
| %Ws / %N | Command start wall time | {:.9} BrightDate days |
| %Wt / %n | Command end wall time | {:.9} BrightDate days |
| %e | Elapsed seconds | sec.centis (GNU style) |
| %E | Elapsed wall time | m:ss.cc or h:mm:ss |
| %B | Elapsed wall time | {:.9} BrightDate days |
| %b | Elapsed millidays | {:.6} (no suffix) |
| %dE | Elapsed millidays | {:.6} md |
| %C | Command line | argv joined with spaces |
| %x | Exit status | child exit code |
| %% | Literal % | |
| \t, \n | Tab / newline |
Default machine format:
%gA,%gP,%uA,%uP,%hA,%hP,%e,%Ws,%Wt\n
| Metric | Source | Notes |
|---|---|---|
| GPU | IOKit Device Utilization % |
IOReport fallback when IOKit unavailable |
| CPU | Mach host_processor_info |
System-wide, not per-process |
| Memory | host_statistics64 + hw.memsize |
Unified RAM on Apple Silicon |
Samples are taken every --interval ms (default 100) while
the child runs. Average and peak are computed over all samples.
cargo install gpucap
gpucap sleep 1
brew tap digital-defiance/tap
brew install digital-defiance/tap/gpucap
gpucap --version
gpucap --help
gpucap -f '%gA,%uA,%e' sleep 0.1