a2cc1309e700f64f55e779180c6ebf0c4e701597
[openwrt-luci.git] /
1 /* Licensed to the public under the Apache License 2.0. */
2
3 'use strict';
4 'require baseclass';
5 'require uci';
6
7 return baseclass.extend({
8         title: _('CPU Frequency'),
9
10         rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
11                 var cpufreq = {
12                         title: "%H: Processor frequency - core %pi",
13                         alt_autoscale: true,
14                         vlabel: "Frequency (Hz)",
15                         number_format: "%3.2lf%s",
16                         data: {
17                                 types: [ "cpufreq" ],
18                                 options: {
19                                         cpufreq: { color: "ff0000", title: "Frequency" },
20                                 }
21                         }
22                 };
23
24             if (uci.get("luci_statistics", "collectd_cpufreq", "ExtraItems")) {
25                         var transitions = {
26                                 detail: true,
27                                 title: "%H: Frequency transitions - core %pi",
28                                 alt_autoscale: true,
29                                 y_min: "0",
30                                 y_max: "2",
31                                 vlabel: "Transitions",
32                                 number_format: "%3.2lf%s",
33                                 data: {
34                                         types: [ "transitions" ],
35                                         options: {
36                                                 transitions: { color: "0000ff", title: "Transitions", noarea: true },
37                                         }
38                                 }
39                         };
40
41                         var percentage = {
42                                 detail: true,
43                                 title: "%H: Frequency distribution - core %pi",
44                                 alt_autoscale: true,
45                                 vlabel: "Percent",
46                                 number_format: "%5.2lf%%",
47                                 ordercolor: true,
48                                 data: {
49                                         types: [ "percent" ],
50                                         options: {
51                                                 percent: { title: "%di kHz", negweight: true },
52                                         }
53                                 }
54                         };
55
56                         return [ cpufreq, percentage, transitions ];
57             }
58             else {
59                         return [ cpufreq ];
60             }
61         }
62 });
git clone https://git.99rst.org/PROJECT