[cachetop] Display sorting field and order.
authorchantra <chantr4@gmail.com>
Tue, 26 Jul 2016 01:32:46 +0000 (18:32 -0700)
committerchantra <chantr4@gmail.com>
Tue, 26 Jul 2016 01:46:36 +0000 (18:46 -0700)
This will make it easier to visualize what is the sorting field
and order

tools/cachetop.py
tools/cachetop_example.txt

index fc57da0..656b6b7 100755 (executable)
@@ -213,8 +213,10 @@ def handle_loop(stdscr, args):
         stdscr.clear()
         stdscr.addstr(
             0, 0,
-            "%-8s Buffers MB: %.0f / Cached MB: %.0f" % (
-                strftime("%H:%M:%S"), buff, cached
+            "%-8s Buffers MB: %.0f / Cached MB: %.0f "
+            "/ Sort: %s / Order: %s" % (
+                strftime("%H:%M:%S"), buff, cached, FIELDS[sort_field],
+                sort_reverse and "descending" or "ascending"
             )
         )
 
index 13e56b4..ef608b5 100644 (file)
@@ -15,7 +15,7 @@ examples:
     ./cachetop 1           # print every second hit/miss stats
 
 # ./cachetop 5
-13:01:01 Buffers MB: 76 / Cached MB: 114
+13:01:01 Buffers MB: 76 / Cached MB: 114 / Sort: HITS / Order: ascending
 PID      UID      CMD              HITS     MISSES   DIRTIES  READ_HIT%  WRITE_HIT%
        1 root     systemd                 2        0        0     100.0%       0.0%
      680 root     vminfo                  3        4        2      14.3%      42.9%
@@ -43,7 +43,7 @@ Command used to generate the activity
 Below shows the hit rate increases as we run find a second time and it gets it
 its pages from the cache.
 # ./cachetop.py
-13:01:01 Buffers MB: 76 / Cached MB: 115
+13:01:01 Buffers MB: 76 / Cached MB: 115 / Sort: HITS / Order: ascending
 PID      UID      CMD              HITS     MISSES   DIRTIES  READ_HIT%  WRITE_HIT%
      544 messageb dbus-daemon             2        2        1      25.0%      50.0%
      680 root     vminfo                  2        2        1      25.0%      50.0%
@@ -57,7 +57,7 @@ Below shows that the dirty pages increases as a file of 80M is created running
 # dd if=/dev/urandom of=/tmp/c bs=8192 count=10000
 
 # ./cachetop.py 10
-13:01:01 Buffers MB: 77 / Cached MB: 193
+13:01:01 Buffers MB: 77 / Cached MB: 193 / Sort: HITS / Order: ascending
 PID      UID      CMD              HITS     MISSES   DIRTIES  READ_HIT%  WRITE_HIT%
      544 messageb dbus-daemon             9       10        7      10.5%      15.8%
      680 root     vminfo                  9       10        7      10.5%      15.8%