summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics/luasrc/statistics
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2019-07-30 20:47:02 +0300
committerHannu Nyman <hannu.nyman@iki.fi>2019-07-30 20:47:02 +0300
commite6f30bb7f39c67e1b2eaf312aa8d1f06e7b0a0ab (patch)
treed6514712bb7d0e5ecacc69cb603f4590407679a7 /applications/luci-app-statistics/luasrc/statistics
parent15088a31b84f786ea5924ee2f2f61df5cff32d7a (diff)
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>
Diffstat (limited to 'applications/luci-app-statistics/luasrc/statistics')
-rw-r--r--applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua49
1 files changed, 40 insertions, 9 deletions
diff --git a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua
index 08aab04b85..40a6955e53 100644
--- a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua
+++ b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/cpufreq.lua
@@ -2,28 +2,59 @@
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()
return luci.i18n.translate("CPU Frequency")
end
function rrdargs( graph, plugin, plugin_instance, dtype )
- return {
- title = "%H: Processor frequency",
+ local cpufreq = {
+ title = "%H: Processor frequency - core %pi",
alt_autoscale = true,
vlabel = "Frequency (Hz)",
number_format = "%3.2lf%s",
data = {
- sources = {
- cpufreq = { "" }
- },
+ types = {"cpufreq" },
+ options = {
+ cpufreq = { color = "ff0000", title = "Frequency" },
+ }
+ }
+ }
+
+ 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 = {
- cpufreq_0 = { color = "ff0000", title = "Core 0", noarea=true, overlay=true },
- 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 }
+ 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