[master] 9f04dd402 varnishstat: New 'r'aw key binding

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jan 11 17:06:07 UTC 2021


commit 9f04dd402218ec72e43b12c9ce0eb907d8df91ad
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Dec 10 09:33:42 2020 +0100

    varnishstat: New 'r'aw key binding

diff --git a/bin/varnishstat/varnishstat_bindings.h b/bin/varnishstat/varnishstat_bindings.h
index 4051a53eb..565b5cc49 100644
--- a/bin/varnishstat/varnishstat_bindings.h
+++ b/bin/varnishstat/varnishstat_bindings.h
@@ -72,6 +72,14 @@ BINDING(UNSEEN,
     "\tof varnishstat. Defaults to hide unseen counters."
 )
 
+BINDING_KEY('r', "r",)
+BINDING(RAW,
+    "\tToggle between showing raw and adjusted gauges. When a gauge\n"
+    "\tis decremented faster than it is incremented, it may appear as\n"
+    "\ta large integer with its most significant bit set. By default\n"
+    "\tsuch values are adjusted to zero."
+)
+
 BINDING_KEY('e', "e",)
 BINDING(SCALE, "\tToggle scaling of values.")
 
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 4c3ff9127..0b5fc4c62 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -935,7 +935,7 @@ handle_common_keypress(enum kb_e kb)
 }
 
 static void
-handle_points_keypress(enum kb_e kb)
+handle_points_keypress(struct vsc *vsc, enum kb_e kb)
 {
 
 	switch (kb) {
@@ -973,6 +973,10 @@ handle_points_keypress(enum kb_e kb)
 		hide_unseen = 1 - hide_unseen;
 		rebuild = REBUILD_NEXT;
 		break;
+	case KB_RAW:
+		VSC_Arg(vsc, 'r', NULL);
+		rebuild = REBUILD_NEXT;
+		break;
 	case KB_SCALE:
 		scale = 1 - scale;
 		rebuild = REBUILD_NEXT;
@@ -1046,6 +1050,7 @@ handle_help_keypress(enum kb_e kb)
 		help_line = bindings_help_len;
 		break;
 	case KB_UNSEEN:
+	case KB_RAW:
 	case KB_SCALE:
 	case KB_ACCEL:
 	case KB_DECEL:
@@ -1072,7 +1077,7 @@ handle_help_keypress(enum kb_e kb)
 }
 
 static void
-handle_keypress(int ch)
+handle_keypress(struct vsc *vsc, int ch)
 {
 	enum kb_e kb;
 
@@ -1091,7 +1096,7 @@ handle_keypress(int ch)
 	if (show_help)
 		handle_help_keypress(kb);
 	else
-		handle_points_keypress(kb);
+		handle_points_keypress(vsc, kb);
 }
 
 static void * v_matchproto_(VSC_new_f)
@@ -1201,7 +1206,7 @@ do_curses(struct vsm *vsm, struct vsc *vsc)
 			break;
 #endif
 		default:
-			handle_keypress(ch);
+			handle_keypress(vsc, ch);
 			break;
 		}
 	}


More information about the varnish-commit mailing list