[libgtop] Provide stats about shared memory and account Slab as cached. This matches exactly `free`.
- From: Benoît Dejean <bdejean src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgtop] Provide stats about shared memory and account Slab as cached. This matches exactly `free`.
- Date: Tue, 14 Jul 2015 16:15:14 +0000 (UTC)
commit c33623c0978278932ea233ea0ca48c3d410cd5f2
Author: Benoît Dejean <bdejean gmail com>
Date: Tue Jul 14 11:11:38 2015 +0200
Provide stats about shared memory and account Slab as cached.
This matches exactly `free`.
sysdeps/linux/mem.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/sysdeps/linux/mem.c b/sysdeps/linux/mem.c
index 17f5193..e37a922 100644
--- a/sysdeps/linux/mem.c
+++ b/sysdeps/linux/mem.c
@@ -52,12 +52,13 @@ glibtop_get_mem_s (glibtop *server, glibtop_mem *buf)
file_to_buffer(server, buffer, sizeof buffer, FILENAME);
+ /* try to match procps's `free` */
buf->total = get_scaled(buffer, "MemTotal:");
buf->free = get_scaled(buffer, "MemFree:");
buf->used = buf->total - buf->free;
- buf->shared = 0;
+ buf->shared = get_scaled(buffer, "Shmem:");
buf->buffer = get_scaled(buffer, "Buffers:");
- buf->cached = get_scaled(buffer, "Cached:");
+ buf->cached = get_scaled(buffer, "Cached:") + get_scaled(buffer, "Slab:");
if (server->os_version_code >= LINUX_VERSION_CODE(3, 14, 0)) {
buf->user = buf->total - get_scaled(buffer, "MemAvailable:");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]