luci-app-statistics: cpufreq: changes in data structure
Collectd 5.9.0 changed the data structure of the cpufreq plugin:
CPU cores are now handled as separate plugin instances.
There are also new data items per core:
* time spent at each frequency
* amount of frequency transitions
Enable these new data items, but initially hide them behind
a new config option "ExtraItems" (default: disabled), as
the amount of graphs in multi-core systems could be rather large.
Note that the frequencies are not (yet) sorted, so the
information value of the time-spent graph is semi-random.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(cherry picked from commit e6f30bb7f3
)
This commit is contained in:
parent
c0057ae7a2
commit
dd908ced91
2 changed files with 46 additions and 9 deletions
|
@ -11,4 +11,10 @@ s = m:section( NamedSection, "collectd_cpufreq", "luci_statistics" )
|
||||||
enable = s:option( Flag, "enable", translate("Enable this plugin") )
|
enable = s:option( Flag, "enable", translate("Enable this plugin") )
|
||||||
enable.default = 0
|
enable.default = 0
|
||||||
|
|
||||||
|
-- collectd_cpufreq.extraitems
|
||||||
|
extraitems = s:option( Flag, "ExtraItems", translate("Extra items"), translate("More details about frequency usage and transitions"))
|
||||||
|
extraitems.default = "0"
|
||||||
|
extraitems.optional = true
|
||||||
|
extraitems:depends( "enable", 1 )
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
|
@ -2,28 +2,59 @@
|
||||||
|
|
||||||
module("luci.statistics.rrdtool.definitions.cpufreq",package.seeall)
|
module("luci.statistics.rrdtool.definitions.cpufreq",package.seeall)
|
||||||
|
|
||||||
|
local uci = require("luci.model.uci").cursor()
|
||||||
|
local extraitems = uci:get("luci_statistics", "collectd_cpufreq", "ExtraItems") or nil
|
||||||
|
|
||||||
function item()
|
function item()
|
||||||
return luci.i18n.translate("CPU Frequency")
|
return luci.i18n.translate("CPU Frequency")
|
||||||
end
|
end
|
||||||
|
|
||||||
function rrdargs( graph, plugin, plugin_instance, dtype )
|
function rrdargs( graph, plugin, plugin_instance, dtype )
|
||||||
|
|
||||||
return {
|
local cpufreq = {
|
||||||
title = "%H: Processor frequency",
|
title = "%H: Processor frequency - core %pi",
|
||||||
alt_autoscale = true,
|
alt_autoscale = true,
|
||||||
vlabel = "Frequency (Hz)",
|
vlabel = "Frequency (Hz)",
|
||||||
number_format = "%3.2lf%s",
|
number_format = "%3.2lf%s",
|
||||||
data = {
|
data = {
|
||||||
sources = {
|
types = {"cpufreq" },
|
||||||
cpufreq = { "" }
|
|
||||||
},
|
|
||||||
options = {
|
options = {
|
||||||
cpufreq_0 = { color = "ff0000", title = "Core 0", noarea=true, overlay=true },
|
cpufreq = { color = "ff0000", title = "Frequency" },
|
||||||
cpufreq_1 = { color = "0000ff", title = "Core 1", noarea=true, overlay=true },
|
|
||||||
cpufreq_2 = { color = "00ff00", title = "Core 2", noarea=true, overlay=true },
|
|
||||||
cpufreq_3 = { color = "00ffff", title = "Core 3", noarea=true, overlay=true }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if extraitems then
|
||||||
|
|
||||||
|
local transitions = {
|
||||||
|
title = "%H: Frequency transitions - core %pi",
|
||||||
|
alt_autoscale = true,
|
||||||
|
vlabel = "Transitions",
|
||||||
|
number_format = "%3.2lf%s",
|
||||||
|
data = {
|
||||||
|
types = { "transitions" },
|
||||||
|
options = {
|
||||||
|
transitions = { color = "0000ff", title = "Transitions", noarea=true },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local percentage = {
|
||||||
|
title = "%H: Frequency distribution - core %pi",
|
||||||
|
alt_autoscale = true,
|
||||||
|
vlabel = "Frequency (Hz)",
|
||||||
|
number_format = "%5.2lf%%",
|
||||||
|
data = {
|
||||||
|
types = { "percent" },
|
||||||
|
options = {
|
||||||
|
percent = { title = "Frequency %di" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { cpufreq, transitions, percentage }
|
||||||
|
else
|
||||||
|
return { cpufreq }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue