2016-11-08 20:24:56 +00:00
|
|
|
-- Licensed to the public under the Apache License 2.0.
|
|
|
|
|
|
|
|
module("luci.statistics.rrdtool.definitions.cpufreq",package.seeall)
|
|
|
|
|
2019-07-30 17:47:02 +00:00
|
|
|
local uci = require("luci.model.uci").cursor()
|
|
|
|
local extraitems = uci:get("luci_statistics", "collectd_cpufreq", "ExtraItems") or nil
|
|
|
|
|
2019-03-07 13:50:17 +00:00
|
|
|
function item()
|
|
|
|
return luci.i18n.translate("CPU Frequency")
|
|
|
|
end
|
|
|
|
|
2016-11-08 20:24:56 +00:00
|
|
|
function rrdargs( graph, plugin, plugin_instance, dtype )
|
|
|
|
|
2019-07-30 17:47:02 +00:00
|
|
|
local cpufreq = {
|
|
|
|
title = "%H: Processor frequency - core %pi",
|
2016-11-08 20:24:56 +00:00
|
|
|
alt_autoscale = true,
|
|
|
|
vlabel = "Frequency (Hz)",
|
2016-11-08 20:54:44 +00:00
|
|
|
number_format = "%3.2lf%s",
|
2016-11-08 20:24:56 +00:00
|
|
|
data = {
|
2019-07-30 17:47:02 +00:00
|
|
|
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" },
|
2016-11-08 20:24:56 +00:00
|
|
|
options = {
|
2019-07-30 17:47:02 +00:00
|
|
|
transitions = { color = "0000ff", title = "Transitions", noarea=true },
|
2016-11-08 20:24:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-30 17:47:02 +00:00
|
|
|
|
|
|
|
local percentage = {
|
|
|
|
title = "%H: Frequency distribution - core %pi",
|
|
|
|
alt_autoscale = true,
|
2019-07-31 21:49:05 +00:00
|
|
|
vlabel = "Percent",
|
2019-07-30 17:47:02 +00:00
|
|
|
number_format = "%5.2lf%%",
|
2019-07-31 21:49:05 +00:00
|
|
|
ordercolor = true,
|
2019-07-30 17:47:02 +00:00
|
|
|
data = {
|
|
|
|
types = { "percent" },
|
|
|
|
options = {
|
2019-08-14 15:53:03 +00:00
|
|
|
percent = { title = "%di kHz", negweight = true },
|
2019-07-30 17:47:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-14 15:53:03 +00:00
|
|
|
return { cpufreq, percentage, transitions }
|
2019-07-30 17:47:02 +00:00
|
|
|
else
|
|
|
|
return { cpufreq }
|
|
|
|
end
|
2016-11-08 20:24:56 +00:00
|
|
|
end
|
|
|
|
|