projects
/
sysstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a506d5
)
memusage: Take SReclaimable into account
author
norly
<ny-git@enpas.org>
Sun, 24 May 2020 13:03:20 +0000
(15:03 +0200)
committer
norly
<ny-git@enpas.org>
Sun, 24 May 2020 13:03:20 +0000
(15:03 +0200)
src/status/memusage.c
patch
|
blob
|
history
diff --git
a/src/status/memusage.c
b/src/status/memusage.c
index d8a9de5f96906316b010f0edd8a00049e8032bca..18d57a19ce49d1c0a7c02b32efd55dadb801b769 100644
(file)
--- a/
src/status/memusage.c
+++ b/
src/status/memusage.c
@@
-20,6
+20,7
@@
void status_memusage(GlobalData *g)
long long memused;
long long membuffers = 0;
long long memcached = 0;
long long memused;
long long membuffers = 0;
long long memcached = 0;
+ long long slab_reclaimable = 0;
statusitem_init(&s);
statusitem_init(&s);
@@
-41,11
+42,18
@@
void status_memusage(GlobalData *g)
stlen = getline(&stline, &stlen, stfile);
memcached = atoll(&stline[16]);
stlen = getline(&stline, &stlen, stfile);
memcached = atoll(&stline[16]);
- free(stline);
+ while (0 < (stlen = getline(&stline, &stlen, stfile))) {
+ if (stlen > 13 && !memcmp(stline, "SReclaimable:", 13)) {
+ slab_reclaimable = atoll(&stline[16]);
+ break;
+ }
+ }
+
+ free(stline);
fclose(stfile);
fclose(stfile);
- memused = memtotal - memfree - memcached - membuffers;
+ memused = memtotal - memfree - memcached -
slab_reclaimable -
membuffers;
memused /= 1024; // Just show MBs used
memused /= 1024; // Just show MBs used