Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JSON Output Format

When using Joule Profiler with --json, results are exported as structured JSON.
This format is suitable for programmatic processing, analysis, or exporting to other tools.

Fields

A JSON output of Joule Profiler contains these fields:

FieldDescription
commandProgram and arguments executed
token_patternRegex used to detect phase tokens
exit_codeReturn code of the program
phasesArray of measured phases
indexPhase index
start_token / end_tokenPhase markers
timestampStart timestamp
duration_msPhase duration in milliseconds
metricsList of metrics collected by sources
metrics[].nameSensor name
metrics[].valueMeasured value
metrics[].unitUnit of measurement (e.g., µJ)
metrics[].sourceMetric source name (e.g., RAPL, NVML)

Profile Example

The command:

joule-profiler --json profile -- python3 nbody.py 500000

Displays:

{
  "command": "python3 nbody.py 500000",
  "token_pattern": "__[A-Z0-9_]+__",
  "exit_code": 0,
  "phases": [
    {
      "index": 0,
      "start_token": "START",
      "end_token": "END",
      "timestamp": 1769987285805,
      "duration_ms": 1895,
      "metrics": [
        {
          "name": "CORE-0",
          "value": 45010261,
          "unit": "µJ",
          "source": "powercap"
        },
        {
          "name": "DRAM-0",
          "value": 1302425,
          "unit": "µJ",
          "source": "powercap"
        },
        {
          "name": "PACKAGE-0",
          "value": 51537160,
          "unit": "µJ",
          "source": "powercap"
        }
      ]
    }
  ]
}

Listing Sensors

Here is an example of sensors listing in json format:

joule-profiler --json list-sensors
[
  {
    "name": "PSYS-1",
    "unit": "µJ",
    "source": "powercap"
  },
  {
    "name": "PACKAGE-0",
    "unit": "µJ",
    "source": "powercap"
  },
  {
    "name": "CORE-0",
    "unit": "µJ",
    "source": "powercap"
  },
  {
    "name": "UNCORE-0",
    "unit": "µJ",
    "source": "powercap"
  }
]