6 return baseclass
.extend({
7 title
: _('IRQ Plugin Configuration'),
8 description
: _('The irq plugin will monitor the rate of issues per second for each selected interrupt. If no interrupt is selected then all interrupts are monitored.'),
10 addFormOptions: function(s
) {
13 o
= s
.option(form
.Flag
, 'enable', _('Enable this plugin'));
15 o
= s
.option(form
.DynamicList
, 'Irqs', _('Monitor interrupts'));
18 o
.depends('enable', '1');
19 o
.load = function(section_id
) {
20 return fs
.trimmed('/proc/interrupts').then(L
.bind(function(str
) {
21 var lines
= str
.split(/\n/),
22 cpus
= L
.toArray(lines
[0]);
24 for (var i
= 1; i
< lines
.length
; i
++) {
26 m
= lines
[i
].match(/^\s*([^\s:]+):/);
31 line
= line
.replace(/^[^:]+:\s+/, '');
33 for (var j
= 0; j
< cpus
.length
; j
++)
34 line
= line
.replace(/^\d+\s*/, '');
36 var desc
= line
.split(/ {2,}/).join(', ');
38 this.value(m
[1], '%s (%s)'.format(m
[1], desc
|| '-'));
41 return this.super('load', [section_id
]);
45 o
= s
.option(form
.Flag
, 'IgnoreSelected', _('Monitor all except specified'));
46 o
.depends('enable', '1');
49 configSummary: function(section
) {
50 var irqs
= L
.toArray(section
.Irqs
),
51 invert
= section
.IgnoreSelected
== '1';
54 return _('Monitoring all interrupts');
56 return N_(irqs
.length
, 'Monitoring all but one interrupt', 'Monitoring all but %d interrupts').format(irqs
.length
);
58 return N_(irqs
.length
, 'Monitoring one interrupt', 'Monitoring %d interrupts').format(irqs
.length
);