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