Refine JSON schema and command metadata

This commit is contained in:
David Peter committed 2026-10-05 18:11:10 +02:00
1 parent c5d3a81fc5
commit 0d86e78ede
15 files changed
+59 -60

No files matched your search

+7 -14
View File
@@ -158,23 +158,16 @@ You can use the `--export-markdown <file>` option to create tables like the foll
#### JSON
The JSON export contains a top-level `"schema_version": 2` and a `results` array with one entry
per benchmark. Earlier exports without `schema_version` use the legacy format (version 1).
The schema version is independent of the hyperfine release version and changes when the format
changes incompatibly; adding optional metrics does not require a new schema version.
The JSON export includes the following metrics for each measured run (excluding warmup runs):
Each result has a `measurements` array with one object per measured run (excluding warmup runs):
| Field | Format | Meaning and platform differences |
| Metric | Unit | Meaning and platform differences |
|:---|:---|:---|
| `time_wall_clock` | `{ "value": number, "unit": "second" }` | Elapsed time, including time spent waiting or descheduled. Available on all platforms. |
| `time_user` | `{ "value": number, "unit": "second" }` | CPU time spent in user mode, accumulated across threads. On Unix, includes descendants whose usage propagates through parents waiting for them. On Windows, includes processes associated with the benchmark's job object. |
| `time_system` | `{ "value": number, "unit": "second" }` | CPU time spent in kernel mode, with the same process accounting as `time_user`. |
| `peak_memory_usage` | `{ "value": number, "unit": "byte" }` | Peak resident set size (RSS) on Linux and macOS; omitted on Windows. This is the largest per-process peak among the command and descendants whose usage is collected by waiting for them, **not the simultaneous total memory of the process tree**. Linux's KiB counter and macOS's byte counter are both exported in bytes. On macOS, this is RSS, not Apple's separate memory-footprint metric. |
| `exit_code` | Integer or `null` | Process exit code; `0` indicates success. On Unix, termination by a signal is encoded as `128 + signal number`. `null` means no exit code could be determined. Failed runs are included when allowed by `--ignore-failure`. |
| `time_wall_clock` | second | Elapsed time, including time spent waiting or descheduled. Available on all platforms. |
| `time_user` | second | CPU time spent in user mode, accumulated across threads. On Unix, includes descendants whose usage propagates through parents waiting for them. On Windows, includes processes associated with the benchmark's job object. |
| `time_system` | second | CPU time spent in kernel mode, with the same process accounting as `time_user`. |
| `peak_memory_usage` | byte | Peak resident set size (RSS) on Linux and macOS; omitted on Windows. This is the largest per-process peak among the command and descendants whose usage is collected by waiting for them, **not the simultaneous total memory of the process tree**. Linux's KiB counter and macOS's byte counter are both exported in bytes. On macOS, this is RSS, not Apple's separate memory-footprint metric. |
Metrics unavailable on a platform are omitted, rather than reported as zero. Consumers should
accept missing metrics and additional fields as new metrics are introduced. Time values are always
Metrics unavailable on a platform are omitted, rather than reported as zero. Time values are always
exported in seconds, regardless of `--time-unit`. When using a shell, the estimated shell startup
CPU and wall-clock times are subtracted; memory usage is not adjusted.