]> granicus.if.org Git - procps-ng/commitdiff
top: restore missing support for 'MEMGRAPH_OLD' define
authorJim Warner <james.warner@comcast.net>
Wed, 12 Oct 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sun, 16 Oct 2022 08:56:19 +0000 (19:56 +1100)
When support for graphs was refactored, in that commit
referenced below, the logic for our 'MEMGRAPH_OLD' was
lost while the #define itself remained in the .h file.

Faced with deleting the #define or restoring the logic
I chose the latter. Thus, if one wanted to be reminded
how overstated 'used' memory once was, it can be done.

Reference(s):
. Sep, 2022 - refactored graph support
commit 2d5b51d1a2aa19d077a2f3db5be187f982d70e70

Signed-off-by: Jim Warner <james.warner@comcast.net>
src/top/top.c

index 9ae7b1baeb456605e987af3d79954ff1059ec9c9..e595cd8456b10f7ab88fa8a0970d456d0f2634e1 100644 (file)
@@ -6571,12 +6571,15 @@ static void do_memory (void) {
    my_qued = MEM_VAL(mem_BUF) + MEM_VAL(mem_QUE);
 
    if (Curwin->rc.graph_mems) {
-      my_misc = MEM_VAL(mem_TOT) - MEM_VAL(mem_FRE) - my_qued;
-      my_used = MEM_VAL(mem_TOT) - MEM_VAL(mem_AVL) - my_misc;
-
+      my_used = MEM_VAL(mem_TOT) - MEM_VAL(mem_FRE) - my_qued;
+#ifdef MEMGRAPH_OLD
+      my_misc = my_qued;
+#else
+      my_misc = MEM_VAL(mem_TOT) - MEM_VAL(mem_AVL) - my_used;
+#endif
       Graph_mems->total = MEM_VAL(mem_TOT);
-      Graph_mems->part1 = my_misc;
-      Graph_mems->part2 = my_used;
+      Graph_mems->part1 = my_used;
+      Graph_mems->part2 = my_misc;
       rx = sum_rx(Graph_mems);
 #ifdef TOG4_MEM_1UP
       prT(bfT(0), mkM(MEM_VAL(mem_TOT)));