Skip to content

Commit

Permalink
Merge pull request #417 from City-busz/patch-1
Browse files Browse the repository at this point in the history
Add more details about swap usage
  • Loading branch information
corecoding authored Mar 29, 2024
2 parents b58630d + 9a49363 commit 6fddfe8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ export const Sensors = GObject.registerClass({

let used = total - avail
let utilized = used / total;
let swapUsed = swapTotal - swapFree
let swapUtilized = swapUsed / swapTotal;

this._returnValue(callback, 'Usage', utilized, 'memory', 'percent');
this._returnValue(callback, 'memory', utilized, 'memory-group', 'percent');
Expand All @@ -148,7 +150,10 @@ export const Sensors = GObject.registerClass({
this._returnValue(callback, 'Allocated', used, 'memory', 'memory');
this._returnValue(callback, 'Cached', cached, 'memory', 'memory');
this._returnValue(callback, 'Free', memFree, 'memory', 'memory');
this._returnValue(callback, 'Swap', swapTotal - swapFree, 'memory', 'memory');
this._returnValue(callback, 'Swap Total', swapTotal, 'memory', 'memory');
this._returnValue(callback, 'Swap Free', swapFree, 'memory', 'memory');
this._returnValue(callback, 'Swap Used', swapUsed, 'memory', 'memory');
this._returnValue(callback, 'Swap Usage', swapUtilized, 'memory', 'percent');
}).catch(err => { });
}

Expand Down

0 comments on commit 6fddfe8

Please sign in to comment.