Skip to content

Commit 9cf9ec6

Browse files
committed
split used+cache up into used+shared+buffer+cache
fix #4475
1 parent 360f765 commit 9cf9ec6

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

sysmonitor@orcus/files/sysmonitor@orcus/3.2/applet.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ MyApplet.prototype = {
117117
["mem_graph_width", this.on_cfg_changed_graph_width],
118118
["mem_color_0", this.on_cfg_changed_color, 1],
119119
["mem_color_1", this.on_cfg_changed_color, 1],
120+
["mem_color_2", this.on_cfg_changed_color, 1],
121+
["mem_color_3", this.on_cfg_changed_color, 1],
120122
["swap_enabled", this.on_cfg_changed_graph_enabled, 2],
121123
["swap_override_graph_width", this.on_cfg_changed_graph_width, 2],
122124
["swap_graph_width", this.on_cfg_changed_graph_width],

sysmonitor@orcus/files/sysmonitor@orcus/3.2/providers.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,20 @@ MemData.prototype = {
7171
},
7272

7373
getDim: function() {
74-
return 2;
74+
return 4;
7575
},
7676

7777
getData: function() {
7878
GTop.glibtop_get_mem(this.gtop);
79-
let used = this.gtop.used / this.gtop.total;
80-
let cached = (this.gtop.buffer + this.gtop.cached) / this.gtop.total;
81-
this.text = Math.round((this.gtop.used - this.gtop.cached - this.gtop.buffer) / (1024 * 1024))
82-
+ " / " + Math.round(this.gtop.total / (1024 * 1024)) + _(" MB");
83-
return [used-cached, cached];
79+
let total = this.gtop.total;
80+
let cached = this.gtop.cached - this.gtop.shared;
81+
let shared = this.gtop.shared;
82+
let buffer = this.gtop.buffer;
83+
let used = this.gtop.used - this.gtop.cached - this.gtop.buffer;
84+
85+
this.text = Math.round((used + shared) / (1024 * 1024))
86+
+ " / " + Math.round(total / (1024 * 1024)) + _(" MB");
87+
return [used, shared, buffer, cached].map(e => e / this.gtop.total);
8488
},
8589

8690
getText: function() {

sysmonitor@orcus/files/sysmonitor@orcus/3.2/settings-schema.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"mem_c": {
4646
"type": "section",
4747
"title": "Colors",
48-
"keys": ["mem_color_0", "mem_color_1"]
48+
"keys": ["mem_color_0", "mem_color_1", "mem_color_2", "mem_color_3"]
4949
},
5050
"swap": {
5151
"type": "page",
@@ -247,8 +247,18 @@
247247
"description": "Used color"
248248
},
249249
"mem_color_1": {
250+
"type": "colorchooser",
251+
"default": "rgb(117,78,210)",
252+
"description": "Shared color"
253+
},
254+
"mem_color_2": {
250255
"type": "colorchooser",
251256
"default": "rgb(52,101,164)",
257+
"description": "Buffer color"
258+
},
259+
"mem_color_3": {
260+
"type": "colorchooser",
261+
"default": "rgb(220,182,48)",
252262
"description": "Cached color"
253263
},
254264
"swap_enabled": {

0 commit comments

Comments
 (0)