# Methodology of measurement for energy consumption of applications

Georges da Costa, Helmut Hlavacs

► To cite this version:

Georges da Costa, Helmut Hlavacs. Methodology of measurement for energy consumption of applications. 2010 11th IEEE/ACM International Conference on Grid Computing (GRID), Oct 2010, Brussels, Belgium. pp.290-297, 10.1109/GRID.2010.5697987. hal-04886888

HAL Id: hal-04886888

https://hal.science/hal-04886888v1

Submitted on 14 Jan 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# Methodology of Measurement for Energy Consumption of Applications

Georges Da Costa

IRIT

Université Paul Sabatier

Toulouse, France

Email: Georges.Da-Costa@irit.fr

Helmut Hlavacs

University of Vienna

Department of Distributed and Multimedia Systems

Lenaug. 2/8, Vienna, Austria

Email: helmut.hlavacs@univie.ac.at

**Abstract**—For IT systems, energy awareness can be improved in two ways, (i) in a static or (ii) in a dynamic way. The first way leads to building energy efficient hardware that runs fast and consumes only a few watts. The second way consists of reacting to instantaneous power consumption, and of taking decisions that will reduce this consumption.

In order to take decisions, it is necessary to have a precise view of the power consumption of each element of an IT system. Nowadays, it is only possible to measure power at the outlet level, or - with larger efforts - a the hardware component level. It is still difficult to estimate the power consumption of single applications running on a computer.

This work aims at evaluating the power consumption of single applications using indirect measurements. We describe a methodology for predicting the power consumption of a PC depending on performance counters, and then use these counters to predict the power consumption of a single process.

**Keywords**-energy efficiency; process power consumption; performance counters; linear regression;

## I. INTRODUCTION

Energy awareness can be improved in two ways for IT systems, in a static or in a dynamic way. The static approach is to design energy efficient hardware in the first place. The dynamic approach tries to utilize hardware in an optimal way by moving workload or setting hardware parameters which depend on the workload.

Those two approaches are complementary, and we mainly address the second one, as is done in autonomous systems. Such systems can react to several events, one of them being power consumption of hosts. Current hardware technology allows only to measure the power consumption of a whole node. As we manipulate Virtual Machines, we are interested in the power consumption of each application or VM inside the nodes. To address this problem it is necessary to create measurement software able to extract the power consumption of each single application.

Several techniques are currently used, but they either focus on a particular subsystem (such as processor [1], memory [2], GPU [3]) or are not precise enough (in [4] a comparison of several model leads to an average error of 10%). Generally some process related values are monitored, and based on those values we can then create a mathematical

model linking those data to the power consumption of an application.

The contribution of this paper is twofold: first we investigate the questions whether the power consumption of a PC can be predicted by measuring OS performance variables. Second, we show how this information can be used to derive the power consumption of a single process.

## II. METHODOLOGY

Our methodology focuses on standard off-the-shelf PC hardware and software running under the Linux OS. The global methodology is the following:

* We run several applications and synthetic benchmarks

* We log several measurements during the run (including power consumption)

* We use the logged values to derive a mathematical model linking measurements and power consumption

To achieve application power measurement, we use indirect measurements such as performance counters, process related information (using Linux `pidstat`) and host related information using (using `collectd`). The two first information types are related to a single process, and are to be the base of the produced model. Information based on `collectd` are machine-wide and thus not related to a particular process. But some measurements (such as network traffic) are currently difficult to obtain in a process-related way.

Variables measured using per process performance counters start with `perf_` and include for instance: `perf_task.clock.msecs` (CPU time per second), `perf_context swithes` (context switches/s), `perf_cpu.migrations` (process migrations/s), `perf_page.faults` (page faults/s), `perfala cycles` (CPU cycles/s), `perf_instructions` (instructions/s), `perf_cache.references` (references to the cache/s), and `perf_cache.misses` (cache misses/s).

Variables measured with `pidstat` start with `pid_` and include: `pid_usr` (Percentage of CPU used by the task while executing at the user level), `pid_system` (Percentage of CPU used by the task while executing at the system (kernel) level), `pid�ar` (Percentage of CPU spent by the task in virtual machine), `pid_cpu` (index of the CPU on which is
the process), *pid_minflt_s* (Total number of minor faults the task has made/s), *pid_majflt_s* (Total number of major faults the task has made/s), *pid_kB_rd_s* (Number of kilobytes the task has caused to be read from disk/s), *pid_kB_wr_s* (Number of kilobytes written/s), *pid_kB_ccwr_s* (Number of kilobytes whose writing to disk has been cancelled by the task), *pid_VSZ* (Virtual Size: The virtual memory usage of entire task in kilobytes), *pid_RSS* (Resident Set Size: The non-swapped physical memory used by the task in kilobytes), *pid_MEM* (Percentage of memory used (by resident memory)).

The system wide metrics from collectd start with host_ and include: *host DF DF root used* (Instantaneous used octets on /root), *host DF DF root free* (Instantaneous free octets on /root), *host_memory_memory.cached_value* (Instantaneous cached memory), *host_interface_if_octets.eth1 RX* (Number of octets received during the last second), *host_interface_if_octets.eth1 TX* (Number of octets sent during the last second), *host_interface_if_packetS.eth1 RX* (Number of packets received during the last second), *host_interface_if_packetS.eth1 TX* (Number of packets sent during the last second), *host processes ps state blocked_value* (instantaneous number of processes in blocked state), *host_disk.sda_disk_time_write* (average time a write.operation took to complete), *host_cpu.X_cpu.system_value* (processes executing in kernel mode), *host_cpu.X_cpu.wait_value* (waiting for I/O to complete), *host_load_load:shortterm* (Instantaneous shortterm load, average over 1min), *host_load_load_midterm* (Instantaneous midterm load, average over 5min), *host_irq_irq.X_value* (Number of irqs during the last second), *host_disk.sda_disk_mergeD_read* (Number of reads that could be merged into other, already queued operations), *host_disk.sda_disk_mergeD_write* (Idem for write).

A. Monitoring

The currently implemented framework uses two elements, a monitoring part and a synthetic workload part. The monitoring part is split between two computers in order to reduce the impact of measurements on the experiment. A first computer runs the application to be measured and carries out the process and machine related measurements. A second computer is linked to a watt meter and logs the power consumption. At start the two computer clocks are synchronized.

The current limit of the framework is that it cannot follow
at the same time a process and its children. So it can
currently only be used for applications that do not fork. As
most benchmarks actually fork, we had to develop new ones
to create the large datasets from which to create the models.

B. Synthetic workload

We created several benchmarks linked to synthetic work-
loads: Memory, CPU, network, disk and mixed. General
behavior of each of them is always the same: They start at
100% of a particular resource and go down to 0% by step of
1%. Each step is 20s. Each second we measure around 200
values (using pidstat, perfcounters, collectd and
a wattmeter). Thus one experiment produces around 2 MB
of data. Starting at 100% and going down to 0% allows
to reduce the impact of allocating resources as advised by
SpecPower.

III. DATA ANALYSIS

The measured data consists of one response variable (power), and 165 explanatory variables. The task of model building is to explain the response as a function of the explanatory variables. In order to cope with higher order dependencies we also include the squared explanatory variables (marked by a "SQ" at the variable name end), yielding a total of 330 explanatory variables. We did not include interactions between the variables, since this would have lead to an explosion of the number of variables being uncomputable.

The task was now to identify a small number of variables
that would explain each individual data set, and additionally
a model that would explain all datasets in parallel. The de-
sired models should be parsimonious (number of explanatory
variables should be low) and, in relation to this number,
the model quality should be as good as possible. Model
quality is mainly measured by R², the squared correlation
coefficient, which explains how much better our model is
with respect to the simple data average. In more detail, R²
measures how much of the total variance (when using the
average of the data) is explained when exchanging the over-
all average with the respective model. Since 0 ≤ R² ≤ 1,
and a larger value is better, as an initial goal we wanted to at
least achieve R² ≥ 0.9, and consider a model to be "good"
if R² ≥ 0.95.

A. Model Quality

Model quality is also measured as average error σ, i.e., the
square root of the sum of the squared differences between
predicted and measured values. This σ, being the average
prediction error, is also set in relation to the average power,
yielding the average error in %. Here it must be noted that
similar approaches usually report an average error of 5% or
higher. Our task thus was to derived models that clearly
result in much smaller average errors. However, error in
% is of course very much influenced by the mean power
consumption of the computers, i.e., higher average power
consumption results in a lower error % without yielding a
better model, and thus R² has more meaning that error in
%.
Data was preprocessed by removing data items with at least one N/A value in any variable. The number of removed data lines however is quite small, in the order of below one per mill.

From data analysis we saw that there were only very few extremely influential points which can be identified using Cook's distance [5]. When removing them, the model quality quickly increases. We therefore also designed a simple outlier test removing those points which are at least $4\sigma$ away from the mean. This limit must be regarded as being extremely conservative, since usually either $2\sigma$ or $3\sigma$ are used. The result is a small number of outliers being removed, and we also state $R^2$ and $\sigma$ for these cases, as well as the number of removed outliers.

Another test was done to see whether the residuals are normally distributed. However, since the dataset sizes are very high, and there are certain regularities left, using the Shapiro-Wilk test we cannot conclude that the residuals are indeed normally distributed. However, we plotted the data also on quantile-quantile-plots (Q-Q-Plots). On such a plot we put the quantiles of the theoretical normal distribution on the x-axis, and the empirically measured quantiles of the data on the y-axis. If the resulting plot is nearly linear (a line) then we can conclude that the data follows a normal distribution. The Q-Q-plots of our residuals indeed mainly follow a straight line, but show deviances at the tails, which explains why the Shapiro-Wilk test failed.

## B. Additive Model Update

In our analysis we start with an empty model in which we only use the average to describe the response. We then use exhaustive search to find the best combination of $N$ variables explaining the response. Since, when having $K$ explanatory variables, the effort for doing this is

$$O(K(K - 1) \cdots (K - N + 1)),$$

this is not possible for larger values of both $K$ and $N$ due to an exponential runtime explosion.

To further reduce complexity we actually chose a mixture approach between additive and subtractive, and first start with a full model containing all variables. Then we remove all those variables that do not have any influence onto the result, by demanding that the p-value (of a t-test testing whether the coefficient is different from zero) of a variable should be larger than 0.5. This reduced $K$, thus speeding up the following additive approach significantly. This reduction of course is not possible if a full model cannot be created due to a lack of data. In these cases, we had to run the search for $K = 330$, which resulted in a drastically increased runtime. Still, combinations of more than $N = 4$ hardly make sense since they demand run times of days or months. However, there is seldom demand for doing so, since quite often only little can be gained by using more than three variables.

A further possibility is to sequentially add the next best $L$ variables to the model. This means that we can start with an empty model, and then continuously find the best combination of $L$ variables to add to the model. This approach still increases exponentially with $L$, but only linearly with $N$. We therefore also state the resulting models for $L = 1$.

## IV. ANALYSIS RESULTS

The data consists of the six datasets "Burn CPU", "Mem Loop", "Network", "Tar Kernel", "Disk Read" and "Disk Write". The sizes of these sets are quite large with the exception of "Tar Kernel". The datasets do differ significantly with respect to their power consumption. The empirical cumulative distribution functions (ECDFs) are shown in Figure 1. An ECDF is the integral of the empirically measured density of a dataset. Data is concentrated at those values where the ECDF rises steeply. The datasets influenced by CPU and memory show a rather broad spectrum of power values. Those making heavily use of I/O like "Network" and "Disk Write" show a rather narrow spectrum. "Tar Kernel", making use of both CPU and I/O is also narrow, but with a significant shift to the right.

<figure><img src="image_2.png" /><figcaption>Figure 1. Empirical CDFs (ECDFs) of the respective power consumptions.</figcaption></figure>

In the following we show results of the regression analysis, which also includes plots of the respective residuals. In these plots the x-axis is as important as the y-axis, since it shows the range of the power measurements. Residual sizes must also be related to these ranges.

### A. Burn CPU

The dataset "Burn CPU" consists of 2074 complete data records (without N/A values). Both datasets "Burn CPU" and "Mem Loop" are similar in the sense that power can be explained by using one variable only. Table I shows the best variables explaining the power, with outliers taken into account, and when removing outliers. It must be noted that it is not clear why e.g. host DF DF root free SQ yields such good results. There are some other host related variables also yielding high correlations. However, for instance the variables perf\_instructions and perf\_cycles do make sense
in a pure CPU stress test and also well explain the power consumption.

<table><caption>Table I
BURN CPU.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>host DF DF root free SQ</td><td>0.992</td><td>0.216</td><td>0.289</td><td>0</td></tr><tr><td>host DF DF root used</td><td>0.996</td><td>0.146</td><td>0.195</td><td>12</td></tr><tr><td>perf instructions</td><td>0.992</td><td>0.216</td><td>0.289</td><td>0</td></tr><tr><td>perf cycles</td><td>0.996</td><td>0.143</td><td>0.191</td><td>12</td></tr></tbody></table>

<figure><img src="image_3.png" /><figcaption>Figure 2. Burn CPU residuals for variable host DF DF root free SQ.</figcaption></figure>

Figure 2 shows the model residuals when using a model with only the variable host DF DF root free SQ as single explanatory variable. There are only a few outliers, nevertheless influencing σ significantly.

## B. Memory Loop

The dataset "Mem Loop" consists of 2017 complete data records (without N/A values). Table II shows the best variables explaining the power,

<table><caption>Table II
MEMORY LOOP.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_context switches</td><td>0.998</td><td>0.268</td><td>0.339</td><td>0</td></tr><tr><td>perf_cache references</td><td>0.999</td><td>0.213</td><td>0.270</td><td>18</td></tr><tr><td>perf_cache switches</td><td>0.998</td><td>0.285</td><td>0.361</td><td>0</td></tr><tr><td>perf_cache references</td><td>0.999</td><td>0.196</td><td>0.248</td><td>25</td></tr><tr><td>perf_context switches SQ</td><td>0.977</td><td>0.919</td><td>1.163</td><td>0</td></tr></tbody></table>

<figure><img src="image_4.png" /><figcaption>Figure 3. Loop memory residuals for variable perf_context switches.</figcaption></figure>

Figure 3 shows the model residuals when using a model with only the variable perf_context switches as single explanatory variable. Again a few outliers are visible, which however do not significantly influence the results. Also, it is obvious that the residual do exhibit a deterministic component. In fact this deterministic dependence could be exploited by further refining the regression model, e.g., by adding a sin()-like function. It turns out that this is not really necessary since the one-variable model is already good enough such that any model extension is superfluous.

## C. Network

The dataset "Network" consists of 1937 complete data records (without N/A values). Table II shows the best variables explaining the power,

<table><caption>Table III
NETWORK.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>host_interface_if_octets.eth1_tx</td><td>0.954</td><td>0.178</td><td>0.247</td><td>0</td></tr><tr><td>host_interface_if_packets.eth1_tx</td><td>0.983</td><td>0.106</td><td>0.147</td><td>13</td></tr><tr><td>host_interface_if_packets.eth1_tx</td><td>0.953</td><td>0.181</td><td>0.251</td><td>0</td></tr><tr><td>host_interface_if_packets.eth1_tx</td><td>0.980</td><td>0.117</td><td>0.163</td><td>13</td></tr><tr><td>host_interface_if_packets.eth1_tx</td><td>0.951</td><td>0.183</td><td>0.255</td><td>0</td></tr><tr><td>host_interface_if_packets.eth1_tx</td><td>0.981</td><td>0.114</td><td>0.159</td><td>13</td></tr></tbody></table><table><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cycles +<br>host_interface_if_packets.eth1_tx</td><td>0.967</td><td>0.152</td><td>0.211</td><td>0</td></tr><tr><td>perf_cycles +<br>host_interface_if_packets.eth1_tx</td><td>0.991</td><td>0.079</td><td>0.110</td><td>16</td></tr><tr><td>perf_cycles +<br>host_interface_if_packets.eth1_tx</td><td>0.967</td><td>0.152</td><td>0.211</td><td>0</td></tr><tr><td>perf_cycles +<br>host_interface_if_packets.eth1_tx</td><td>0.991</td><td>0.079</td><td>0.110</td><td>16</td></tr><tr><td>perf_cycles +<br>host_interface_if_octets.eth1_tx</td><td>0.967</td><td>0.152</td><td>0.211</td><td>0</td></tr><tr><td>perf_cycles +<br>host_interface_if_octets.eth1_tx</td><td>0.991</td><td>0.077</td><td>0.108</td><td>17</td></tr></tbody></table>

<figure><img src="image_5.png" /><figcaption>Figure 4. Network residuals for variable host_interface_if_octets.eth1_tx.</figcaption></figure>

Figure 4 shows the model residuals when using a model with only the variable host_interface_if_octets.eth1_tx as single explanatory variable. This variable makes sense when keeping in mind that the workload mainly stresses the network card. Furthermore, Table III and Figure 4 show that although two variables are enough to explain the power consumption, there are a few outliers that do have a significant influence in the result. Removing only 13 out of 1937 data records increases R² to 0.98 for one, and 0.99 for two variables.

## D. Tar Kernel

This dataset contains only 18 complete data records. Inasmuch it was not possible to reduce the number of
explanatory variables by using a full model first, and thus, searching for optimal variable combinations had to include all 330 explanatory variables (K=330). This was partially compensated by the fact that regression for a small dataset is much faster. Nevertheless, the resulting run times were much higher. Table IV and Figure 5 show the regression results. It can be seen that mainly host oriented variables perform best, e.g., number of blocked processes, disk writing load, but also the load averages.

<table><caption>Table IV
TAR KERNEL.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th></tr></thead><tbody><tr><td>host processes ps state.</td><td>0.911</td><td>0.661</td><td>0.816</td></tr><tr><td>blocked value</td><td></td><td></td><td></td></tr><tr><td>host processes ps state.</td><td>0.911</td><td>0.660</td><td>0.816</td></tr><tr><td>blocked value SQ</td><td></td><td></td><td></td></tr><tr><td>host, sda, disk, time, write, SQ</td><td>0.911</td><td>0.661</td><td>0.817</td></tr><tr><td>host_cpu.2_cpu.wait_value_SQ +<br>host_load_load_midterm_SQ</td><td>0.984</td><td>0.290</td><td>0.358</td></tr><tr><td>pid kB rd_s SQ +<br>host_load_load_midterm_SQ</td><td>0.983</td><td>0.295</td><td>0.364</td></tr><tr><td>host_cpu.2_cpu.wait_value_SQ +<br>host_load_load_shortterm_SQ</td><td>0.983</td><td>0.300</td><td>0.370</td></tr></tbody></table>

<figure><img src="image_6.png" /><figcaption>Figure 5. Tar kernel residuals for variables host_cpu.2_cpu.wait_value_SQ + host_load_load_midterm_SQ.</figcaption></figure>

## E. Disk Read

This dataset contains 2018 complete data records. As can be seen in Tables V and VI, and Figure 6 there are a few outliers that have a significant impact on the model accuracy. Removing them results in a sufficient fit though. We also computed models for the optimal triple of variables, which however did not improve the model quality significantly. We thus omitted them in Table V. Interestingly single variables do not include disk related variables, but when sequentially adding variables, pid kB rd_s SQ turns up at place third, so it is definitely related to the power consumption.

Table VI shows that for six variables R² reaches up to 0.98 without outliers, more variables though do not improve the accuracy any more.

## F. Disk Write

This dataset contains again 2018 non-empty data records. Similar to "Disk Read", this dataset also suffers from a

<table><caption>Table V
DISK READ.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cache.misses</td><td>0.824</td><td>0.698</td><td>0.964</td><td>0</td></tr><tr><td>perf_context.</td><td>0.956</td><td>0.337</td><td>0.465</td><td>18</td></tr><tr><td>switches_SQ</td><td>0.791</td><td>0.761</td><td>1.05</td><td>0</td></tr><tr><td>perf_cache.</td><td>0.946</td><td>0.361</td><td>0.499</td><td>22</td></tr><tr><td>references_SQ</td><td>0.768</td><td>0.803</td><td>1.109</td><td>0</td></tr><tr><td>references_SQ</td><td>0.963</td><td>0.298</td><td>0.412</td><td>23</td></tr><tr><td>perf_cache.references +<br>pid_system_SQ</td><td>0.941</td><td>0.405</td><td>0.559</td><td>0</td></tr><tr><td>perf_cache.misses +<br>pid_system_SQ</td><td>0.972</td><td>0.277</td><td>0.382</td><td>12</td></tr><tr><td>perf_cache.</td><td>0.939</td><td>0.410</td><td>0.566</td><td>0</td></tr><tr><td>references_SQ +<br>pid_system_SQ</td><td>0.971</td><td>0.281</td><td>0.388</td><td>12</td></tr><tr><td>perf_cache.references +<br>pid_system_SQ</td><td>0.939</td><td>0.412</td><td>0.569</td><td>0</td></tr><tr><td>perf_cache.misses +<br>pid_system_SQ</td><td>0.971</td><td>0.283</td><td>0.391</td><td>12</td></tr></tbody></table>

<table><caption>Table VI
DISK READ, SEQUENTIALLY ADDING SINGLE VARIABLES.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cache.misses</td><td>0.824</td><td>0.698</td><td>0.964</td><td>0</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.956</td><td>0.337</td><td>0.465</td><td>18</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.956</td><td>0.337</td><td>0.465</td><td>17</td></tr><tr><td>pid kB rd_s SQ</td><td>0.919</td><td>0.474</td><td>0.655</td><td>0</td></tr><tr><td>pid system SQ</td><td>0.970</td><td>0.280</td><td>0.387</td><td>18</td></tr><tr><td>pid system SQ</td><td>0.937</td><td>0.417</td><td>0.576</td><td>0</td></tr><tr><td>perf_cache.references_SQ</td><td>0.949</td><td>0.377</td><td>0.520</td><td>0</td></tr><tr><td>perf_cache.references_SQ</td><td>0.979</td><td>0.236</td><td>0.326</td><td>14</td></tr><tr><td>perf instructions SQ</td><td>0.951</td><td>0.367</td><td>0.508</td><td>0</td></tr><tr><td>perf instructions SQ</td><td>0.980</td><td>0.231</td><td>0.320</td><td>14</td></tr></tbody></table>

handful of severe outliers. Figure 7 and Tables VII and VIII show the details. Here it can be seen that power for this workload can be best described without using disk related variables. In general the models perform a little worse for disk related workload (read and write), but when adding more variables the model quality quickly rises significantly.

## G. All Datasets

The previous sections show that our approach yields good results for individual types of work load. In this subsection we derive models for a dataset containing all previously analyzed datasets. Since the datasets are quite heterogeneous it can be assumed that only 1,2 or 3 variables will not yield good models. However, Table IX shows that three variables already yield a good model. The main result however is shown in Tables X and XI, showing nine variables that have been added sequentially. As can be seen, even without outlier removal, these variables explain 99% of the total data variance, yielding them to be excellent predictors of the "All" dataset.

The sequential model shown in Table X also shows the coefficient of variable perf_cache.misses_SQ, which is in the order of magnitude of $10^{-14}$. This is explained by the fact that the maximum of this variable (squared number of cache misses per second) is also in the order of magnitude of $10^{14}$.
<figure><img src="image_7.png" /><figcaption>Figure 6. Disk read residuals for variables perf_cache references + pid_system_SQ.</figcaption></figure>

<table><caption>Table VII
DISK WRITE.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cache.misses</td><td>0.768</td><td>0.588</td><td>0.822</td><td>0</td></tr><tr><td>perf_context swithes_SQ</td><td>0.925</td><td>0.297</td><td>0.415</td><td>19</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.635</td><td>0.738</td><td>1.032</td><td>0</td></tr><tr><td>host_cpu.0_cpu.</td><td>0.955</td><td>0.211</td><td>0.295</td><td>22</td></tr><tr><td>perf_context switches</td><td>0.628</td><td>0.745</td><td>1.0414</td><td>0</td></tr><tr><td>host_cpu.0_cpu.</td><td>0.919</td><td>0.281</td><td>0.393</td><td>23</td></tr><tr><td>perf SQ +<br>host_cpu.0_cpu.</td><td>0.895</td><td>0.396</td><td>0.553</td><td>0</td></tr><tr><td>system_value_SQ</td><td>0.967</td><td>0.216</td><td>0.303</td><td>12</td></tr><tr><td>perf SQ +<br>host_cpu.0_cpu.</td><td>0.895</td><td>0.397</td><td>0.555</td><td>0</td></tr><tr><td>system_value_SQ</td><td>0.967</td><td>0.217</td><td>0.303</td><td>12</td></tr><tr><td>perf_context.<br>switches_SQ +<br>host_cpu.0_cpu.</td><td>0.893</td><td>0.400</td><td>0.560</td><td>0</td></tr><tr><td>system_value_SQ</td><td>0.970</td><td>0.202</td><td>0.283</td><td>14</td></tr><tr><td>perf_context switches +<br>host_cpu.</td><td>0.901</td><td>0.385</td><td>0.539</td><td>0</td></tr><tr><td>system_value_SQ</td><td>0.969</td><td>0.211</td><td>0.295</td><td>10</td></tr><tr><td>perf_context switches +<br>perf_cycles_SQ +<br>host_cpu.</td><td>0.901</td><td>0.385</td><td>0.539</td><td>0</td></tr><tr><td>system_value_SQ</td><td>0.969</td><td>0.211</td><td>0.296</td><td>10</td></tr><tr><td>perf_cache.misses +<br>host_cpu.</td><td>0.900</td><td>0.386</td><td>0.539</td><td>0</td></tr><tr><td>system_value_SQ</td><td>0.970</td><td>0.203</td><td>0.283</td><td>16</td></tr></tbody></table>

Figure 8 shows the model residuals when using nine variables. Residuals are taken from the data sets in the order "Burn CPU", "Mem Loop", "Network", "Tar Kernel", "Disk Read" and "Disk Write". As can be seen residuals are not purely random, but also depend on the data set, but not to a high degree. This is further investigated in Section IV-H.

Figure 9 shows how the models improve when adding more and more variables sequentially, i.e., the ECDFs of the residuals when using 1, 3, 5, 7, or 9 variables added sequentially. It can clearly be seen that the 9-variables model is superior and yields excellent results.

Finally, Figure 10 shows the quantiles of the residuals plotted against the theoretical quantiles of normal distributions. The more straight lines the curves are, the more

<table><caption>Table VIII
DISK WRITE, SEQUENTIALLY ADDING SINGLE VARIABLES.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cache.misses</td><td>0.761</td><td>0.588</td><td>0.822</td><td>0</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.925</td><td>0.297</td><td>0.415</td><td>19</td></tr><tr><td>host_cpu.</td><td>0.816</td><td>0.524</td><td>0.732</td><td>0</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.919</td><td>0.308</td><td>0.430</td><td>20</td></tr><tr><td>host_cpu.0_cpu.system_value_SQ</td><td>0.865</td><td>0.449</td><td>0.627</td><td>0</td></tr><tr><td>perf_context switches_SQ</td><td>0.932</td><td>0.296</td><td>0.414</td><td>21</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.906</td><td>0.374</td><td>0.523</td><td>0</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.973</td><td>0.196</td><td>0.274</td><td>13</td></tr></tbody></table>

<figure><img src="image_8.png" /><figcaption>Figure 7. Disk write residuals for variables perf_context switches + perf SQ + host_cpu.0_cpu.system_value_SQ.</figcaption></figure>

they follow a normal distribution. As can be seen, the model using the optimal triple (O3), as well as the model using 9 variables show a large region between -3.5 and 2.5 where they follow a normal distribution nicely. Outside this region, both models show differences in their tails caused by outliers.

## H. Global Model Applied to all Datasets

Table XI shows how a model with 9 variable explains all data sets in total. The question now is how this global

<table><caption>Table IX
ALL DATASETS.</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cache references_SQ</td><td>0.770</td><td>2.003</td><td>2.708</td><td>0</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.767</td><td>2.017</td><td>2.728</td><td>0</td></tr><tr><td>perf_cache.misses_SQ</td><td>0.773</td><td>1.987</td><td>2.686</td><td>16</td></tr><tr><td>perf_cache references</td><td>0.683</td><td>2.353</td><td>3.181</td><td>0</td></tr><tr><td>pid_usr +<br>perf_cache references_SQ</td><td>0.920</td><td>1.181</td><td>1.597</td><td>0</td></tr><tr><td>perf_instructions_SQ +<br>perf_cache references_SQ</td><td>0.917</td><td>1.207</td><td>1.632</td><td>0</td></tr><tr><td>perf_task clock.msecs_SQ +<br>perf_cache references_SQ</td><td>0.933</td><td>1.080</td><td>1.460</td><td>57</td></tr><tr><td>perf_task clock.msecs_SQ +<br>perf_cache references_SQ</td><td>0.916</td><td>1.208</td><td>1.633</td><td>0</td></tr><tr><td>perf_cache references +<br>perf SQ +<br>pid_RSS_SQ</td><td>0.933</td><td>1.078</td><td>1.457</td><td>57</td></tr><tr><td>perf_cache references +<br>perf SQ +<br>pid_MEM_SQ</td><td>0.963</td><td>0.807</td><td>1.091</td><td>0</td></tr><tr><td>perf_cache references +<br>perf SQ +<br>pid_MEM_SQ</td><td>0.963</td><td>0.807</td><td>1.091</td><td>0</td></tr><tr><td>perf_cache references +<br>perf SQ +<br>pid_VSZ_SQ</td><td>0.963</td><td>0.807</td><td>1.091</td><td>0</td></tr><tr><td>perf_cache references +<br>perf SQ +<br>pid_VSZ_SQ</td><td>0.976</td><td>0.646</td><td>0.874</td><td>62</td></tr></tbody></table>
<table><caption>Table X</caption><thead><tr><th>Variable</th><th>Coeff</th><th>Coeff Err</th></tr></thead><tbody><tr><td>Intercept</td><td>7.056e+01</td><td>7.781e-03</td></tr><tr><td>perf_cache.misses_SQ</td><td>-8.195e-15</td><td>1.671e-15</td></tr><tr><td>pid_usr</td><td>8.401e-02</td><td>1.879e-04</td></tr><tr><td>host_irq_irq.26_value</td><td>6.882e-03</td><td>6.278e-05</td></tr><tr><td>pid_system_SQ</td><td>3.717e-03</td><td>3.237e-05</td></tr><tr><td>perf_context swithes</td><td>6.266e-04</td><td>1.107e-05</td></tr><tr><td>pid kB wr_s</td><td>1.737e-04</td><td>4.696e-06</td></tr><tr><td>host_disk.sda_disk_merg ed_write</td><td>-5.270e-04</td><td>1.930e-05</td></tr><tr><td>perf_cache references</td><td>1.190e-06</td><td>1.357e-08</td></tr><tr><td>pid_VSZ</td><td>-1.601e-05</td><td>2.064e-07</td></tr></tbody></table>

ALL DATASETS, REGRESSION COEFFICIENTS AND ERRORS OF THE COEFFICIENTS. ALL COEFFICIENTS ARE SIGNIFICANTLY DIFFERENT FROM ZERO (P-VALUES<1.0E-7)

<table><caption>Table XI</caption><thead><tr><th>Variable</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>perf_cache.misses_SQ</td><td>0.767</td><td>2.017</td><td>2.728</td><td>0</td></tr><tr><td>pid_usr</td><td>0.916</td><td>1.209</td><td>1.635</td><td>0</td></tr><tr><td>host_irq_irq.26_value</td><td>0.935</td><td>1.062</td><td>1.437</td><td>56</td></tr><tr><td>perf_context swithes</td><td>0.966</td><td>0.772</td><td>1.043</td><td>0</td></tr><tr><td>pid kB wr_s</td><td>0.977</td><td>0.634</td><td>0.857</td><td>48</td></tr><tr><td>host_disk.</td><td>0.983</td><td>0.541</td><td>0.732</td><td>0</td></tr><tr><td>perf_cache references</td><td>0.989</td><td>0.430</td><td>0.581</td><td>92</td></tr><tr><td>pid_VSZ</td><td>0.990</td><td>0.407</td><td>0.550</td><td>77</td></tr></tbody></table>

ALL DATASETS, SEQUENTIALLY ADDING SINGLE VARIABLES.

<figure><img src="image_9.png" /><figcaption>Figure 8. All datasets residuals for the sequential model using 9 variables shown in Table X.</figcaption></figure>

model performs when applied to each individual data set. Table XII shows the respective regression results. As can be seen the global model performs outstandingly well, and explains the power consumption for every single dataset. The only data set having some deviances is "Disk Write", but when removing only 12 outliers, the situation dramatically changes, and 97% of the variance is explained, which is an excellent result.

<figure><img src="image_10.png" /><figcaption>Figure 9. All datasets, ECDFs of the residuals, when using 1, 3, 5, 7, or 9 variables added sequentially. O3 denotes the optimal combination of 3 variables.</figcaption></figure>

<figure><img src="image_11.png" /><figcaption>Figure 10. All datasets, Q-Q-plot of the residuals, when using 1, 3, 5, 7, or 9 variables added sequentially. O3 denotes the optimal combination of 3 variables.</figcaption></figure>

## V. POWER CONSUMPTION OF A SINGLE PROCESS

The above derived models describe the power consumption of a computer by a combination of system wide variables $Y_i$, $i = 1, ..., L$, as well as variables $X_{jl}$, $j = 1, ..., J$ describing individual process $p_l$, $l = 1, ..., L$. Let the power consumption of a computer with no load be denoted by $P_0$ (the intercept), and the respective coefficients of the regression model be called $\alpha_i$ for system wide variables, and $\beta_j$ for per process variables. The linear model then relates

<table><caption>Table XII</caption><thead><tr><th>Data set</th><th>R<sup>2</sup></th><th>σ</th><th>%</th><th>#Out</th></tr></thead><tbody><tr><td>"Burn CPU"</td><td>0.992</td><td>0.225</td><td>0.3</td><td>0</td></tr><tr><td>"Mem Loop"</td><td>0.999</td><td>0.144</td><td>0.24</td><td>0</td></tr><tr><td>"Network"</td><td>0.944</td><td>0.196</td><td>0.27</td><td>0</td></tr><tr><td></td><td>0.974</td><td>0.134</td><td>0.19</td><td>17</td></tr><tr><td>"Tar Kernel"</td><td>0.965</td><td>0.556</td><td>0.69</td><td>0</td></tr><tr><td>"Disk Read"</td><td>0.946</td><td>0.389</td><td>0.54</td><td>0</td></tr><tr><td></td><td>0.974</td><td>0.265</td><td>0.36</td><td>11</td></tr><tr><td>"Disk Write"</td><td>0.89</td><td>0.407</td><td>0.57</td><td>0</td></tr><tr><td></td><td>0.965</td><td>0.221</td><td>0.31</td><td>12</td></tr></tbody></table>

APPLYING THE GLOBAL MODEL FROM TABLE XI TO THE RESPECTIVE DATA SETS.
the power consumption P of a computer in the following way:

$$P = P_0 + \sum_{i=1}^{I} \alpha_i Y_i + \sum_{j=1}^{J} \beta_j \sum_{l=1}^{L} X_{jl}. \quad (1)$$

By setting

$$S_j = \sum_{l=1}^{L} X_{jl},$$

(1) can be written as

$$P = P_0 + \sum_{i=1}^{I} \alpha_i Y_i + \sum_{j=1}^{J} \beta_j S_j. \quad (2)$$

In order to derive the power caused by an individual process $P_l$, we assume that the relevant system wide variables are caused by the processes, which are themselves described by their individual per process variables. To verify this assumption we explained the system wide variables host\_irq\_irq.26\_value and host\_disk.sda\_disk\_merged\_write by the per process variables. The resulting $R^2$ were 0.956 and 0.99, i.e., they can be almost entirely explained by per process variables. We therefore write

$$Y_i = \sum_{j=1}^{J} \gamma_{ij} S_j, \quad (3)$$

and adapt (1) to a new form

$$ \begin{aligned} P &= P_0 + \sum_{i=1}^{I} \alpha_i \sum_{j=1}^{J} \gamma_{ij} S_j + \sum_{j=1}^{J} \beta_j S_j \\ &= P_0 + \sum_{j=1}^{J} S_j \left( \beta_j + \sum_{i=1}^{I} \alpha_i \gamma_{ij} \right) \\ &= P_0 + \sum_{j=1}^{J} \eta_j S_j \end{aligned} \quad (4) $$

by defining

$$\eta_j = \beta_j + \sum_{i=1}^{I} \alpha_i \gamma_{ij}.$$

Thus, we now describe the global power consumption by per process variables only. At this point we can derive the power $P_l$ as caused by $p_l$ to be

$$P_l = \sum_{j=1}^{J} \eta_j X_{jl}. \quad (5)$$

It can easily be seen that

$$P = P_0 + \sum_{l=1}^{L} P_l,$$

as it should be.

# VI. CONCLUSION

We defined and implemented a measurement platform at the University of Vienna which we used to measure the dependence of the power consumption of a standard PC onto synthetic workload. By using multivariate regression we explain this power consumption by a subset of 165 process and system variables we measured during our experiments. We explore this dependence in depth and demonstrate that the obtained model quality is very good. We derive a global model for all data sets that also explains each single data set excellently. Using simple linear analysis we also define the power consumption of a single process.

Although we present a multitude of results, the main result of this paper is actually the methodology itself. The described regression results merely demonstrate that our approach does yield excellent prediction results.

Future works include choosing the best values to measure in order to reduce the impact of measurement on the system.

# ACKNOWLEDGMENT

This work was done during a short term scientific mission (Cost action 0804) of Georges Da Costa (IRIT, Toulouse, France) to the University of Vienna (Austria) from 8, January to 12, February 2010, and was supported by the European Commission.

# REFERENCES

[1] R. Joseph and M. Martonosi, "Run-time power estimation in high performance microprocessors," in *ISLPED '01: Proceedings of the 2001 international symposium on Low power electronics and design*. ACM, 2001.

[2] I. Kadayif, T. Chinoda, M. Kandemir, N. Vijaykirsnan, M. J. Irwin, and A. Sivasubramaniam, "vec: virtual energy counters," in *PASTE '01: Proceedings of the 2001 ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering*. ACM, 2001.

[3] X. Ma, M. Dong, L. Zhong, and Z. Deng, "Statistical power consumption analysis and modeling for gpu-based computing," in *SOSP Workshop on Power Aware Computing and Systems (HotPower '09)*, 2009.

[4] S. Rivoire, P. Ranganathan, and C. Kozyrakis, "A comparison of high-level full-system power models." in *HotPower*, F. Zhao, Ed. USENIX Association, 2008.

[5] M. J. Crawley, *Statistics: An Introduction using R*. Wiley, 2005, iSBN 0-470-02297-3. [Online]. Available: http://www.bio.ic.ac.uk/research/crawley/statistics/