Skip to content

Commit

Permalink
split used+cache up into used+shared+buffer+cache
Browse files Browse the repository at this point in the history
fix #4475
  • Loading branch information
binarynoise committed Jan 3, 2025
1 parent 360f765 commit 9cf9ec6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 2 additions & 0 deletions sysmonitor@orcus/files/sysmonitor@orcus/3.2/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ MyApplet.prototype = {
["mem_graph_width", this.on_cfg_changed_graph_width],
["mem_color_0", this.on_cfg_changed_color, 1],
["mem_color_1", this.on_cfg_changed_color, 1],
["mem_color_2", this.on_cfg_changed_color, 1],
["mem_color_3", this.on_cfg_changed_color, 1],
["swap_enabled", this.on_cfg_changed_graph_enabled, 2],
["swap_override_graph_width", this.on_cfg_changed_graph_width, 2],
["swap_graph_width", this.on_cfg_changed_graph_width],
Expand Down
16 changes: 10 additions & 6 deletions sysmonitor@orcus/files/sysmonitor@orcus/3.2/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,20 @@ MemData.prototype = {
},

getDim: function() {
return 2;
return 4;
},

getData: function() {
GTop.glibtop_get_mem(this.gtop);
let used = this.gtop.used / this.gtop.total;
let cached = (this.gtop.buffer + this.gtop.cached) / this.gtop.total;
this.text = Math.round((this.gtop.used - this.gtop.cached - this.gtop.buffer) / (1024 * 1024))
+ " / " + Math.round(this.gtop.total / (1024 * 1024)) + _(" MB");
return [used-cached, cached];
let total = this.gtop.total;
let cached = this.gtop.cached - this.gtop.shared;
let shared = this.gtop.shared;
let buffer = this.gtop.buffer;
let used = this.gtop.used - this.gtop.cached - this.gtop.buffer;

this.text = Math.round((used + shared) / (1024 * 1024))
+ " / " + Math.round(total / (1024 * 1024)) + _(" MB");
return [used, shared, buffer, cached].map(e => e / this.gtop.total);
},

getText: function() {
Expand Down
12 changes: 11 additions & 1 deletion sysmonitor@orcus/files/sysmonitor@orcus/3.2/settings-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"mem_c": {
"type": "section",
"title": "Colors",
"keys": ["mem_color_0", "mem_color_1"]
"keys": ["mem_color_0", "mem_color_1", "mem_color_2", "mem_color_3"]
},
"swap": {
"type": "page",
Expand Down Expand Up @@ -247,8 +247,18 @@
"description": "Used color"
},
"mem_color_1": {
"type": "colorchooser",
"default": "rgb(117,78,210)",
"description": "Shared color"
},
"mem_color_2": {
"type": "colorchooser",
"default": "rgb(52,101,164)",
"description": "Buffer color"
},
"mem_color_3": {
"type": "colorchooser",
"default": "rgb(220,182,48)",
"description": "Cached color"
},
"swap_enabled": {
Expand Down

0 comments on commit 9cf9ec6

Please sign in to comment.