Commit 70332b99 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a varnish "uptime" counter, which counts seconds of uptime for

the worker thread.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4519 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 63f3e291
...@@ -187,7 +187,7 @@ vca_acct(void *arg) ...@@ -187,7 +187,7 @@ vca_acct(void *arg)
struct pollfd *pfd; struct pollfd *pfd;
struct listen_sock *ls; struct listen_sock *ls;
unsigned u; unsigned u;
double now, pace; double t0, now, pace;
THR_SetName("cache-acceptor"); THR_SetName("cache-acceptor");
(void)arg; (void)arg;
...@@ -208,6 +208,7 @@ vca_acct(void *arg) ...@@ -208,6 +208,7 @@ vca_acct(void *arg)
need_test = 1; need_test = 1;
pace = 0; pace = 0;
t0 = TIM_real();
while (1) { while (1) {
#ifdef SO_SNDTIMEO_WORKS #ifdef SO_SNDTIMEO_WORKS
if (params->send_timeout != tv_sndtimeo.tv_sec) { if (params->send_timeout != tv_sndtimeo.tv_sec) {
...@@ -244,6 +245,7 @@ vca_acct(void *arg) ...@@ -244,6 +245,7 @@ vca_acct(void *arg)
TIM_sleep(pace); TIM_sleep(pace);
i = poll(pfd, heritage.nsocks, 1000); i = poll(pfd, heritage.nsocks, 1000);
now = TIM_real(); now = TIM_real();
VSL_stats->uptime = (uint64_t)(now - t0);
u = 0; u = 0;
VTAILQ_FOREACH(ls, &heritage.socks, list) { VTAILQ_FOREACH(ls, &heritage.socks, list) {
if (ls->sock < 0) if (ls->sock < 0)
......
...@@ -151,3 +151,4 @@ MAC_STAT(esi_parse, uint64_t, 0, 'a', "Objects ESI parsed (unlock)") ...@@ -151,3 +151,4 @@ MAC_STAT(esi_parse, uint64_t, 0, 'a', "Objects ESI parsed (unlock)")
MAC_STAT(esi_errors, uint64_t, 0, 'a', "ESI parse errors (unlock)") MAC_STAT(esi_errors, uint64_t, 0, 'a', "ESI parse errors (unlock)")
MAC_STAT(accept_fail, uint64_t, 0, 'a', "Accept failures") MAC_STAT(accept_fail, uint64_t, 0, 'a', "Accept failures")
MAC_STAT(client_drop_late, uint64_t, 0, 'a', "Connection dropped late") MAC_STAT(client_drop_late, uint64_t, 0, 'a', "Connection dropped late")
MAC_STAT(uptime, uint64_t, 0, 'a', "Client uptime")
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