/usr/lib/python3/dist-packages/glances/outputs/static/js/components/plugin-cpu/controller.js is in glances 2.11.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 63 64 65 | 'use strict';
function GlancesPluginCpuController($scope, GlancesStats) {
var vm = this;
var _view = {};
vm.total = null;
vm.user = null;
vm.system = null;
vm.idle = null;
vm.nice = null;
vm.irq = null;
vm.iowait = null;
vm.steal = null;
vm.ctx_switches = null;
vm.interrupts = null;
vm.soft_interrupts = null;
vm.syscalls = null;
vm.$onInit = function () {
loadData(GlancesStats.getData());
};
$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});
var loadData = function (data) {
var stats = data.stats['cpu'];
_view = data.views['cpu'];
vm.total = stats.total;
vm.user = stats.user;
vm.system = stats.system;
vm.idle = stats.idle;
vm.nice = stats.nice;
vm.irq = stats.irq;
vm.iowait = stats.iowait;
vm.steal = stats.steal;
if (stats.ctx_switches) {
vm.ctx_switches = Math.floor(stats.ctx_switches / stats.time_since_update);
}
if (stats.interrupts) {
vm.interrupts = Math.floor(stats.interrupts / stats.time_since_update);
}
if (stats.soft_interrupts) {
vm.soft_interrupts = Math.floor(stats.soft_interrupts / stats.time_since_update);
}
if (stats.syscalls) {
vm.syscalls = Math.floor(stats.syscalls / stats.time_since_update);
}
}
vm.getDecoration = function (value) {
if (_view[value] === undefined) {
return;
}
return _view[value].decoration.toLowerCase();
};
}
|