]> granicus.if.org Git - sysstat/commit
Added CPU average clock frequency statistics to sar and sadc.
authorSebastien Godard <sysstat@orange.fr>
Sun, 24 Oct 2010 15:39:20 +0000 (17:39 +0200)
committerSebastien Godard <sysstat@orange.fr>
Sun, 24 Oct 2010 15:39:20 +0000 (17:39 +0200)
commit5b7479528d59c8ff53a6138db5ae52460b3b60c1
tree691dfb1db93f19687d1c0e4d28b462ed44ccd344
parent892b1cd26f52a28a96ee71dac1a194d4a4512ea8
Added CPU average clock frequency statistics to sar and sadc.

This patch adds a new option to sar (-m FREQ) that displays
the following field: wghMHz.
For this option to work, the cpufreq-stats driver must be compiled
in the kernel, as we need to read the "time-in-state" file in /sys.
sadc and sadf have also been updated to take into account this new field.
DTD and XSD documents have been updated.
The sar manual page has been updated.

Mail from Zhen Zhang (08/09/2010) <furykerry@gmail.com>
Hi ,

The current stable and development systat collect cpu frequency data
from /proc/cpuinfo, but currently cpuinfo "cpu Mhz" field report the
instant cpu frequency . From a system administrator point of view
however ,the preferred metric is  the average cpu frequency at
reporting interval . The average frequency can be obtain from
/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state.

Will  the sysstat switch to average cpu frequency at next development version?

Thanks

Mail from Zhen Zhang (11/09/2010) <furykerry@gmail.com>
I want to measure the average cpu frequency of a machine which
probably is capable of dynamic adjusting frequency (DVFS). The average
of cpu frequency is an important metric to evaluate the power
consumption of a machine, and how hard the machine is working to serve
the requests. DVFS capability is starting to get wide adoption in the
server domain e.g. in recent Xeon.

The /proc/cpuinfo interface only record the instant cpu frequency
,however linux kernel or user frequncy governor can adjust cpu
frequency frequently , e.g. for default ondemand governor the
frequency is 10ms . Such interval is way to small comparing to usual
sysstat interval e.g 5min. So an accumulated value is needed .

cpufreq-stats  is a driver ( It seems had entered into kernel 2.6.11,
and its document is available at kernel 2.6.12,
http://lxr.linux.no/#linux+v2.6.12/Documentation/cpu-freq/cpufreq-stats.txt).
For recent ubuntu , cpufreq-stats and cpufreq driver is built into
kernel. The average frequency can be fetch as follow

:/sys/devices/system/cpu/cpu0/cpufreq/stats$ cat time_in_state
2001000 60803
2000000 5734
1600000 5996
1200000 8819
800000 205211

each line define a pair of frequency and its accumulated ticks since
reboot. sysstat can sample it and take the difference as the
accumulated ticks at the sampling interval , and calculated weighted
average cpu frequency.

The  cpufreq-stats do have some pitfall  which is addressed in patch
https://patchwork.kernel.org/patch/72488/).

Nevertheless its current form is already quite useful, I suggest
sysstat to utilize if available , and fall back to /proc/cpuinfo if
not.

Hopes to hear good news:)

thanks
19 files changed:
CHANGES
CREDITS
activity.c
common.h
man/sar.in
nls/sysstat.pot
pr_stats.c
pr_stats.h
prf_stats.c
prf_stats.h
rd_stats.c
rd_stats.h
sa.h
sa_common.c
sa_wrap.c
sadc.c
sar.c
xml/sysstat.dtd
xml/sysstat.xsd