From 15aa0d5122cf68bafba126fa3036119aff38e6c8 Mon Sep 17 00:00:00 2001 From: Hamza Mobeen Date: Sun, 19 Apr 2026 18:11:13 +0100 Subject: [PATCH] docs: clarify tracking_mode affects RAM and CPU (#484) Add a dedicated "Tracking Mode" section to configuration.md explaining that tracking_mode="machine" (default) measures whole-machine RAM and CPU, while tracking_mode="process" isolates to the tracked process only. Also clarifies that GPU is unaffected by this setting. --- docs/how-to/configuration.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/how-to/configuration.md b/docs/how-to/configuration.md index e8b42b929..da8b328bf 100644 --- a/docs/how-to/configuration.md +++ b/docs/how-to/configuration.md @@ -84,6 +84,33 @@ Yields attributes: which relies on the [INI syntax](https://docs.python.org/3/library/configparser.html#supported-ini-file-structure). +## Tracking Mode + +The `tracking_mode` parameter controls how CodeCarbon measures power consumption. It accepts two values: + +- **`"machine"`** (default): Measures power for the entire machine — total RAM in use and total CPU load across all processes. +- **`"process"`**: Isolates measurements to the tracked process — only the process's RAM usage and its share of CPU time are used to estimate power. + +This setting affects **RAM and CPU** measurements. GPU power is always measured at the device level regardless of tracking mode. + +Set it in your config file: + +``` ini +[codecarbon] +tracking_mode = process +``` + +Or directly in code: + +``` python +EmissionsTracker(tracking_mode="process") +``` + +!!! note "Note" + + `"process"` mode gives a lower-bound estimate of your code's footprint. + `"machine"` mode is more conservative and accounts for all activity on the system. + ## Access internet through proxy server If you need a proxy to access internet, which is needed to call a Web