How amin511/joule-profiler works
Joule Profiler is a Linux energy and performance profiler. A user invokes the CLI to run a command; the profiler detects phase tokens in its output while the source orchestrator coordinates metric collection, then results are aggregated and rendered as terminal, JSON, or CSV. Metric-source implementations cover CPU, process/system, and GPU measurements. The README documents these capabilities; relationships among some source adapters and the core are not explicit in the sampled excerpts, so those links are shown as unverified where useful.
Main entry points: profiler/mod.rs Command profiler · displayer/mod.rs Output selection · profile.rs Profile command · config/mod.rs Config loading
Components 24
CLI and configuration
- Profile command
cli/src/commands/profile.rs - Config loading
cli/src/config/mod.rs - CLI overrides
cli/src/config/overrides.rs - Source config table
cli/src/config/table.rs
Profiling core
- Command profiler
core/src/profiler/mod.rs - Phase detection
core/src/phase.rs - Source orchestrator
core/src/orchestrator/mod.rs - Source runtime
core/src/source/runtime.rs - Sensor model
core/src/sensor.rs - Metric units
core/src/unit.rs
Metric sources
- RAPL powercap
sources/rapl/src/powercap/mod.rs - RAPL perf
sources/rapl/src/perf/mod.rs - Perf counters
sources/perf_event/src/event.rs - NVIDIA GPU
sources/nvml/src/counters.rs - AMD GPU
sources/amdsmi/src/counters.rs - Cgroup metrics
sources/cgroup/src/cgroup.rs - Procfs metrics
sources/procfs/src/snapshot.rs
Results and output
- Phase aggregation
core/src/aggregate/phase.rs - Sensor results
core/src/aggregate/sensor_result.rs - Output selection
cli/src/output/displayer/mod.rs - CSV output
cli/src/output/formats/csv.rs - JSON output
cli/src/output/formats/json.rs - Terminal output
cli/src/output/formats/terminal.rs
Other components
- User
Connections 21
- User → Profile command: runs profile
README.md - Profile command → Config loading: loads settings
- Config loading → CLI overrides: applies overrides
cli/src/config/mod.rs - Config loading → Source config table: builds source table
cli/src/config/mod.rs - Profile command → Command profiler: profiles command
- Command profiler → Phase detection: detects tokens
core/src/profiler/mod.rs - Command profiler → Source orchestrator: coordinates sources
core/src/profiler/mod.rs - Source orchestrator → Source runtime: runs sources
- Source runtime → Phase aggregation: aggregates metrics
core/src/source/runtime.rs - Phase aggregation → Sensor results: builds results
core/src/aggregate/sensor_result.rs - Command profiler → RAPL powercap: collects energy
- Command profiler → RAPL perf: collects energy
- Command profiler → Perf counters: collects counters
- Command profiler → NVIDIA GPU: collects GPU metrics
- Command profiler → AMD GPU: collects GPU metrics
- Command profiler → Cgroup metrics: collects usage
- Command profiler → Procfs metrics: collects usage
- Command profiler → Output selection: selects format
- Output selection → CSV output: renders CSV
cli/src/output/displayer/mod.rs - Output selection → JSON output: renders JSON
cli/src/output/displayer/mod.rs - Output selection → Terminal output: renders terminal
cli/src/output/displayer/mod.rs