mem() added writeback and dirty (linux)

This commit is contained in:
Sebastian Hildebrandt
2023-08-25 08:03:35 +02:00
parent 5cfe84a043
commit c3b53df529
8 changed files with 44 additions and 4 deletions
+2
View File
@@ -126,6 +126,8 @@ export namespace Systeminformation {
swaptotal: number;
swapused: number;
swapfree: number;
writeback: number | null;
dirty: number | null;
}
interface MemLayoutData {
+7 -1
View File
@@ -162,7 +162,9 @@ function mem(callback) {
swaptotal: 0,
swapused: 0,
swapfree: 0
swapfree: 0,
writeback: null,
dirty: null
};
if (_linux) {
@@ -193,6 +195,10 @@ function mem(callback) {
result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10);
result.swapfree = result.swapfree ? result.swapfree * 1024 : 0;
result.swapused = result.swaptotal - result.swapfree;
result.writeback = parseInt(util.getValue(lines, 'writeback'), 10);
result.writeback = result.writeback ? result.writeback * 1024 : 0;
result.dirty = parseInt(util.getValue(lines, 'dirty'), 10);
result.dirty = result.dirty ? result.dirty * 1024 : 0;
}
if (callback) { callback(result); }
resolve(result);