Carbon Tracking
warpt carbon tracks the energy your hardware consumes during a workload and converts it into CO2 emissions and electricity cost. This page explains every number you see in the output, how it's calculated, and where the assumptions come from.
Quick Start
# Set your grid region once
warpt carbon set-region --value EU-DE
# Optionally set your electricity rate
warpt carbon kwh-price --value 0.21
# Track a workload
warpt carbon start --label "training run"
# ... run your workload ...
warpt carbon stop
If you don't set a region, warpt defaults to US (385 gCO2/kWh) and prints a warning. If you don't set a rate, warpt defaults to $0.12/kWh.
What warpt measures
Power (watts)
warpt reads power draw from hardware interfaces at a configurable interval (default: 1 second). The available sources depend on your platform:
| Source | Platform | What it reads |
|---|---|---|
| RAPL | Linux (Intel/AMD) | CPU package, cores, DRAM, and platform power via /sys/class/powercap/ |
| powermetrics | macOS | CPU, GPU, ANE, and DRAM power via Apple's powermetrics daemon |
| NVML | Linux/Windows | NVIDIA GPU power via the NVIDIA Management Library |
warpt sums all available sources into a total power reading for each sample. If a source is unavailable (e.g., RAPL requires read permissions), warpt warns you but continues tracking with whatever sources it can access. This means the total may undercount if a source is missing.
Caveat: warpt measures the components it can see, not the entire machine. PSU losses, fans, disks, NICs, and other peripherals are not included. The total power reported is a lower bound of actual wall power. Typical PSU efficiency is 80-90%, so actual wall draw is roughly 10-20% higher than what warpt reports.
Energy (mWh / kWh)
Energy is power integrated over time. warpt uses trapezoidal integration over the collected power samples:
E = sum of ((W[i] + W[i+1]) / 2) * (t[i+1] - t[i]) for each consecutive pair
Where W[i] is the power in watts at sample i and t[i] is the timestamp in seconds. The result is in joules, converted to kWh by dividing by 3,600,000.
When hardware energy counters are available (RAPL energy_uj, NVML energy counters on Volta+ GPUs), warpt uses the counter delta directly instead of integrating polled samples. Counter-based measurement is more accurate because the hardware tracks energy continuously rather than relying on periodic polling.
warpt displays energy in milliwatt-hours (mWh) because most tracking sessions are short and the kWh values would have many leading zeros. For reference: 1 kWh = 1,000,000 mWh.
CO2 Emissions (grams)
CO2 (grams) = Energy (kWh) * Grid Intensity (gCO2/kWh)
Grid intensity varies dramatically by region because different grids use different mixes of coal, gas, nuclear, hydro, wind, and solar. See the Grid Intensity by Region table below.
Caveat: warpt uses annual average grid intensity values. Real-time grid carbon intensity fluctuates throughout the day (more renewables at midday, more fossil fuels at night). Services like Electricity Maps and WattTime provide real-time marginal intensity, which can differ significantly from the annual average. If you need higher accuracy, use
warpt carbon intensity --value <N>to set a value from a real-time source.
Caveat: These are Scope 2 (indirect) emissions only — the CO2 from generating the electricity you consumed. They do not include Scope 1 (direct, e.g., diesel generators) or Scope 3 (embodied carbon in hardware manufacturing, cooling infrastructure, network equipment, etc.). For data center workloads, embodied carbon can be significant.
Electricity Cost (USD)
Cost (USD) = Energy (kWh) * Rate (USD/kWh)
warpt defaults to $0.12/kWh (approximate US national average residential rate). You can set your actual rate:
warpt carbon kwh-price --value 0.21
The configured rate is persisted in ~/.warpt/config.json alongside your region/intensity setting.
Caveat: Actual electricity rates vary by country, state, utility, time of day, and commercial vs. residential pricing. Data center rates are typically $0.04-0.08/kWh. The cost figure is directional unless you set your actual rate.
Humanized Comparisons
When you run warpt carbon stop, warpt prints a human-relatable comparison. These are rough equivalences:
| CO2 Range | Comparison | Source |
|---|---|---|
| < 1 g | "less than breathing for a minute" | Human respiration: ~200 mg CO2/min at rest |
| 1-50 g | "like charging your phone N times" | ~8 g CO2 per smartphone charge (US grid avg, ~10 Wh battery) |
| 50-500 g | "like driving N miles" | ~400 g CO2/mile for an average US passenger car (EPA) |
| > 500 g | "like N minutes/hours of air conditioning" | ~1,500 g CO2/hour for a typical central AC unit (3.5 kW, US grid avg) |
These are order-of-magnitude comparisons, not precise measurements. They assume US grid averages regardless of your configured region.
Grid Intensity by Region
All values are in gCO2 per kWh (grams of CO2 emitted per kilowatt-hour of electricity generated). Last audited: 2026-04-30.
United States
| Region | Code | gCO2/kWh | Source |
|---|---|---|---|
| US (national avg) | US |
385 | Ember 2025 (2024 data) |
| California | US-CA |
225 | eGRID CAMX + Low Carbon Power (2024) |
| Texas | US-TX |
335 | eGRID ERCT (2023) |
| New York | US-NY |
200 | eGRID blended state avg (2023) |
| Washington | US-WA |
100 | eGRID NWPP + Low Carbon Power (2023) |
| Florida | US-FL |
365 | eGRID FRCC (2023) |
| Illinois | US-IL |
285 | eGRID RFCW (2023) |
| Virginia | US-VA |
280 | eGRID SRVC (2023) |
Europe
| Region | Code | gCO2/kWh | Source |
|---|---|---|---|
| EU (avg) | EU |
210 | Ember 2025 (2024 data) |
| France | EU-FR |
43 | EEA 2024 |
| Germany | EU-DE |
340 | Ember 2024 |
| Norway | EU-NO |
20 | Multiple sources (~100% hydro) |
| Ireland | EU-IE |
238 | EEA 2024 |
| Poland | EU-PL |
554 | EEA 2024 |
| Spain | EU-ES |
129 | EEA 2024 |
| United Kingdom | UK |
125 | Carbon Brief (2024) |
Asia
| Region | Code | gCO2/kWh | Source |
|---|---|---|---|
| China | CN |
560 | Ember 2025 (2024 data) |
| India | IN |
710 | Ember 2025 (2024 data) |
| Japan | JP |
480 | Ember 2025 (2024 data) |
| South Korea | KR |
400 | Low Carbon Power + Ember (2025) |
| Taiwan | TW |
475 | Taiwan MOEA (2024) |
| Singapore | SG |
480 | Low Carbon Power + NCCS (2024) |
Oceania, Middle East, Africa
| Region | Code | gCO2/kWh | Source |
|---|---|---|---|
| Australia | AU |
465 | Low Carbon Power (2024) |
| UAE | AE |
360 | Low Carbon Power (2023) |
| Saudi Arabia | SA |
545 | Low Carbon Power / IGES (2023) |
| South Africa | ZA |
690 | Low Carbon Power (2024) |
| Kenya | KE |
80 | Low Carbon Power (~85% renewables, 2023-2024) |
| Nigeria | NG |
385 | Low Carbon Power (2024) |
Americas
| Region | Code | gCO2/kWh | Source |
|---|---|---|---|
| Canada | CA |
140 | Low Carbon Power (2025) |
| Brazil | BR |
100 | Ember 2025 (2024 data) |
| Mexico | MX |
410 | Low Carbon Power (2025) |
| Chile | CL |
255 | Low Carbon Power (2025) |
Global Fallback
| Region | Code | gCO2/kWh | Source |
|---|---|---|---|
| World average | WORLD |
475 | Ember 2025 (2024 data) |
If you use an unrecognized region code, warpt falls back to the WORLD average (475 gCO2/kWh).
Configuration
Region, custom intensity, and electricity rate are persisted in ~/.warpt/config.json. Only one of region or intensity is active at a time — setting one removes the other. kwh-price is independent and persists alongside either.
# Set a known region
warpt carbon set-region --value EU-FR
# Or set an exact gCO2/kWh value (e.g., from a real-time source)
warpt carbon intensity --value 312
# Set your electricity rate
warpt carbon kwh-price --value 0.21
If no region or intensity is configured, warpt defaults to US (385 gCO2/kWh) and shows a warning on every start. If no kwh-price is set, warpt defaults to $0.12/kWh.
Data Sources
| Source | URL | Used For |
|---|---|---|
| IEA Emissions Factors 2025 | iea.org | Cross-reference for national averages |
| EPA eGRID 2023 | epa.gov/egrid | US sub-regional intensity |
| Ember Global Electricity Review 2025 | ember-energy.org | National and global averages |
| IGES Grid Emission Factors v11.6 | iges.or.jp | Cross-reference for Asia/Middle East |
| EEA GHG Intensity of Electricity | eea.europa.eu | EU country-level intensity |
| Low Carbon Power | lowcarbonpower.org | Country-level, derived from generation mix |
Summary of Assumptions
| Assumption | Value | Impact |
|---|---|---|
| Grid intensity is annual average | Varies by region | Real-time intensity can be 2-3x higher or lower depending on time of day |
| Electricity rate | $0.12/kWh default (configurable via kwh-price) |
Data center rates are typically 2-3x lower |
| PSU efficiency not modeled | Not included | Actual wall power is ~10-20% higher than reported |
| Only measured components counted | CPU + GPU (when available) | Fans, disks, NICs, memory (on some platforms) not included |
| Scope 2 emissions only | Grid electricity | No embodied carbon, cooling, or upstream emissions |
| Phone charge comparison | 8 g CO2 | Assumes US grid avg, ~10 Wh smartphone battery |
| Driving comparison | 400 g CO2/mile | EPA average for US passenger cars |
| AC comparison | 1,500 g CO2/hour | ~3.5 kW central AC unit, US grid avg |