]> arthur.barton.de Git - netdata.git/commit - python.d/README.md
cpufreq.chart.py: add more accurate cpufreq_stats-based calculations
authorSteven Noonan <steven@uplinklabs.net>
Mon, 9 Jan 2017 21:00:49 +0000 (13:00 -0800)
committerSteven Noonan <steven@uplinklabs.net>
Mon, 9 Jan 2017 22:35:20 +0000 (14:35 -0800)
commitb22a2ed789f0018d40a24aad1bebe618beeea89f
tree2397cefcc34beda9c0b641264cd89eb535fa4a55
parent606fa32760bbaffe41cfd7a5fb630473ba0139a3
cpufreq.chart.py: add more accurate cpufreq_stats-based calculations

There were two major problems with this module:

- The 'cpuN' names weren't accurate. The 'self.paths.sort()' was trying
  to compensate for os.walk() enumerating the CPUs out of order (as any
  directory enumeration will do). Unfortunately the sort() function is
  alphabetical, so it would result in a list of paths like this:

    [
        '/sys/.../cpu0/...'
        '/sys/.../cpu1/...'
        '/sys/.../cpu11/...'
        '/sys/.../cpu12/...'
        ...
    ]

  So the chart for cpu2 would actually map to cpu11's stats.

  This can be corrected by extracting the 'cpuN' value that's already
  inside the path anyway.

- The scaling_cur_freq value is an instantaneous value. It only
  represents the current processor P-state at the time it was read, and
  doesn't account for the other 999ms that netdata wasn't looking at the
  value.

  This can be corrected by using data from cpufreq_stats, which includes
  P-state residency statistics. Note that the values in cpufreq_stats
  aren't always valid (e.g. if the cpufreq governor is set to
  'schedutil', the statistic files exist but are are empty), so we can
  just fall back to the inaccurate scaling_cur_freq method if necessary.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
python.d/README.md
python.d/cpufreq.chart.py