summaryrefslogtreecommitdiffstats
path: root/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool/definitions/cpufreq.js
blob: 98ddf71a381e408f915bd861fb06d246525951eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Licensed to the public under the Apache License 2.0. */

'use strict';
'require baseclass';
'require uci';

return baseclass.extend({
	title: _('CPU Frequency'),

	rrdargs(graph, host, plugin, plugin_instance, dtype) {
		const cpufreq = {
			title: "%H: Processor frequency - core %pi",
			alt_autoscale: true,
			vlabel: "Frequency (Hz)",
			number_format: "%3.2lf%s",
			data: {
				types: [ "cpufreq" ],
				options: {
					cpufreq: { color: "ff0000", title: "Frequency" },
				}
			}
		};

	    if (uci.get("luci_statistics", "collectd_cpufreq", "ExtraItems")) {
			const transitions = {
				detail: true,
				title: "%H: Frequency transitions - core %pi",
				alt_autoscale: true,
				y_min: "0",
				y_max: "2",
				vlabel: "Transitions",
				number_format: "%3.2lf%s",
				data: {
					types: [ "transitions" ],
					options: {
						transitions: { color: "0000ff", title: "Transitions", noarea: true },
					}
				}
			};

			const percentage = {
				detail: true,
				title: "%H: Frequency distribution - core %pi",
				alt_autoscale: true,
				vlabel: "Percent",
				number_format: "%5.2lf%%",
				ordercolor: true,
				data: {
					types: [ "percent" ],
					options: {
						percent: { title: "%di kHz", negweight: true },
					}
				}
			};

			return [ cpufreq, percentage, transitions ];
	    }
	    else {
			return [ cpufreq ];
	    }
	}
});