[master] 4cf3e41 Add verbosity levels to all Varnish counters
Martin Blix Grydeland
martin at varnish-cache.org
Wed May 15 14:46:14 CEST 2013
commit 4cf3e419bc842012ed011522b139603b7a240ea7
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Thu Mar 14 16:07:06 2013 +0100
Add verbosity levels to all Varnish counters
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index d7f29f5..b86f4c0 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -243,7 +243,7 @@ struct acct {
#define L0(t, n)
#define L1(t, n) t n;
-#define VSC_F(n, t, l, f, e,d) L##l(t, n)
+#define VSC_F(n,t,l,f,v,e,d) L##l(t, n)
struct dstat {
#include "tbl/vsc_f_main.h"
};
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 7b65479..ec18df9 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -49,7 +49,7 @@ wrk_sumstat(struct worker *w)
Lck_AssertHeld(&wstat_mtx);
#define L0(n)
#define L1(n) (VSC_C_main->n += w->stats.n)
-#define VSC_F(n, t, l, f, d, e) L##l(n);
+#define VSC_F(n, t, l, f, v, d, e) L##l(n);
#include "tbl/vsc_f_main.h"
#undef VSC_F
#undef L0
diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h
index 6506668..a42579b 100644
--- a/include/tbl/vsc_f_main.h
+++ b/include/tbl/vsc_f_main.h
@@ -61,7 +61,7 @@
* Globals, not related to traffic
*/
-VSC_F(uptime, uint64_t, 0, 'a',
+VSC_F(uptime, uint64_t, 0, 'a', info,
"Child process uptime",
""
)
@@ -71,61 +71,61 @@ VSC_F(uptime, uint64_t, 0, 'a',
* Sessions
*/
-VSC_F(sess_conn, uint64_t, 1, 'c',
+VSC_F(sess_conn, uint64_t, 1, 'c', info,
"Sessions accepted",
"Count of sessions succesfully accepted"
)
-VSC_F(sess_drop, uint64_t, 1, 'c',
+VSC_F(sess_drop, uint64_t, 1, 'c', info,
"Sessions dropped",
"Count of sessions silently dropped due to lack of worker thread."
)
-VSC_F(sess_fail, uint64_t, 1, 'c',
+VSC_F(sess_fail, uint64_t, 1, 'c', info,
"Session accept failures",
"Count of failures to accept TCP connection."
" Either the client changed its mind, or the kernel ran out of"
" some resource like filedescriptors."
)
-VSC_F(sess_pipe_overflow, uint64_t, 1, 'c',
+VSC_F(sess_pipe_overflow, uint64_t, 1, 'c', info,
"Session pipe overflow",
"Count of sessions dropped due to the session pipe overflowing."
)
/*---------------------------------------------------------------------*/
-VSC_F(client_req_400, uint64_t, 1, 'a',
+VSC_F(client_req_400, uint64_t, 1, 'a', info,
"Client requests received, subject to 400 errors",
"400 means we couldn't make sense of the request, it was"
" malformed in some drastic way."
)
-VSC_F(client_req_413, uint64_t, 1, 'a',
+VSC_F(client_req_413, uint64_t, 1, 'a', info,
"Client requests received, subject to 413 errors",
"413 means that HTTP headers execeeded length or count limits."
)
-VSC_F(client_req_417, uint64_t, 1, 'a',
+VSC_F(client_req_417, uint64_t, 1, 'a', info,
"Client requests received, subject to 417 errors",
"417 means that something went wrong with an Expect: header."
)
-VSC_F(client_req, uint64_t, 1, 'a',
+VSC_F(client_req, uint64_t, 1, 'a', info,
"Good Client requests received",
""
)
/*---------------------------------------------------------------------*/
-VSC_F(cache_hit, uint64_t, 1, 'a',
+VSC_F(cache_hit, uint64_t, 1, 'a', info,
"Cache hits",
"Count of cache hits. "
" A cache hit indicates that an object has been delivered to a"
" client without fetching it from a backend server."
)
-VSC_F(cache_hitpass, uint64_t, 1, 'a',
+VSC_F(cache_hitpass, uint64_t, 1, 'a', info,
"Cache hits for pass",
"Count of hits for pass"
" A cache hit for pass indicates that Varnish is going to"
@@ -134,7 +134,7 @@ VSC_F(cache_hitpass, uint64_t, 1, 'a',
" decision is being used."
)
-VSC_F(cache_miss, uint64_t, 1, 'a',
+VSC_F(cache_miss, uint64_t, 1, 'a', info,
"Cache misses",
"Count of misses"
" A cache miss indicates the object was fetched from the"
@@ -143,33 +143,33 @@ VSC_F(cache_miss, uint64_t, 1, 'a',
/*---------------------------------------------------------------------*/
-VSC_F(backend_conn, uint64_t, 0, 'a',
+VSC_F(backend_conn, uint64_t, 0, 'a', info,
"Backend conn. success",
""
)
-VSC_F(backend_unhealthy, uint64_t, 0, 'a',
+VSC_F(backend_unhealthy, uint64_t, 0, 'a', info,
"Backend conn. not attempted",
""
)
-VSC_F(backend_busy, uint64_t, 0, 'a',
+VSC_F(backend_busy, uint64_t, 0, 'a', info,
"Backend conn. too many",
""
)
-VSC_F(backend_fail, uint64_t, 0, 'a',
+VSC_F(backend_fail, uint64_t, 0, 'a', info,
"Backend conn. failures",
""
)
-VSC_F(backend_reuse, uint64_t, 0, 'a',
+VSC_F(backend_reuse, uint64_t, 0, 'a', info,
"Backend conn. reuses",
"Count of backend connection reuses"
" This counter is increased whenever we reuse a recycled connection."
)
-VSC_F(backend_toolate, uint64_t, 0, 'a',
+VSC_F(backend_toolate, uint64_t, 0, 'a', info,
"Backend conn. was closed",
""
)
-VSC_F(backend_recycle, uint64_t, 0, 'a',
+VSC_F(backend_recycle, uint64_t, 0, 'a', info,
"Backend conn. recycles",
"Count of backend connection recycles"
" This counter is increased whenever we have a keep-alive"
@@ -177,7 +177,7 @@ VSC_F(backend_recycle, uint64_t, 0, 'a',
" It has not yet been used, but it might be, unless the backend"
" closes it."
)
-VSC_F(backend_retry, uint64_t, 0, 'a',
+VSC_F(backend_retry, uint64_t, 0, 'a', info,
"Backend conn. retry",
""
)
@@ -186,51 +186,51 @@ VSC_F(backend_retry, uint64_t, 0, 'a',
* Backend fetch statistics
*/
-VSC_F(fetch_head, uint64_t, 1, 'c',
+VSC_F(fetch_head, uint64_t, 1, 'c', info,
"Fetch no body (HEAD)",
"beresp with no body because the request is HEAD."
)
-VSC_F(fetch_length, uint64_t, 1, 'c',
+VSC_F(fetch_length, uint64_t, 1, 'c', info,
"Fetch with Length",
"beresp with Content-Length."
)
-VSC_F(fetch_chunked, uint64_t, 1, 'c',
+VSC_F(fetch_chunked, uint64_t, 1, 'c', info,
"Fetch chunked",
"beresp with Chunked."
)
-VSC_F(fetch_eof, uint64_t, 1, 'c',
+VSC_F(fetch_eof, uint64_t, 1, 'c', info,
"Fetch EOF",
"beresp with EOF from lack of other info."
)
-VSC_F(fetch_bad, uint64_t, 1, 'c',
+VSC_F(fetch_bad, uint64_t, 1, 'c', info,
"Fetch bad T-E",
"beresp failed due to unknown Transfer-Encoding."
)
-VSC_F(fetch_close, uint64_t, 1, 'c',
+VSC_F(fetch_close, uint64_t, 1, 'c', info,
"Fetch wanted close",
"beresp with EOF due to Connection: Close."
)
-VSC_F(fetch_oldhttp, uint64_t, 1, 'c',
+VSC_F(fetch_oldhttp, uint64_t, 1, 'c', info,
"Fetch pre HTTP/1.1 closed",
"beresp with EOF due to HTTP < 1.1"
)
-VSC_F(fetch_zero, uint64_t, 1, 'c',
+VSC_F(fetch_zero, uint64_t, 1, 'c', info,
"Fetch zero len body",
"beresp with EOF due to keep-live but neither Chunked or Len."
)
-VSC_F(fetch_1xx, uint64_t, 1, 'c',
+VSC_F(fetch_1xx, uint64_t, 1, 'c', info,
"Fetch no body (1xx)",
"beresp with no body because of 1XX response."
)
-VSC_F(fetch_204, uint64_t, 1, 'c',
+VSC_F(fetch_204, uint64_t, 1, 'c', info,
"Fetch no body (204)",
"beresp with no body because of 204 response."
)
-VSC_F(fetch_304, uint64_t, 1, 'c',
+VSC_F(fetch_304, uint64_t, 1, 'c', info,
"Fetch no body (304)",
"beresp with no body because of 304 response."
)
-VSC_F(fetch_failed, uint64_t, 1, 'c',
+VSC_F(fetch_failed, uint64_t, 1, 'c', info,
"Fetch body failed",
"beresp body fetch failed."
)
@@ -241,68 +241,68 @@ VSC_F(fetch_failed, uint64_t, 1, 'c',
*
*/
-VSC_F(pools, uint64_t, 0, 'g',
+VSC_F(pools, uint64_t, 0, 'g', info,
"Number of thread pools",
"Number of thread pools. See also param wthread_pools."
" NB: Presently pools cannot be removed once created."
)
-VSC_F(threads, uint64_t, 0, 'g',
+VSC_F(threads, uint64_t, 0, 'g', info,
"Total number of threads",
"Number of threads in all pools."
" See also params thread_pools, thread_pool_min & thread_pool_max."
)
-VSC_F(threads_limited, uint64_t, 0, 'c',
+VSC_F(threads_limited, uint64_t, 0, 'c', info,
"Threads hit max",
"Number of times more threads were needed, but limit was reached"
" in a thread pool."
" See also param thread_pool_max."
)
-VSC_F(threads_created, uint64_t, 0, 'c',
+VSC_F(threads_created, uint64_t, 0, 'c', info,
"Threads created",
"Total number of threads created in all pools."
)
-VSC_F(threads_destroyed, uint64_t, 0, 'c',
+VSC_F(threads_destroyed, uint64_t, 0, 'c', info,
"Threads destoryed",
"Total number of threads destroyed in all pools."
)
-VSC_F(threads_failed, uint64_t, 0, 'c',
+VSC_F(threads_failed, uint64_t, 0, 'c', info,
"Thread creation failed",
"Number of times creating a thread failed."
" See VSL::Debug for diagnostics."
" See also param thread_fail_delay."
)
-VSC_F(thread_queue_len, uint64_t, 0, 'g',
+VSC_F(thread_queue_len, uint64_t, 0, 'g', info,
"Length of session queue",
"Length of session queue waiting for threads."
" NB: Only updates once per second."
" See also param queue_max."
)
-VSC_F(busy_sleep, uint64_t, 1, 'c',
+VSC_F(busy_sleep, uint64_t, 1, 'c', info,
"Number of requests sent to sleep on busy objhdr",
"Number of requests sent to sleep without a worker threads because"
" they found a busy object."
)
-VSC_F(busy_wakeup, uint64_t, 1, 'c',
+VSC_F(busy_wakeup, uint64_t, 1, 'c', info,
"Number of requests woken after sleep on busy objhdr",
"Number of requests taken of the busy object sleep list and"
" and rescheduled."
)
-VSC_F(sess_queued, uint64_t, 0, 'c',
+VSC_F(sess_queued, uint64_t, 0, 'c', info,
"Sessions queued for thread",
"Number of times session was queued waiting for a thread."
" See also param queue_max."
)
-VSC_F(sess_dropped, uint64_t, 0, 'c',
+VSC_F(sess_dropped, uint64_t, 0, 'c', info,
"Sessions dropped for thread",
"Number of times session was dropped because the queue were too"
" long already."
@@ -311,214 +311,214 @@ VSC_F(sess_dropped, uint64_t, 0, 'c',
/*---------------------------------------------------------------------*/
-VSC_F(n_object, uint64_t, 1, 'i',
+VSC_F(n_object, uint64_t, 1, 'i', info,
"N struct object",
""
)
-VSC_F(n_vampireobject, uint64_t, 1, 'i',
+VSC_F(n_vampireobject, uint64_t, 1, 'i', diag,
"N unresurrected objects",
""
)
-VSC_F(n_objectcore, uint64_t, 1, 'i',
+VSC_F(n_objectcore, uint64_t, 1, 'i', info,
"N struct objectcore",
""
)
-VSC_F(n_objecthead, uint64_t, 1, 'i',
+VSC_F(n_objecthead, uint64_t, 1, 'i', info,
"N struct objecthead",
""
)
-VSC_F(n_waitinglist, uint64_t, 1, 'i',
+VSC_F(n_waitinglist, uint64_t, 1, 'i', debug,
"N struct waitinglist",
""
)
-VSC_F(n_backend, uint64_t, 0, 'i',
+VSC_F(n_backend, uint64_t, 0, 'i', info,
"N backends",
""
)
-VSC_F(n_expired, uint64_t, 0, 'i',
+VSC_F(n_expired, uint64_t, 0, 'i', info,
"N expired objects",
""
)
-VSC_F(n_lru_nuked, uint64_t, 0, 'i',
+VSC_F(n_lru_nuked, uint64_t, 0, 'i', info,
"N LRU nuked objects",
""
)
-VSC_F(n_lru_moved, uint64_t, 0, 'i',
+VSC_F(n_lru_moved, uint64_t, 0, 'i', diag,
"N LRU moved objects",
""
)
-VSC_F(losthdr, uint64_t, 0, 'a',
+VSC_F(losthdr, uint64_t, 0, 'a', info,
"HTTP header overflows",
""
)
-VSC_F(s_sess, uint64_t, 1, 'a',
+VSC_F(s_sess, uint64_t, 1, 'a', info,
"Total Sessions",
""
)
-VSC_F(s_req, uint64_t, 1, 'a',
+VSC_F(s_req, uint64_t, 1, 'a', info,
"Total Requests",
""
)
-VSC_F(s_pipe, uint64_t, 1, 'a',
+VSC_F(s_pipe, uint64_t, 1, 'a', info,
"Total pipe",
""
)
-VSC_F(s_pass, uint64_t, 1, 'a',
+VSC_F(s_pass, uint64_t, 1, 'a', info,
"Total pass",
""
)
-VSC_F(s_fetch, uint64_t, 1, 'a',
+VSC_F(s_fetch, uint64_t, 1, 'a', info,
"Total fetch",
""
)
-VSC_F(s_error, uint64_t, 1, 'a',
+VSC_F(s_error, uint64_t, 1, 'a', info,
"Total error",
""
)
-VSC_F(s_hdrbytes, uint64_t, 1, 'a',
+VSC_F(s_hdrbytes, uint64_t, 1, 'a', info,
"Total header bytes",
""
)
-VSC_F(s_bodybytes, uint64_t, 1, 'a',
+VSC_F(s_bodybytes, uint64_t, 1, 'a', info,
"Total body bytes",
""
)
-VSC_F(sess_closed, uint64_t, 1, 'a',
+VSC_F(sess_closed, uint64_t, 1, 'a', info,
"Session Closed",
""
)
-VSC_F(sess_pipeline, uint64_t, 1, 'a',
+VSC_F(sess_pipeline, uint64_t, 1, 'a', info,
"Session Pipeline",
""
)
-VSC_F(sess_readahead, uint64_t, 1, 'a',
+VSC_F(sess_readahead, uint64_t, 1, 'a', info,
"Session Read Ahead",
""
)
-VSC_F(sess_herd, uint64_t, 1, 'a',
+VSC_F(sess_herd, uint64_t, 1, 'a', diag,
"Session herd",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(shm_records, uint64_t, 0, 'a',
+VSC_F(shm_records, uint64_t, 0, 'a', diag,
"SHM records",
""
)
-VSC_F(shm_writes, uint64_t, 0, 'a',
+VSC_F(shm_writes, uint64_t, 0, 'a', diag,
"SHM writes",
""
)
-VSC_F(shm_flushes, uint64_t, 0, 'a',
+VSC_F(shm_flushes, uint64_t, 0, 'a', diag,
"SHM flushes due to overflow",
""
)
-VSC_F(shm_cont, uint64_t, 0, 'a',
+VSC_F(shm_cont, uint64_t, 0, 'a', diag,
"SHM MTX contention",
""
)
-VSC_F(shm_cycles, uint64_t, 0, 'a',
+VSC_F(shm_cycles, uint64_t, 0, 'a', diag,
"SHM cycles through buffer",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(sms_nreq, uint64_t, 0, 'a',
+VSC_F(sms_nreq, uint64_t, 0, 'a', diag,
"SMS allocator requests",
""
)
-VSC_F(sms_nobj, uint64_t, 0, 'i',
+VSC_F(sms_nobj, uint64_t, 0, 'i', diag,
"SMS outstanding allocations",
""
)
-VSC_F(sms_nbytes, uint64_t, 0, 'i',
+VSC_F(sms_nbytes, uint64_t, 0, 'i', diag,
"SMS outstanding bytes",
""
)
-VSC_F(sms_balloc, uint64_t, 0, 'i',
+VSC_F(sms_balloc, uint64_t, 0, 'i', diag,
"SMS bytes allocated",
""
)
-VSC_F(sms_bfree, uint64_t, 0, 'i',
+VSC_F(sms_bfree, uint64_t, 0, 'i', diag,
"SMS bytes freed",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(backend_req, uint64_t, 0, 'a',
+VSC_F(backend_req, uint64_t, 0, 'a', info,
"Backend requests made",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(n_vcl, uint64_t, 0, 'a',
+VSC_F(n_vcl, uint64_t, 0, 'a', info,
"N vcl total",
""
)
-VSC_F(n_vcl_avail, uint64_t, 0, 'a',
+VSC_F(n_vcl_avail, uint64_t, 0, 'a', diag,
"N vcl available",
""
)
-VSC_F(n_vcl_discard, uint64_t, 0, 'a',
+VSC_F(n_vcl_discard, uint64_t, 0, 'a', diag,
"N vcl discarded",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(bans, uint64_t, 0, 'g',
+VSC_F(bans, uint64_t, 0, 'g', info,
"Count of bans",
"Number of all bans in system, including bans superseded"
" by newer bans and bans already checked by the ban-lurker."
)
-VSC_F(bans_gone, uint64_t, 0, 'g',
+VSC_F(bans_gone, uint64_t, 0, 'g', diag,
"Number of bans marked 'gone'",
"Number of bans which are no longer active, either because they"
" got checked by the ban-lurker or superseded by newer identical bans."
)
-VSC_F(bans_req, uint64_t, 0, 'g',
+VSC_F(bans_req, uint64_t, 0, 'g', diag,
"Number of bans using req.*",
"Number of bans which use req.* variables. These bans can not"
" be washed by the ban-lurker."
)
-VSC_F(bans_added, uint64_t, 0, 'c',
+VSC_F(bans_added, uint64_t, 0, 'c', diag,
"Bans added",
"Counter of bans added to ban list."
)
-VSC_F(bans_deleted, uint64_t, 0, 'c',
+VSC_F(bans_deleted, uint64_t, 0, 'c', diag,
"Bans deleted",
"Counter of bans deleted from ban list."
)
-VSC_F(bans_tested, uint64_t, 0, 'c',
+VSC_F(bans_tested, uint64_t, 0, 'c', diag,
"Bans tested against objects",
"Count of how many bans and objects have been tested against"
" each other."
)
-VSC_F(bans_tests_tested, uint64_t, 0, 'c',
+VSC_F(bans_tests_tested, uint64_t, 0, 'c', diag,
"Ban tests tested against objects",
"Count of how many tests and objects have been tested against"
" each other. 'ban req.url == foo && req.http.host == bar'"
" counts as one in 'bans_tested' and as two in 'bans_tests_tested'"
)
-VSC_F(bans_dups, uint64_t, 0, 'c',
+VSC_F(bans_dups, uint64_t, 0, 'c', diag,
"Bans superseded by other bans",
"Count of bans replaced by later identical bans."
)
-VSC_F(bans_persisted_bytes, uint64_t, 0, 'g',
+VSC_F(bans_persisted_bytes, uint64_t, 0, 'g', diag,
"Bytes used by the persisted ban lists",
"Number of bytes used by the persisted ban lists."
)
-VSC_F(bans_persisted_fragmentation, uint64_t, 0, 'g',
+VSC_F(bans_persisted_fragmentation, uint64_t, 0, 'g', diag,
"Extra bytes in persisted ban lists due to fragmentation",
"Number of extra bytes accumulated through dropped and"
" gone bans in the persistent ban lists."
@@ -526,96 +526,96 @@ VSC_F(bans_persisted_fragmentation, uint64_t, 0, 'g',
/*--------------------------------------------------------------------*/
-VSC_F(hcb_nolock, uint64_t, 1, 'a',
+VSC_F(hcb_nolock, uint64_t, 1, 'a', debug,
"HCB Lookups without lock",
""
)
-VSC_F(hcb_lock, uint64_t, 0, 'a',
+VSC_F(hcb_lock, uint64_t, 0, 'a', debug,
"HCB Lookups with lock",
""
)
-VSC_F(hcb_insert, uint64_t, 0, 'a',
+VSC_F(hcb_insert, uint64_t, 0, 'a', debug,
"HCB Inserts",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(esi_errors, uint64_t, 0, 'a',
+VSC_F(esi_errors, uint64_t, 0, 'a', diag,
"ESI parse errors (unlock)",
""
)
-VSC_F(esi_warnings, uint64_t, 0, 'a',
+VSC_F(esi_warnings, uint64_t, 0, 'a', diag,
"ESI parse warnings (unlock)",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(dir_dns_lookups, uint64_t, 0, 'a',
+VSC_F(dir_dns_lookups, uint64_t, 0, 'a', diag,
"DNS director lookups",
""
)
-VSC_F(dir_dns_failed, uint64_t, 0, 'a',
+VSC_F(dir_dns_failed, uint64_t, 0, 'a', diag,
"DNS director failed lookups",
""
)
-VSC_F(dir_dns_hit, uint64_t, 0, 'a',
+VSC_F(dir_dns_hit, uint64_t, 0, 'a', diag,
"DNS director cached lookups hit",
""
)
-VSC_F(dir_dns_cache_full, uint64_t, 0, 'a',
+VSC_F(dir_dns_cache_full, uint64_t, 0, 'a', debug,
"DNS director full dnscache",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(vmods, uint64_t, 0, 'i',
+VSC_F(vmods, uint64_t, 0, 'i', info,
"Loaded VMODs",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(n_gzip, uint64_t, 0, 'a',
+VSC_F(n_gzip, uint64_t, 0, 'a', info,
"Gzip operations",
""
)
-VSC_F(n_gunzip, uint64_t, 0, 'a',
+VSC_F(n_gunzip, uint64_t, 0, 'a', info,
"Gunzip operations",
""
)
/*--------------------------------------------------------------------*/
-VSC_F(vsm_free, uint64_t, 0, 'g',
+VSC_F(vsm_free, uint64_t, 0, 'g', diag,
"Free VSM space",
"Number of bytes free in the shared memory used to communicate"
" with tools like varnishstat, varnishlog etc."
)
-VSC_F(vsm_used, uint64_t, 0, 'g',
+VSC_F(vsm_used, uint64_t, 0, 'g', diag,
"Used VSM space",
"Number of bytes used in the shared memory used to communicate"
" with tools like varnishstat, varnishlog etc."
)
-VSC_F(vsm_cooling, uint64_t, 0, 'g',
+VSC_F(vsm_cooling, uint64_t, 0, 'g', debug,
"Cooling VSM space",
"Number of bytes which will soon (max 1 minute) be freed"
" in the shared memory used to communicate"
" with tools like varnishstat, varnishlog etc."
)
-VSC_F(vsm_overflow, uint64_t, 0, 'g',
+VSC_F(vsm_overflow, uint64_t, 0, 'g', diag,
"Overflow VSM space",
"Number of bytes which does not fit"
" in the shared memory used to communicate"
" with tools like varnishstat, varnishlog etc."
)
-VSC_F(vsm_overflowed, uint64_t, 0, 'c',
+VSC_F(vsm_overflowed, uint64_t, 0, 'c', diag,
"Overflowed VSM space",
"Total number of bytes which did not fit"
" in the shared memory used to communicate"
diff --git a/include/tbl/vsc_fields.h b/include/tbl/vsc_fields.h
index 017398f..85fe2e4 100644
--- a/include/tbl/vsc_fields.h
+++ b/include/tbl/vsc_fields.h
@@ -28,7 +28,7 @@
*
* Definition of all shared memory statistics below.
*
- * Fields (n, t, l, f, e, d):
+ * Fields (n, t, l, f, v, e, d):
* n - Name: Field name, in C-source and stats programs
* t - Type: C-type, uint64_t, unless marked in 'f'
* l - Local: Local counter in worker thread.
@@ -38,6 +38,7 @@
* 'c' - Counter, never decreases.
* 'g' - Gauge, goes up and down
* 'i' - Integer (deprecated, use 'g')
+ * v - Verbosity: Counter verbosity level (see vsc_levels.h)
* e - Explantion: Short explanation of field (for screen use)
* d - Description: Long explanation of field (for doc use)
*
@@ -61,32 +62,32 @@
#ifdef VSC_DO_MGT
-VSC_F(uptime, uint64_t, 0, 'c',
+VSC_F(uptime, uint64_t, 0, 'c', info,
"Management process uptime",
"Uptime in seconds of the management process"
)
-VSC_F(child_start, uint64_t, 0, 'c',
+VSC_F(child_start, uint64_t, 0, 'c', diag,
"Child process started",
"Number of times the child process has been started"
)
-VSC_F(child_exit, uint64_t, 0, 'c',
+VSC_F(child_exit, uint64_t, 0, 'c', diag,
"Child process normal exit",
"Number of times the child process has been cleanly stopped"
)
-VSC_F(child_stop, uint64_t, 0, 'c',
+VSC_F(child_stop, uint64_t, 0, 'c', diag,
"Child process unexpected exit",
"Number of times the child process has exited with an unexpected"
" return code"
)
-VSC_F(child_died, uint64_t, 0, 'c',
+VSC_F(child_died, uint64_t, 0, 'c', diag,
"Child process died (signal)",
"Number of times the child process has died due to signals"
)
-VSC_F(child_dump, uint64_t, 0, 'c',
+VSC_F(child_dump, uint64_t, 0, 'c', diag,
"Child process core dumped",
"Number of times the child process has produced core dumps"
)
-VSC_F(child_panic, uint64_t, 0, 'c',
+VSC_F(child_panic, uint64_t, 0, 'c', diag,
"Child process panic",
"Number of times the management process has caught a child panic"
)
@@ -97,15 +98,15 @@ VSC_F(child_panic, uint64_t, 0, 'c',
#ifdef VSC_DO_LCK
-VSC_F(creat, uint64_t, 0, 'a',
+VSC_F(creat, uint64_t, 0, 'a', debug,
"Created locks",
""
)
-VSC_F(destroy, uint64_t, 0, 'a',
+VSC_F(destroy, uint64_t, 0, 'a', debug,
"Destroyed locks",
""
)
-VSC_F(locks, uint64_t, 0, 'a',
+VSC_F(locks, uint64_t, 0, 'a', debug,
"Lock Operations",
""
)
@@ -117,31 +118,31 @@ VSC_F(locks, uint64_t, 0, 'a',
*/
#if defined(VSC_DO_SMA) || defined (VSC_DO_SMF)
-VSC_F(c_req, uint64_t, 0, 'a',
+VSC_F(c_req, uint64_t, 0, 'a', info,
"Allocator requests",
""
)
-VSC_F(c_fail, uint64_t, 0, 'a',
+VSC_F(c_fail, uint64_t, 0, 'a', info,
"Allocator failures",
""
)
-VSC_F(c_bytes, uint64_t, 0, 'a',
+VSC_F(c_bytes, uint64_t, 0, 'a', info,
"Bytes allocated",
""
)
-VSC_F(c_freed, uint64_t, 0, 'a',
+VSC_F(c_freed, uint64_t, 0, 'a', info,
"Bytes freed",
""
)
-VSC_F(g_alloc, uint64_t, 0, 'i',
+VSC_F(g_alloc, uint64_t, 0, 'i', info,
"Allocations outstanding",
""
)
-VSC_F(g_bytes, uint64_t, 0, 'i',
+VSC_F(g_bytes, uint64_t, 0, 'i', info,
"Bytes outstanding",
""
)
-VSC_F(g_space, uint64_t, 0, 'i',
+VSC_F(g_space, uint64_t, 0, 'i', info,
"Bytes available",
""
)
@@ -157,15 +158,15 @@ VSC_F(g_space, uint64_t, 0, 'i',
/**********************************************************************/
#ifdef VSC_DO_SMF
-VSC_F(g_smf, uint64_t, 0, 'i',
+VSC_F(g_smf, uint64_t, 0, 'i', info,
"N struct smf",
""
)
-VSC_F(g_smf_frag, uint64_t, 0, 'i',
+VSC_F(g_smf_frag, uint64_t, 0, 'i', info,
"N small free smf",
""
)
-VSC_F(g_smf_large, uint64_t, 0, 'i',
+VSC_F(g_smf_large, uint64_t, 0, 'i', info,
"N large free smf",
""
)
@@ -175,11 +176,11 @@ VSC_F(g_smf_large, uint64_t, 0, 'i',
#ifdef VSC_DO_VBE
-VSC_F(vcls, uint64_t, 0, 'i',
+VSC_F(vcls, uint64_t, 0, 'i', debug,
"VCL references",
""
)
-VSC_F(happy, uint64_t, 0, 'b',
+VSC_F(happy, uint64_t, 0, 'b', info,
"Happy health probes",
""
)
@@ -189,47 +190,47 @@ VSC_F(happy, uint64_t, 0, 'b',
/**********************************************************************/
#ifdef VSC_DO_MEMPOOL
-VSC_F(live, uint64_t, 0, 'g',
+VSC_F(live, uint64_t, 0, 'g', debug,
"In use",
""
)
-VSC_F(pool, uint64_t, 0, 'g',
+VSC_F(pool, uint64_t, 0, 'g', debug,
"In Pool",
""
)
-VSC_F(sz_wanted, uint64_t, 0, 'g',
+VSC_F(sz_wanted, uint64_t, 0, 'g', debug,
"Size requested",
""
)
-VSC_F(sz_needed, uint64_t, 0, 'g',
+VSC_F(sz_needed, uint64_t, 0, 'g', debug,
"Size allocated",
""
)
-VSC_F(allocs, uint64_t, 0, 'c',
+VSC_F(allocs, uint64_t, 0, 'c', debug,
"Allocations",
""
)
-VSC_F(frees, uint64_t, 0, 'c',
+VSC_F(frees, uint64_t, 0, 'c', debug,
"Frees",
""
)
-VSC_F(recycle, uint64_t, 0, 'c',
+VSC_F(recycle, uint64_t, 0, 'c', debug,
"Recycled from pool",
""
)
-VSC_F(timeout, uint64_t, 0, 'c',
+VSC_F(timeout, uint64_t, 0, 'c', debug,
"Timed out from pool",
""
)
-VSC_F(toosmall, uint64_t, 0, 'c',
+VSC_F(toosmall, uint64_t, 0, 'c', debug,
"Too small to recycle",
""
)
-VSC_F(surplus, uint64_t, 0, 'c',
+VSC_F(surplus, uint64_t, 0, 'c', debug,
"Too many for pool",
""
)
-VSC_F(randry, uint64_t, 0, 'c',
+VSC_F(randry, uint64_t, 0, 'c', debug,
"Pool ran dry",
""
)
diff --git a/include/tbl/vsc_levels.h b/include/tbl/vsc_levels.h
new file mode 100644
index 0000000..9471a9a
--- /dev/null
+++ b/include/tbl/vsc_levels.h
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2006 Verdens Gang AS
+ * Copyright (c) 2006-2013 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Martin Blix Grydeland <martin at 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.
+ */
+
+/*
+ * Fields (v, l, e, d):
+ * v - Verbosity lvl: Field name, in C-source
+ * l - Label: Display name, in stats programs
+ * e - Explanation: Short description of this counter type
+ * d - Description: Long description of this counter type
+ */
+
+VSC_LEVEL_F(info, "INFO", "Informational counters",
+ "Counters giving runtime information")
+VSC_LEVEL_F(diag, "DIAG", "Diagnostic counters",
+ "Counters giving diagnostic information")
+VSC_LEVEL_F(debug, "DEBUG", "Debug counters",
+ "Counters giving Varnish internals debug information")
diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h
index 4d21be2..9aefac2 100644
--- a/include/vapi/vsc.h
+++ b/include/vapi/vsc.h
@@ -71,11 +71,19 @@ struct VSC_C_main *VSC_Main(struct VSM_data *vd);
* returns NULL until child has been started.
*/
+struct VSC_level_desc;
struct VSC_type_desc;
struct VSC_section;
struct VSC_desc;
struct VSC_point;
+struct VSC_level_desc {
+ unsigned verbosity;
+ const char *label; /* label */
+ const char *sdesc; /* short description */
+ const char *ldesc; /* long description */
+};
+
struct VSC_type_desc {
const char *label; /* label */
const char *sdesc; /* short description */
@@ -95,6 +103,7 @@ struct VSC_desc {
int flag; /* 'c' = counter, 'g' = gauge */
const char *sdesc; /* short description */
const char *ldesc; /* long description */
+ const struct VSC_level_desc *level;
};
struct VSC_point {
@@ -150,17 +159,24 @@ int VSC_IterValid(struct VSM_data *vd);
* 1: fantom is still the same.
*/
+const struct VSC_level_desc *VSC_LevelDesc(unsigned level);
+
/**********************************************************************
* Precompiled VSC_type_desc's and VSC_desc's for all know VSCs.
*/
+#define VSC_LEVEL_F(v,l,e,d) \
+ extern const struct VSC_level_desc VSC_level_desc_##v;
+#include "tbl/vsc_levels.h"
+#undef VSC_LEVEL_F
+
#define VSC_TYPE_F(n,t,l,e,d) \
extern const struct VSC_type_desc VSC_type_desc_##n;
#include "tbl/vsc_types.h"
#undef VSC_TYPE_F
#define VSC_DO(U,l,t) extern const struct VSC_desc VSC_desc_##l[];
-#define VSC_F(n,t,l,f,d,e)
+#define VSC_F(n,t,l,f,v,d,e)
#define VSC_DONE(U,l,t)
#include "tbl/vsc_all.h"
#undef VSC_DO
diff --git a/include/vapi/vsc_int.h b/include/vapi/vsc_int.h
index 2109379..3583d2b 100644
--- a/include/vapi/vsc_int.h
+++ b/include/vapi/vsc_int.h
@@ -30,6 +30,15 @@
#define VSC_CLASS "Stat"
+/* vsc levels */
+enum VSC_level_e {
+#define VSC_LEVEL_F(v,l,e,d) \
+ VSC_level_##v,
+#include "tbl/vsc_levels.h"
+#undef VSC_LEVEL_F
+ VSC_level_MAX,
+};
+
/* Forward declare the static vsc type names */
#define VSC_TYPE_F(n,t,l,e,d) extern const char *VSC_type_##n;
#include "tbl/vsc_types.h"
@@ -37,7 +46,7 @@
/* Define the vsc type structs */
#define VSC_DO(u,l,t) struct VSC_C_##l {
-#define VSC_F(n,t,l,f,e,d) t n;
+#define VSC_F(n,t,l,f,v,e,d) t n;
#define VSC_DONE(u,l,t) };
#include "tbl/vsc_all.h"
#undef VSC_DO
diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map
index 6892b86..34a851d 100644
--- a/lib/libvarnishapi/libvarnishapi.map
+++ b/lib/libvarnishapi/libvarnishapi.map
@@ -94,5 +94,6 @@ LIBVARNISHAPI_1.3 {
VSC_MgtValid;
VSC_MainValid;
VSC_IterValid;
+ VSC_LevelDesc;
# Variables:
} LIBVARNISHAPI_1.0;
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index fc35d28..97fc953 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -340,7 +340,7 @@ vsc_add_pt(struct vsc *vsc, const volatile void *ptr,
CHECK_OBJ_NOTNULL(vsc, VSC_MAGIC); \
st = vf->fantom.b;
-#define VSC_F(nn,tt,ll,ff,dd,ee) \
+#define VSC_F(nn,tt,ll,ff,vv,dd,ee) \
vsc_add_pt(vsc, &st->nn, descs++, vf);
#define VSC_DONE(U,l,t) \
@@ -390,7 +390,7 @@ vsc_build_pt_list(struct VSM_data *vd)
CHECK_OBJ_NOTNULL(vf, VSC_VF_MAGIC); \
if (!strcmp(vf->fantom.type, t)) \
iter_##l(vsc, VSC_desc_##l, vf);
-#define VSC_F(n,t,l,f,d,e)
+#define VSC_F(n,t,l,f,v,d,e)
#define VSC_DONE(a,b,c)
#include "tbl/vsc_all.h"
#undef VSC_DO
@@ -519,10 +519,30 @@ VSC_IterValid(struct VSM_data *vd)
return (v);
}
+const struct VSC_level_desc *
+VSC_LevelDesc(unsigned level)
+{
+ switch (level) {
+#define VSC_LEVEL_F(v,l,e,d) \
+ case VSC_level_##v: \
+ return (&VSC_level_desc_##v);
+#include "tbl/vsc_levels.h"
+#undef VSC_LEVEL_F
+ default:
+ return (NULL);
+ }
+}
+
/*--------------------------------------------------------------------
- * Build the static type and point descriptions
+ * Build the static level, type and point descriptions
*/
+#define VSC_LEVEL_F(v,l,e,d) \
+ const struct VSC_level_desc VSC_level_desc_##v = \
+ {VSC_level_##v, l, e, d};
+#include "tbl/vsc_levels.h"
+#undef VSC_LEVEL_F
+
#define VSC_TYPE_F(n,t,l,e,d) const char *VSC_type_##n = t;
#include "tbl/vsc_types.h"
#undef VSC_TYPE_F
@@ -533,7 +553,7 @@ VSC_IterValid(struct VSM_data *vd)
#undef VSC_TYPE_F
#define VSC_DO(U,l,t) const struct VSC_desc VSC_desc_##l[] = {
-#define VSC_F(n,t,l,f,d,e) {#n,#t,f,d,e},
+#define VSC_F(n,t,l,f,v,d,e) {#n,#t,f,d,e,&VSC_level_desc_##v},
#define VSC_DONE(U,l,t) };
#include "tbl/vsc_all.h"
#undef VSC_DO
diff --git a/man/vsc2rst.c b/man/vsc2rst.c
index 4ea94be..d79453b 100644
--- a/man/vsc2rst.c
+++ b/man/vsc2rst.c
@@ -3,8 +3,17 @@
#include <stdio.h>
-#define P(x, ...) printf(x "\n", ##__VA_ARGS__)
-#define VSC_F(n, t, l, f, e, d) printf("%s – %s\n\t%s\n\n", #n, e, d);
+#define VSC_LEVEL_F(v,l,e,d) \
+ static const char VSC_level_##v[] = l;
+#include "tbl/vsc_levels.h"
+#undef VSC_LEVEL_F
+
+#define P(x, ...) \
+ printf(x "\n", ##__VA_ARGS__)
+#define VSC_LEVEL_F(v,l,e,d) \
+ printf("%s – %s\n\t%s\n\n", l, e, d);
+#define VSC_F(n, t, l, f, v, e, d) \
+ printf("%s – %s (%s)\n\t%s\n\n", #n, e, VSC_level_##v, d);
int main(int argc, char **argv)
{
@@ -25,6 +34,12 @@ int main(int argc, char **argv)
P(":Manual section: 7");
P("");
+ P("COUNTER LEVELS");
+ P("==============");
+ P("");
+#include "tbl/vsc_levels.h"
+
+ P("");
P("MAIN COUNTERS");
P("=============");
P("");
More information about the varnish-commit
mailing list