6f4d52deb2aec8e0a21f9c8da8c3bb7270be0f18
[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                                 detail: true,
26                                 title: "%H: Frequency transitions - core %pi",
27                                 alt_autoscale: true,
28                                 vlabel: "Transitions",
29                                 number_format: "%3.2lf%s",
30                                 data: {
31                                         types: [ "transitions" ],
32                                         options: {
33                                                 transitions: { color: "0000ff", title: "Transitions", noarea: true },
34                                         }
35                                 }
36                         };
37
38                         var percentage = {
39                                 detail: true,
40                                 title: "%H: Frequency distribution - core %pi",
41                                 alt_autoscale: true,
42                                 vlabel: "Percent",
43                                 number_format: "%5.2lf%%",
44                                 ordercolor: true,
45                                 data: {
46                                         types: [ "percent" ],
47                                         options: {
48                                                 percent: { title: "%di kHz", negweight: true },
49                                         }
50                                 }
51                         };
52
53                         return [ cpufreq, percentage, transitions ];
54             }
55             else {
56                         return [ cpufreq ];
57             }
58         }
59 });