From 882bae0451c06c357177d3c6232e36f8922d4bf2 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 28 Jun 2007 13:33:59 +0000 Subject: [PATCH] Further cosmetic improvements + documentation updates git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1591 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishstat/varnishstat.1 | 31 ++++++++++++---- varnish-cache/bin/varnishstat/varnishstat.c | 39 ++++++++------------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/varnish-cache/bin/varnishstat/varnishstat.1 b/varnish-cache/bin/varnishstat/varnishstat.1 index 6e9310e8..4577def7 100644 --- a/varnish-cache/bin/varnishstat/varnishstat.1 +++ b/varnish-cache/bin/varnishstat/varnishstat.1 @@ -28,7 +28,7 @@ .\" .\" $Id$ .\" -.Dd June 15, 2007 +.Dd June 28, 2007 .Dt VARNISHSTAT 1 .Os .Sh NAME @@ -71,11 +71,28 @@ The default is 1. The columns in the main display are, from left to right: .Bl -enum .It -Total since startup +Value .It -Per-second average in the period since last update +Per-second average in the period since last update, or a period if the +value can not be averaged .It -Per-second average over process lifetime +Per-second average over process lifetime, or a period if the value can +not be averaged +.It +Descriptive text +.El +.Pp +When using the +.Fl 1 +option, the columns in the output are, from left to right: +.Bl -enum +.It +Symbolic entry name +.It +Value +.It +Per-second average over process lifetime, or a period if the value can +not be averaged .It Descriptive text .El @@ -89,8 +106,10 @@ Descriptive text .Sh HISTORY The .Nm -utility was developed by +utility was originally developed by .An Poul-Henning Kamp Aq phk@phk.freebsd.dk -in cooperation with Verdens Gang AS and Linpro AS. +in cooperation with Verdens Gang AS and Linpro AS, and later +substantially rewritten by +.An Dag-Erling Sm\(/orgrav Aq des@linpro.no . This manual page was written by .An Dag-Erling Sm\(/orgrav Aq des@linpro.no . diff --git a/varnish-cache/bin/varnishstat/varnishstat.c b/varnish-cache/bin/varnishstat/varnishstat.c index 8362f58c..622eb7d6 100644 --- a/varnish-cache/bin/varnishstat/varnishstat.c +++ b/varnish-cache/bin/varnishstat/varnishstat.c @@ -4,6 +4,7 @@ * All rights reserved. * * Author: Poul-Henning Kamp + * Author: Dag-Erling Smørgrav * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -80,6 +81,7 @@ do_curses(struct varnish_stats *VSL_stats, int delay) noecho(); nonl(); intrflush(stdscr, false); + curs_set(0); erase(); lt = 0; @@ -91,23 +93,12 @@ do_curses(struct varnish_stats *VSL_stats, int delay) rt = ts.tv_sec - VSL_stats->start_time; up = rt; - move(0, 0); - printw("%*s\n", COLS - 1, VSL_Name()); - move(0, 0); - if (rt > 86400) { - printw("%dd+", rt / 86400); - rt %= 86400; - } - printw("%02d:", rt / 3600); - rt %= 3600; - printw("%02d:", rt / 60); - rt %= 60; - printw("%02d", rt); - move(1, 0); - hit = (intmax_t)VSL_stats->cache_hit - - (intmax_t)copy.cache_hit; - miss = (intmax_t)VSL_stats->cache_miss - - (intmax_t)copy.cache_miss; + mvprintw(0, 0, "%*s", COLS - 1, VSL_Name()); + mvprintw(0, 0, "%d+%02d:%02d:%02d", rt / 86400, + (rt % 86400) / 3600, (rt % 3600) / 60, rt % 60); + + hit = VSL_stats->cache_hit - copy.cache_hit; + miss = VSL_stats->cache_miss - copy.cache_miss; hit /= lt; miss /= lt; if (hit + miss != 0) { @@ -116,20 +107,20 @@ do_curses(struct varnish_stats *VSL_stats, int delay) myexp(&a2, ratio, &n2, 100); myexp(&a3, ratio, &n3, 1000); } - printw("Hitrate ratio: %8u %8u %8u\n", n1, n2, n3); - printw("Hitrate avg: %8.4f %8.4f %8.4f\n", a1, a2, a3); - printw("\n"); + mvprintw(1, 0, "Hitrate ratio: %8u %8u %8u", n1, n2, n3); + mvprintw(2, 0, "Hitrate avg: %8.4f %8.4f %8.4f", a1, a2, a3); - line = 0; + line = 3; #define MAC_STAT(n, t, f, d) \ - if (++line < LINES - 4) { \ + if (++line < LINES) { \ ju = VSL_stats->n; \ if (f == 'a') { \ - printw("%12ju %12.2f %12.2f %s\n", \ + mvprintw(line, 0, "%12ju %12.2f %12.2f %s\n", \ ju, (ju - (intmax_t)copy.n)/lt, ju / up, d); \ copy.n = ju; \ } else { \ - printw("%12ju %12s %12s %s\n", ju, ". ", ". ", d); \ + mvprintw(line, 0, "%12ju %12s %12s %s\n", \ + ju, ". ", ". ", d); \ } \ } #include "stat_field.h" -- 2.39.5