I'm trying to measure the average cpu frequency in an DVFS enabled cpu for specific interval , the obvious way of periodically sampling /proc/cpuinfo has very large variants. The cpufreq-stats driver gave me some hope ,e.g.
cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state 2600000 118148 2000000 8562 1600000 11041 1200000 3428602 # lots of ticks is idle ticks
but unfortunately it is mixed with idle ticks(see patch "Do not account for idle time when tracking time_in_state"). During idle time it is probable that cpu will fall back to the lowest frequency ,thus skew the frequency distribution significantly .
The patch above utilize the account_idle_tick function to remove the idle ticks from statics, but it seems only works for xen kernel. Is there alternative way to measure average cpu frequency?