Skip to content

Commit

Permalink
Merge pull request #82 from LudovicRousseau/main
Browse files Browse the repository at this point in the history
Fix typo in documentation
  • Loading branch information
bpetit authored Mar 9, 2021
2 parents f307075 + 924578f commit 083a081
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ <h2><a class="header" href="#some-details-about-rapl" id="some-details-about-rap
RAPL stands for <a href="https://01.org/blogs/2014/running-average-power-limit-%E2%80%93-rapl">Running Average Power Limit</a>. It's a technnology embedded in most Intel and AMD x86 CPUs produced afeter 2012. Thanks to this technology it is possible to get the total energy consumption of the CPU, of the consumption per CPU socket, plus in some cases, the consumption of the DRAM controller. In most cases it represents the vast majority of the energy consumption of the machine (except when running GPU intensive workloads, for example). Further improvements shall be made in scaphandre to fully measure the consumption when GPU are involved (or a lot of hard drives on the same host...).</p>
<p>Between scaphandre and those data is the powercap kernel module that writes the energy consumption in files. Scaphandre, reads those files, stores the data in buffer and then allows for more processing through the exporters.</p>
<h2><a class="header" href="#how-to-get-the-consumption-of-one-process-" id="how-to-get-the-consumption-of-one-process-">How to get the consumption of one process ?</a></h2>
<p>The PowercapRAPL sensor does actually some more than just collecting those energy consumption metrics (and casting it in power consumption metrics). Every time the exporter asks for a measurement (either periodically like in the <a href="../references/exporter-stdout.html">Stdout</a> exporter, or every time a request comes like for the Prometheus exporter) the sensor reads the values of the energy counters from powercap, stores those values and does the same for the CPU usage statistics of the CPU (the one you can see in <code>/proc/stats</code>) and for each running process on the machine at that time (see <code>/proc/PID/stats</code>). With those data it is possible to compute the ratio of CPU time actively spent for a given PID on the CPU time actively spent doing something. With this ratio we can then get the subset of power consumption that is related to that PID on a given timeframe (between two measurement requests).</p>
<p>The PowercapRAPL sensor does actually some more than just collecting those energy consumption metrics (and casting it in power consumption metrics). Every time the exporter asks for a measurement (either periodically like in the <a href="../references/exporter-stdout.html">Stdout</a> exporter, or every time a request comes like for the Prometheus exporter) the sensor reads the values of the energy counters from powercap, stores those values and does the same for the CPU usage statistics of the CPU (the one you can see in <code>/proc/stat</code>) and for each running process on the machine at that time (see <code>/proc/PID/stat</code>). With those data it is possible to compute the ratio of CPU time actively spent for a given PID on the CPU time actively spent doing something. With this ratio we can then get the subset of power consumption that is related to that PID on a given timeframe (between two measurement requests).</p>
<h2><a class="header" href="#how-to-get-the-consumption-of-an-applicationa-service-" id="how-to-get-the-consumption-of-an-applicationa-service-">How to get the consumption of an application/a service ?</a></h2>
<p>Services and programs are often not running only one PID. It's needed to aggregate the consumption of all related PIDs to know what this service is actually consuming. </p>
<p>To do that, in the current state of scaphandre development, you can use the Prometheus exporter, and then use Prometheus TSDB and query language capabilities. You'll find examples looking at the graphs and queries <a href="https://metrics.hubblo.org">here</a>. In a near future, more advanced features may be implemented in scaphandre to allow such classification even if you don't have access to a proper TSDB.</p>
Expand Down

0 comments on commit 083a081

Please sign in to comment.