Skip to contentSkip to conversation

xenmon.py: add next/previous bindings to curses mode

PATCH New Diwaker Gupta 1 participant 1 message Mar 6, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenmon.py: add next/previous bindings to curses mode

Cycling around many CPUs in XenMon's curses mode can get cumbersome. This trivial patch adds bindings to move to the previous CPU. The next/previous binding seems more natural to me than the earlier cycle binding, but we can keep them all for now.

# HG changeset patch
# Node ID 146b5c76086c07fad61bea7ccf60f2f4fd66abbd # Parent 7dd31dbf16e75f0f70e0f9c44b2bb2b5fc6eecf1 Add next/previous key bindings to XenMon curses mode.

tools/xenmon/xenmon.py Mon Mar 6 13:17:38 2006 -0800 renamed from tools/xenmon/xenmon.py Mon Mar 6 13:02:50 2006 -0800 +6 -0
diff -r 7dd31dbf16e7 -r 146b5c76086c tools/xenmon/xenmon.py
@@ -452,6 +452,12 @@ def show_livestats():
         if c == ord('c'):
             cpu = (cpu + 1) % ncpu
 
+        # n/p = cycle to the next/previous CPU
+        if c == ord('n'):
+            cpu = (cpu + 1) % ncpu
+        if c == ord('p'):
+            cpu = (cpu - 1) % ncpu
+
         stdscr.erase()
 
     _c.nocbreak()

--
Web/Blog/Gallery: http://floatingsun.net/blog