[master] 285036a Add verbosity filter to interactive varnishstat

Martin Blix Grydeland martin at varnish-cache.org
Wed May 15 14:46:14 CEST 2013


commit 285036abc7c053569b25c55890383c9994b16d7b
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Thu Mar 14 16:08:26 2013 +0100

    Add verbosity filter to interactive varnishstat
    
    Show UNSEEN in bottom bar when not hiding unseened counters

diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 5d19dc1..d81c5bc 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -113,6 +113,7 @@ static WINDOW *w_points = NULL;
 static WINDOW *w_bar_b = NULL;
 static WINDOW *w_info = NULL;
 
+static int verbosity = VSC_level_info;
 static int keep_running = 1;
 static int show_info = 1;
 static int hide_unseen = 1;
@@ -198,6 +199,8 @@ build_pt_array(void)
 		CHECK_OBJ_NOTNULL(pt, PT_MAGIC);
 		if (!pt->seen && hide_unseen)
 			continue;
+		if (pt->vpt->desc->level->verbosity > verbosity)
+			continue;
 		assert(n_ptarray < n_ptlist);
 		ptarray[n_ptarray++] = pt;
 	}
@@ -722,11 +725,13 @@ draw_points(void)
 static void
 draw_bar_b(void)
 {
-	int x;
+	int x, X;
+	const struct VSC_level_desc *level;
 
 	AN(w_bar_b);
 
 	x = 0;
+	X = getmaxx(w_bar_b);
 	werase(w_bar_b);
 	if (page_start + l_points < n_ptarray)
 		mvwaddch(w_bar_b, 0, x, ACS_DARROW);
@@ -734,6 +739,13 @@ draw_bar_b(void)
 	if (current < n_ptarray - 1)
 		mvwprintw(w_bar_b, 0, x, "%s", ptarray[current]->name);
 
+	level = VSC_LevelDesc(verbosity);
+	if (level != NULL)
+		mvwprintw(w_bar_b, 0, X - 7, "%7s", level->label);
+	X -= 7;
+	if (!hide_unseen)
+		mvwprintw(w_bar_b, 0, X - 6, "%6s", "UNSEEN");
+
 	wnoutrefresh(w_bar_b);
 }
 
@@ -801,6 +813,12 @@ handle_keypress(int ch)
 		hide_unseen = 1 - hide_unseen;
 		rebuild = 1;
 		break;
+	case 'v':
+		verbosity++;
+		if (VSC_LevelDesc(verbosity) == NULL)
+			verbosity = 0;
+		rebuild = 1;
+		break;
 	case 'q':
 	case 'Q':
 		keep_running = 0;



More information about the varnish-commit mailing list