Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ctrl.$onChanges = function () {
ctrl.memory = {
total: ctrl.metrics.mem,
used: ctrl.metrics.mem - ctrl.metrics['mem.free'],
unit: 'K'
};
ctrl.memory.percentUsed = $filter('number')(ctrl.memory.used / ctrl.memory.total * 100, 2);
ctrl.heap = {
total: ctrl.metrics['heap.committed'],
used: ctrl.metrics['heap.used'],
init: ctrl.metrics['heap.init'],
max: ctrl.metrics['heap.max'] || ctrl.metrics.heap,
unit: ctrl.metrics['heap.max'] ? 'B' : 'K'
};
ctrl.heap.percentUsed = $filter('number')(ctrl.heap.used / ctrl.heap.total * 100, 2);
ctrl.nonheap = {
total: ctrl.metrics['nonheap.committed'],
used: ctrl.metrics['nonheap.used'],
init: ctrl.metrics['nonheap.init'],
max: ctrl.metrics.nonheap,
unit: 'K'
};
ctrl.nonheap.percentUsed = $filter('number')(ctrl.nonheap.used / ctrl.nonheap.total * 100, 2);
};