[6.0] b0a2afed3 Make it possible to change ncurses update rate.
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Feb 8 12:31:12 UTC 2019
commit b0a2afed38d217b4c4e8e4108f46ce9f54b1772b
Author: Lasse Karstensen <lasse.karstensen at gmail.com>
Date: Thu Aug 16 09:14:21 2018 +0200
Make it possible to change ncurses update rate.
This is a squashed commit including lint removal and formatting
suggested by @nigoroll.
diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index be9e64c79..0ab37c1ac 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -324,7 +324,7 @@ main(int argc, char * const *argv)
AN(VSC_Arg(vsc, 'f', "MAIN.cache_hit"));
AN(VSC_Arg(vsc, 'f', "MAIN.cache_miss"));
}
- do_curses(vd, vsc, 1.0);
+ do_curses(vd, vsc);
}
else if (xml)
do_xml(vd, vsc);
diff --git a/bin/varnishstat/varnishstat.h b/bin/varnishstat/varnishstat.h
index 6a73ef238..00099ea02 100644
--- a/bin/varnishstat/varnishstat.h
+++ b/bin/varnishstat/varnishstat.h
@@ -35,4 +35,4 @@
#include "vas.h"
#include "vcs.h"
-void do_curses(struct vsm *, struct vsc *, double);
+void do_curses(struct vsm *, struct vsc *);
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index ad9c22135..b44ee70d8 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -435,6 +435,8 @@ draw_status(void)
mvwprintw(w_status, 1, 0, "Uptime child: ");
running(w_status, up_chld, VSM_WRK_RUNNING);
+ mvwprintw(w_status, 0, 55, "Refresh interval: %.3fs", interval);
+
if (COLS > 70) {
mvwprintw(w_status, 0, getmaxx(w_status) - 37,
"Hitrate n: %8u %8u %8u", hitrate.hr_10.n, hitrate.hr_100.n,
@@ -899,6 +901,14 @@ handle_keypress(int ch)
current = n_ptarray - 1;
page_start = (current - l_points) + 1;
break;
+ case '+':
+ interval += 0.1;
+ break;
+ case '-':
+ interval -= 0.1;
+ if (interval < 0.1)
+ interval = 0.1;
+ break;
case 'v':
verbosity = VSC_ChangeLevel(verbosity, 1);
rebuild = 1;
@@ -980,14 +990,12 @@ delpt(void *priv, const struct VSC_point *const vpt)
}
void
-do_curses(struct vsm *vsm, struct vsc *vsc, double delay)
+do_curses(struct vsm *vsm, struct vsc *vsc)
{
long t;
int ch;
double now;
- interval = delay;
-
verbosity = VSC_ChangeLevel(NULL, 0);
initscr();
diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst
index 89f1f2732..023a6d784 100644
--- a/doc/sphinx/reference/varnishstat.rst
+++ b/doc/sphinx/reference/varnishstat.rst
@@ -109,6 +109,13 @@ The following keys control the interactive display:
<CTRL+T>
Sample now.
+<+>
+ Increase refresh interval.
+
+<->
+ Decrease refresh interval.
+
+
OUTPUTS
=======
More information about the varnish-commit
mailing list