Measurement Methodology¶
This document describes the core measurement principles and methodologies used in A-LEMS.
๐ฏ Core Principles¶
1. Immutable Raw Data¶
All raw measurements are never modified. This ensures: - Reproducibility - Original data always available - Auditability - Calculations can be verified - Flexibility - New analysis methods can be applied retrospectively
2. Three-Layer Architecture¶
Raw Measurements (immutable)
โ
โผ
Baseline Subtraction
โ
โผ
Derived Metrics (workload, tax, etc.)
3. Timestamp Precision¶
All samples have nanosecond-precision timestamps for: - Exact correlation with AI workflow phases - Accurate power calculation - Precise energy attribution
โก RAPL Energy Measurement¶
How RAPL Works¶
Intel's Running Average Power Limit (RAPL) provides energy counters for different CPU domains:
| Domain | Description | Energy Counter |
|---|---|---|
| Package | Entire CPU package (cores + uncore) | package_energy_uj |
| Core | All CPU cores combined | core_energy_uj |
| Uncore | Cache, memory controller, I/O | uncore_energy_uj |
| DRAM | Memory subsystem | dram_energy_uj |
Each domain has a cumulative energy counter in microjoules (ยตJ):
Energy Calculation¶
Energy consumed during measurement interval:
Average power:
100Hz Sampling¶
The sampling thread runs at 100Hz (configurable):
This captures energy dynamics at: - 50Hz Nyquist frequency - Transient spikes down to 20ms duration - Sub-milliwatt power resolution
๐ Idle Baseline Methodology¶
Why Baseline Matters¶
Total measured energy includes both workload and system overhead:
To isolate workload energy, we measure idle power:
Baseline Measurement Protocol¶
- Core pinning: Pin measurement thread to dedicated core
- Pre-wait: Allow system to enter deep idle (5-10 seconds)
- Multiple samples: 3-10 samples of 10-30 seconds each
- Statistical processing: Mean and standard deviation per domain
Confidence Interval Approach¶
Rather than using mean power, we use the lower bound of 95% confidence interval:
This prevents over-subtraction of idle energy.
๐งฎ Derived Metrics¶
Workload Energy¶
Reasoning Energy¶
Orchestration Tax (Mathematical Proof)¶
Conclusion: Orchestration tax equals uncore energy minus idle uncore energy. This is where cache, memory controller, and I/O overhead appear.
๐ก๏ธ Thermal Measurement¶
Temperature Sampling¶
Thermal zones sampled at 1Hz:
Thermal Gradient¶
Rate of temperature change:
Thermal-Energy Coupling¶
At high temperatures, leakage current increases:
Total power:
๐ Performance Counter Methodology¶
Instructions Per Cycle¶
IPC indicates CPU efficiency: - < 1.0: Memory-bound or stalled - 1.0 - 2.0: Mixed workload - > 2.0: Compute-bound, efficient
Cache Miss Rate¶
High miss rates indicate: - Poor data locality - Random access patterns - Working set exceeds cache size
๐ C-State Measurement¶
C-State Residency¶
Time spent in each C-state:
Residency percentage:
Power Savings¶
Energy saved by entering deep C-states:
๐ Statistical Methodology¶
Sample Size Determination¶
For desired effect size \(\delta\), power \(1-\beta\), and significance \(\alpha\):
Confidence Intervals¶
95% confidence interval for mean:
Outlier Detection¶
Values outside \(\mu \pm 3\sigma\) are flagged for review.
๐ฏ Measurement Validation¶
Repeatability¶
Coefficient of variation across identical runs:
Acceptable: < 5%
Accuracy Validation¶
Comparison with external power meter:
Acceptable: < 2%
๐ References¶
- Intel Corporation. (2012). "Intelยฎ 64 and IA-32 Architectures Software Developer's Manual"
- Hรคhnel, M., et al. (2012). "Measuring Energy Consumption for Short Code Paths Using RAPL"
- Khan, K. N., et al. (2018). "Energy Profiling Using RAPL"