Commit b4f4e20e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make vsctool.py produce the VSC .rst doc.

Retire vsc2rst
parent 2643ce32
......@@ -8,6 +8,9 @@
.. varnish_vsc_begin:: lck
:oneliner: Lock Counters
Counters which track the activity in the different classes
of mutex-locks.
.. varnish_vsc:: creat
:type: counter
:level: debug
......
This diff is collapsed.
......@@ -37,13 +37,11 @@
:level: debug
:oneliner: Allocations
.. varnish_vsc:: frees
:type: counter
:level: debug
:oneliner: Frees
.. varnish_vsc:: recycle
:type: counter
:level: debug
......
......@@ -13,48 +13,49 @@
:level: info
:oneliner: Management process uptime
Uptime in seconds of the management process
Uptime in seconds of the management process
.. varnish_vsc:: child_start
:type: counter
:level: diag
:oneliner: Child process started
Number of times the child process has been started
Number of times the child process has been started
.. varnish_vsc:: child_exit
:type: counter
:level: diag
:oneliner: Child process normal exit
Number of times the child process has been cleanly stopped
Number of times the child process has been cleanly stopped
.. varnish_vsc:: child_stop
:type: counter
:level: diag
:oneliner: Child process unexpected exit
Number of times the child process has exited with an unexpected return code
Number of times the child process has exited with an
unexpected return code
.. varnish_vsc:: child_died
:type: counter
:level: diag
:oneliner: Child process died (signal)
Number of times the child process has died due to signals
Number of times the child process has died due to signals
.. varnish_vsc:: child_dump
:type: counter
:level: diag
:oneliner: Child process core dumped
Number of times the child process has produced core dumps
Number of times the child process has produced core dumps
.. varnish_vsc:: child_panic
:type: counter
:level: diag
:oneliner: Child process panic
Number of times the management process has caught a child panic
Number of times the management process has caught a child panic
.. varnish_vsc_end:: mgt
......@@ -13,48 +13,48 @@
:level: info
:oneliner: Allocator requests
Number of times the storage has been asked to provide a storage segment.
Number of times the storage has been asked to provide a storage segment.
.. varnish_vsc:: c_fail
:type: counter
:level: info
:oneliner: Allocator failures
Number of times the storage has failed to provide a storage segment.
Number of times the storage has failed to provide a storage segment.
.. varnish_vsc:: c_bytes
:type: counter
:level: info
:oneliner: Bytes allocated
Number of total bytes allocated by this storage.
Number of total bytes allocated by this storage.
.. varnish_vsc:: c_freed
:type: counter
:level: info
:oneliner: Bytes freed
Number of total bytes returned to this storage.
Number of total bytes returned to this storage.
.. varnish_vsc:: g_alloc
:type: gauge
:level: info
:oneliner: Allocations outstanding
Number of storage allocations outstanding.
Number of storage allocations outstanding.
.. varnish_vsc:: g_bytes
:type: gauge
:level: info
:oneliner: Bytes outstanding
Number of bytes allocated from the storage.
Number of bytes allocated from the storage.
.. varnish_vsc:: g_space
:type: gauge
:level: info
:oneliner: Bytes available
Number of bytes left in the storage.
Number of bytes left in the storage.
.. varnish_vsc_end:: sma
......@@ -13,49 +13,49 @@
:level: info
:oneliner: Allocator requests
Number of times the storage has been asked to provide a storage segment.
Number of times the storage has been asked to provide a storage segment.
.. varnish_vsc:: c_fail
:type: counter
:level: info
:oneliner: Allocator failures
Number of times the storage has failed to provide a storage segment.
Number of times the storage has failed to provide a storage segment.
.. varnish_vsc:: c_bytes
:type: counter
:level: info
:oneliner: Bytes allocated
Number of total bytes allocated by this storage.
Number of total bytes allocated by this storage.
.. varnish_vsc:: c_freed
:type: counter
:level: info
:oneliner: Bytes freed
Number of total bytes returned to this storage.
Number of total bytes returned to this storage.
.. varnish_vsc:: g_alloc
:type: gauge
:level: info
:oneliner: Allocations outstanding
Number of storage allocations outstanding.
Number of storage allocations outstanding.
.. varnish_vsc:: g_bytes
:type: gauge
:level: info
:oneliner: Bytes outstanding
Number of bytes allocated from the storage.
Number of bytes allocated from the storage.
.. varnish_vsc:: g_space
:type: gauge
:level: info
:oneliner: Bytes available
Number of bytes left in the storage.
Number of bytes left in the storage.
.. varnish_vsc:: g_smf
:type: gauge
......
......@@ -18,49 +18,49 @@
:level: info
:oneliner: Request header bytes
Total backend request header bytes sent
Total backend request header bytes sent
.. varnish_vsc:: bereq_bodybytes
:type: counter
:level: info
:oneliner: Request body bytes
Total backend request body bytes sent
Total backend request body bytes sent
.. varnish_vsc:: beresp_hdrbytes
:type: counter
:level: info
:oneliner: Response header bytes
Total backend response header bytes received
Total backend response header bytes received
.. varnish_vsc:: beresp_bodybytes
:type: counter
:level: info
:oneliner: Response body bytes
Total backend response body bytes received
Total backend response body bytes received
.. varnish_vsc:: pipe_hdrbytes
:type: counter
:level: info
:oneliner: Pipe request header bytes
Total request bytes sent for piped sessions
Total request bytes sent for piped sessions
.. varnish_vsc:: pipe_out
:type: counter
:level: info
:oneliner: Piped bytes to backend
Total number of bytes forwarded to backend in pipe sessions
Total number of bytes forwarded to backend in pipe sessions
.. varnish_vsc:: pipe_in
:type: counter
:level: info
:oneliner: Piped bytes from backend
Total number of bytes forwarded from backend in pipe sessions
Total number of bytes forwarded from backend in pipe sessions
.. varnish_vsc:: conn
:type: gauge
......
......@@ -20,6 +20,3 @@ varnishstat_LDADD = \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
@SAN_LDFLAGS@ \
@CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS}
noinst_PROGRAMS = vsc2rst
vsc2rst_SOURCES = vsc2rst.c $(top_srcdir)/include/tbl/vsc_fields.h
/*-
* Copyright (c) 2011-2015 Varnish Software AS
* All rights reserved.
*
* Author: Tollef Fog Heen <tfheen@varnish-software.com>
*
* 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.
*
*/
#ifndef __FLEXELINT__
#include "config.h"
#include <stdio.h>
#define VSC_LEVEL_F(v,l,e,d) \
static const char VSC_level_##v[] = #v;
#include "tbl/vsc_levels.h"
#undef VSC_LEVEL_F
static void
L(const char *s)
{
printf("\n%s\n", s);
for (;*s != '\0'; s++)
putchar('=');
putchar('\n');
putchar('\n');
}
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
L("COUNTER LEVELS");
#define VSC_LEVEL_F(v,l,e,d) \
printf("%s – %s\n\t%s\n\n", l, e, d);
#include "tbl/vsc_levels.h"
#define VSC_DO(U,l,t,h) L(h);
#define VSC_F(n, t, l, s, f, v, d, e) \
do { \
printf("``%s`` – ", #n); \
if (s == 'c') \
printf("`counter` - "); \
else if (s == 'g') \
printf("`gauge` - "); \
else if (s == 'b') \
printf("`bitmap` - "); \
printf("%s\n\n", VSC_level_##v); \
printf("\t%s\n\n", d); \
printf("\t%s\n\n", e); \
} while (0);
#define VSC_DONE(U,l,t)
#include "tbl/vsc_all.h"
return (0);
}
#endif // __FLEXELINT__
......@@ -123,8 +123,21 @@ include/params.rst: $(top_builddir)/bin/varnishd/varnishd
$(top_builddir)/bin/varnishd/varnishd -x parameter > $@
BUILT_SOURCES += include/params.rst
include/counters.rst: $(top_builddir)/bin/varnishstat/vsc2rst
$(top_builddir)/bin/varnishstat/vsc2rst > $@
COUNTERS = \
$(top_srcdir)/bin/varnishd/main.vsc \
$(top_srcdir)/bin/varnishd/mgt.vsc \
$(top_srcdir)/bin/varnishd/mempool.vsc \
$(top_srcdir)/bin/varnishd/sma.vsc \
$(top_srcdir)/bin/varnishd/smf.vsc \
$(top_srcdir)/bin/varnishd/vbe.vsc \
$(top_srcdir)/bin/varnishd/lck.vsc
include/counters.rst: $(top_srcdir)/lib/libvcc/vsctool.py $(COUNTERS)
echo -n '' > $@
for i in $(COUNTERS); do \
$(PYTHON) $(top_srcdir)/lib/libvcc/vsctool.py -r $$i >> $@ ; \
done
BUILT_SOURCES += include/counters.rst
# XXX add varnishstat here when it's been _opt2rst'ed
......
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2017 Varnish Software AS
# All rights reserved.
......@@ -241,6 +242,16 @@ class rst_vsc_begin(directive):
def vscset(self, ss):
ss.append(vscset(self.arg, self))
def emit_rst(self, fo):
fo.write("\n..\n\t" + self.cmd + ":: " + self.arg + "\n")
s = self.arg.upper() + " – " + self.param["oneliner"]
fo.write("\n")
fo.write(s + "\n")
fo.write("=" * len(s) + "\n")
self.emit_rst_doc(fo)
class rst_vsc(directive):
def __init__(self, s):
super(rst_vsc, self).__init__(s)
......@@ -250,9 +261,11 @@ class rst_vsc(directive):
self.param["level"] = "info"
def emit_rst(self, fo):
fo.write("\n``%s`` - " % self.arg)
fo.write("\n``%s`` " % self.arg)
fo.write("`%s` - " % self.param["type"])
fo.write("%s\n" % self.param["level"])
fo.write("%s\n\n" % self.param["level"])
fo.write("\t" + self.param["oneliner"] + "\n")
self.emit_rst_doc(fo)
def vscset(self, ss):
......@@ -266,6 +279,10 @@ class rst_vsc_end(directive):
def vscset(self, ss):
ss[-1].complete()
def emit_rst(self, fo):
fo.write("\n..\n\t" + self.cmd + ":: " + self.arg + "\n")
self.emit_rst_doc(fo)
class other(object):
def __init__(self, s):
self.s = s
......@@ -316,8 +333,8 @@ class vsc_file(object):
for i in self.vscset:
i.emit_c()
def emit_rst(self, fon):
fo = open(fon, "w")
def emit_rst(self):
fo = sys.stdout
for i in self.c:
i.emit_rst(fo)
......@@ -330,13 +347,13 @@ if __name__ == "__main__":
fo = sys.stdout
if len(args) != 1:
print("Need exactly one filename argument")
sys.stderr.write("Need exactly one filename argument\n")
exit(2)
vf = vsc_file(args[0])
for f,v in optlist:
if f == '-r':
vf.emit_rst("_.rst")
vf.emit_rst()
if f == '-h':
vf.emit_h()
if f == '-c':
......
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