Unverified Commit 0a64e73a authored by Lasse Karstensen's avatar Lasse Karstensen Committed by GitHub

Merge pull request #2741 from lkarsten/varnishstat_refresh_interval

Make it possible to change ncurses update rate.
parents 8f5d9212 c510b331
......@@ -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);
......
......@@ -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 *);
......@@ -120,6 +120,10 @@ static double t_sample = 0.;
static double interval = 1.;
static unsigned vsm_status = 0;
#define NOTIF_MAXLEN 256
static char notification_message[NOTIF_MAXLEN] = "";
static double notification_eol = 0.0;
static void
init_hitrate(void)
{
......@@ -435,6 +439,9 @@ draw_status(void)
mvwprintw(w_status, 1, 0, "Uptime child: ");
running(w_status, up_chld, VSM_WRK_RUNNING);
if (VTIM_mono() < notification_eol)
mvwaddstr(w_status, 2, 0, notification_message);
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 +906,22 @@ handle_keypress(int ch)
current = n_ptarray - 1;
page_start = (current - l_points) + 1;
break;
case '+':
interval += 0.1;
(void)snprintf(notification_message, NOTIF_MAXLEN,
"Refresh interval set to %.1f seconds.", interval);
notification_eol = VTIM_mono() + 1.25;
break;
case '-':
interval -= 0.1;
if (interval < 0.1)
interval = 0.1;
(void)snprintf(notification_message, NOTIF_MAXLEN,
"Refresh interval set to %.1f seconds.", interval);
notification_eol = VTIM_mono() + 1.25;
break;
case 'v':
verbosity = VSC_ChangeLevel(verbosity, 1);
rebuild = 1;
......@@ -980,14 +1003,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();
......
varnishtest "trivial run of varnistat in curses mode"
varnishtest "trivial run of varnishstat in curses mode"
server s1 -repeat 4 {
rxreq
......@@ -24,6 +24,14 @@ client c1 {
process p1 -expect-text 0 0 "MAIN.s_sess"
process p1 -screen_dump
process p1 -write {+}
process p1 -screen_dump
process p1 -expect-text 0 0 "Refresh interval set to 1.1 seconds."
process p1 -write {-}
process p1 -screen_dump
process p1 -expect-text 0 0 "Refresh interval set to 1.0 seconds."
process p1 -write {vG}
process p1 -expect-text 0 0 "VBE.vcl1.s1.req"
process p1 -expect-text 0 0 "DIAG"
......
......@@ -109,6 +109,13 @@ The following keys control the interactive display:
<CTRL+T>
Sample now.
<+>
Increase refresh interval.
<->
Decrease refresh interval.
OUTPUTS
=======
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment