CLI Reference: pipe
Command
The pipe
subcommand is designed for non-interactive use. It outputs performance metrics as a stream of single-line JSON objects, making it ideal for scripting, logging, or piping into other command-line tools like jq
.
Usage
macmon pipe [OPTIONS]
Options
-s, --samples <SAMPLES>
- Description: The number of metric samples to collect before exiting.
-
Default:
0
(runs indefinitely until manually stopped, e.g., with Ctrl+C). -
--soc-info
- Description: A boolean flag that, when present, includes detailed SoC (System on a Chip) information in each JSON output.
-
Default:
false
. -
-i, --interval <INTERVAL>
- Description: Sets the update interval in milliseconds. This is a global option that also applies to the
pipe
command. - Default:
1000
.
Examples
1. Stream metrics and pretty-print with jq
:
macmon pipe | jq
2. Collect 10 samples with a 500ms interval:
macmon pipe -s 10 -i 500
JSON Output Schema
Each line of output is a self-contained JSON object with the following structure.
{
"timestamp": "2025-02-24T20:38:15.427569+00:00", // ISO 8601 timestamp
"temp": {
"cpu_temp_avg": 43.73614, // Celsius
"gpu_temp_avg": 36.95167 // Celsius
},
"memory": {
"ram_total": 25769803776, // Bytes
"ram_usage": 20985479168, // Bytes
"swap_total": 4294967296, // Bytes
"swap_usage": 2602434560 // Bytes
},
"ecpu_usage": [1181, 0.082656614], // [Frequency MHz, Usage % (0.0 to 1.0)]
"pcpu_usage": [1974, 0.015181795], // [Frequency MHz, Usage % (0.0 to 1.0)]
"gpu_usage": [461, 0.021497859], // [Frequency MHz, Usage % (0.0 to 1.0)]
"cpu_power": 0.20486385, // Watts
"gpu_power": 0.017451683, // Watts
"ane_power": 0.0, // Watts
"all_power": 0.22231553, // Watts (cpu + gpu + ane)
"sys_power": 5.876533, // Watts (total system power, if available)
"ram_power": 0.11635789, // Watts
"gpu_ram_power": 0.0009615385 // Watts
}