[4.1] 1a51307 Move the profile definition into a tbl file and generate the docs from it
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Fri Sep 9 13:01:03 CEST 2016
commit 1a5130781e58db0a440c6aee1188be65c57c6765
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Jul 25 15:01:24 2016 +0200
Move the profile definition into a tbl file and generate the docs from it
Conflicts:
bin/varnishhist/Makefile.am
diff --git a/bin/varnishhist/Makefile.am b/bin/varnishhist/Makefile.am
index e8eb866..8063442 100644
--- a/bin/varnishhist/Makefile.am
+++ b/bin/varnishhist/Makefile.am
@@ -8,6 +8,7 @@ bin_PROGRAMS = varnishhist
varnishhist_SOURCES = varnishhist.c \
varnishhist_options.h \
+ varnishhist_profiles.h \
varnishhist_options.c \
$(top_srcdir)/lib/libvarnish/vas.c \
$(top_srcdir)/lib/libvarnish/version.c \
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index c980a24..d435e1d 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -115,67 +115,19 @@ struct profile {
int hist_low;
int hist_high;
}
+#define HIS_PROF(name,vsl_arg,tag,prefix,field,hist_low,high_high,doc) \
+ {name,vsl_arg,tag,prefix,field,hist_low,high_high},
+#define HIS_NO_PREFIX NULL
+#define HIS_CLIENT 'c'
+#define HIS_BACKEND 'b'
profiles[] = {
- // client
- {
- .name = "responsetime",
- .VSL_arg = 'c',
- .tag = SLT_Timestamp,
- .prefix = "Process:",
- .field = 3,
- .hist_low = -6,
- .hist_high = 3
- },
- {
- .name = "size",
- .VSL_arg = 'c',
- .tag = SLT_ReqAcct,
- .prefix = NULL,
- .field = 5,
- .hist_low = 1,
- .hist_high = 8
- },
- // backend
- {
- .name = "Bereqtime",
- .VSL_arg = 'b',
- .tag = SLT_Timestamp,
- .prefix = "Bereq:",
- .field = 3,
- .hist_low = -6,
- .hist_high = 3
- },
- {
- .name = "Beresptime",
- .VSL_arg = 'b',
- .tag = SLT_Timestamp,
- .prefix = "Beresp:",
- .field = 3,
- .hist_low = -6,
- .hist_high = 3
- },
- {
- .name = "BerespBodytime",
- .VSL_arg = 'b',
- .tag = SLT_Timestamp,
- .prefix = "BerespBody:",
- .field = 3,
- .hist_low = -6,
- .hist_high = 3
- },
- {
- .name = "Besize",
- .VSL_arg = 'b',
- .tag = SLT_BereqAcct,
- .prefix = NULL,
- .field = 5,
- .hist_low = 1,
- .hist_high = 8
- },
- {
- .name = NULL
- }
+#include "varnishhist_profiles.h"
+ { NULL }
};
+#undef HIS_NO_PREFIX
+#undef HIS_BACKEND
+#undef HIS_CLIENT
+#undef HIS_PROF
static struct profile *active_profile;
diff --git a/bin/varnishhist/varnishhist_options.h b/bin/varnishhist/varnishhist_options.h
index 4b99e5e..912e6d3 100644
--- a/bin/varnishhist/varnishhist_options.h
+++ b/bin/varnishhist/varnishhist_options.h
@@ -38,7 +38,7 @@
)
#define HIS_OPT_p \
- VOPT("p:", "[-p period]", "Refresh period", \
+ VOPT("p:", "[-p <period>]", "Refresh period", \
"Specified the number of seconds between screen refreshes." \
" Default is 1 second, and can be changed at runtime by" \
" pressing the [0-9] keys (powers of 2 in seconds" \
@@ -46,17 +46,12 @@
)
#define HIS_OPT_P \
- VOPT("P:", "[-P <profile|[[cb:]tag:field_num:min:max>]", \
- "Profile definition", \
- "Either a predefined profile or a custom definition. " \
- " Predefined profiles for the client side are" \
- " \"responsetime \" and \"size\". For the backend side:" \
- " \"Bereqtime\", \"Beresptime\", \"BerespBodytime\"," \
- " and \"Besize\"." \
- " custom definitions include an optional (c)lient or" \
- " (b)backend filter (defaults to client), the tag we'll" \
- " look for, and the field number of the value we are" \
- " interested in. min and max are the boundaries of the" \
+ VOPT("P:", "[-P <[[cb:]tag:field_num:min:max>]", \
+ "Custom profile definition", \
+ " Graph the given custom definition defined as: an optional"\
+ " (c)lient or (b)backend filter (defaults to client), the " \
+ " tag we'll look for, and the field number of the value we" \
+ " are interested in. min and max are the boundaries of the" \
" graph (these are power of ten)." \
)
@@ -78,6 +73,19 @@ VSL_OPT_L
VUT_OPT_n
VUT_OPT_N
HIS_OPT_p
+#define HIS_CLIENT "client"
+#define HIS_BACKEND "backend"
+#define HIS_NO_PREFIX ""
+#define HIS_PROF(name,cb,tag,prefix,field,hist_low,high_high,doc) \
+ VOPT("P:", "[-P " name "]", \
+ "Predefined " cb " profile", \
+ doc " (Field " #field " of " #tag " " prefix " log tags)" \
+ )
+#include "varnishhist_profiles.h"
+#undef HIS_NO_PREFIX
+#undef HIS_BACKEND
+#undef HIS_CLIENT
+#undef HIS_PROF
HIS_OPT_P
VUT_OPT_q
VUT_OPT_r
diff --git a/bin/varnishhist/varnishhist_profiles.h b/bin/varnishhist/varnishhist_profiles.h
new file mode 100644
index 0000000..fa72f9a
--- /dev/null
+++ b/bin/varnishhist/varnishhist_profiles.h
@@ -0,0 +1,97 @@
+/*-
+ * Copyright 2016 UPLEX - Nils Goroll Systemoptimierung
+ * All rights reserved.
+ *
+ * Author: Nils Goroll <nils.goroll at uplex.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Profile definitions for varnishhist
+ */
+
+// client
+HIS_PROF(
+ "responsetime", // name
+ HIS_CLIENT, // HIS_CLIENT | HIS_BACKEND
+ SLT_Timestamp, // tag
+ "Process:", // prefix
+ 3, // field
+ -6, // hist_low
+ 3, // hist_high
+ "Graph the total time from start of request processing"
+ " (first byte received) until ready to deliver the"
+ " client response."
+ )
+HIS_PROF(
+ "size", // name
+ HIS_CLIENT, // HIS_CLIENT | HIS_BACKEND
+ SLT_ReqAcct, // tag
+ HIS_NO_PREFIX, // prefix
+ 5, // field
+ 1, // hist_low
+ 8, // hist_high
+ "Graph the size of responses"
+ )
+// backend
+HIS_PROF(
+ "Bereqtime", // name
+ HIS_BACKEND, // HIS_CLIENT | HIS_BACKEND
+ SLT_Timestamp, // tag
+ "Bereq:", // prefix
+ 3, // field
+ -6, // hist_low
+ 3, // hist_high
+ "Graph the time from beginning of backend processing"
+ " until a backend request is sent completely"
+ )
+HIS_PROF(
+ "Beresptime", // name
+ HIS_BACKEND, // HIS_CLIENT | HIS_BACKEND
+ SLT_Timestamp, // tag
+ "Beresp:", // prefix
+ 3, // field
+ -6, // hist_low
+ 3, // hist_high
+ "Graph the time from beginning of backend processing"
+ " until the response headers are being received completely"
+ )
+HIS_PROF(
+ "BerespBodytime", // name
+ HIS_BACKEND, // HIS_CLIENT | HIS_BACKEND
+ SLT_Timestamp, // tag
+ "BerespBody:", // prefix
+ 3, // field
+ -6, // hist_low
+ 3, // hist_high
+ "Graph the time from beginning of backend processing"
+ " until the response body has been received"
+ )
+HIS_PROF(
+ "Besize", // name
+ HIS_BACKEND, // HIS_CLIENT | HIS_BACKEND
+ SLT_BereqAcct, // tag
+ HIS_NO_PREFIX, // prefix
+ 5, // field
+ 1, // hist_low
+ 8, // hist_high
+ "Graph the backend response body size"
+ )
More information about the varnish-commit
mailing list