r4970 - in trunk/varnish-cache/bin: varnishd varnishstat

phk at varnish-cache.org phk at varnish-cache.org
Thu Jun 17 10:47:20 CEST 2010


Author: phk
Date: 2010-06-17 10:47:19 +0200 (Thu, 17 Jun 2010)
New Revision: 4970

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c
   trunk/varnish-cache/bin/varnishd/cache_ban.c
   trunk/varnish-cache/bin/varnishd/cache_esi.c
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/cache_http.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
   trunk/varnish-cache/bin/varnishd/cache_response.c
   trunk/varnish-cache/bin/varnishd/cache_session.c
   trunk/varnish-cache/bin/varnishd/cache_shmlog.c
   trunk/varnish-cache/bin/varnishd/cache_vcl.c
   trunk/varnish-cache/bin/varnishd/common.h
   trunk/varnish-cache/bin/varnishd/hash_critbit.c
   trunk/varnish-cache/bin/varnishd/mgt_cli.c
   trunk/varnish-cache/bin/varnishd/mgt_shmem.c
   trunk/varnish-cache/bin/varnishd/storage_file.c
   trunk/varnish-cache/bin/varnishd/storage_synth.c
   trunk/varnish-cache/bin/varnishd/storage_umem.c
   trunk/varnish-cache/bin/varnishstat/varnishstat.c
   trunk/varnish-cache/bin/varnishstat/varnishstat.h
   trunk/varnish-cache/bin/varnishstat/varnishstat_curses.c
Log:
Rename main counter struct from VSL to VSC namespace



Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -265,19 +265,19 @@
 			TIM_sleep(pace);
 		i = poll(pfd, heritage.nsocks, 1000);
 		now = TIM_real();
-		VSL_stats->uptime = (uint64_t)(now - t0);
+		VSC_main->uptime = (uint64_t)(now - t0);
 		u = 0;
 		VTAILQ_FOREACH(ls, &heritage.socks, list) {
 			if (ls->sock < 0)
 				continue;
 			if (pfd[u++].revents == 0)
 				continue;
-			VSL_stats->client_conn++;
+			VSC_main->client_conn++;
 			l = sizeof addr_s;
 			addr = (void*)&addr_s;
 			i = accept(ls->sock, addr, &l);
 			if (i < 0) {
-				VSL_stats->accept_fail++;
+				VSC_main->accept_fail++;
 				switch (errno) {
 				case EAGAIN:
 				case ECONNABORTED:
@@ -300,7 +300,7 @@
 			sp = SES_New();
 			if (sp == NULL) {
 				AZ(close(i));
-				VSL_stats->client_drop++;
+				VSC_main->client_drop++;
 				pace += params->acceptor_sleep_incr;
 				continue;
 			}
@@ -315,7 +315,7 @@
 
 			sp->step = STP_FIRST;
 			if (WRK_QueueSession(sp)) {
-				VSL_stats->client_drop++;
+				VSC_main->client_drop++;
 				pace += params->acceptor_sleep_incr;
 			} else {
 				pace *= params->acceptor_sleep_decay;
@@ -343,7 +343,7 @@
 	case 1:
 		sp->step = STP_START;
 		if (WRK_QueueSession(sp))
-			VSL_stats->client_drop_late++;
+			VSC_main->client_drop_late++;
 		break;
 	default:
 		INCOMPL();

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -80,11 +80,11 @@
 	if (params->cache_vbe_conns) {
 		Lck_Lock(&VBE_mtx);
 		VTAILQ_INSERT_HEAD(&vbe_conns, vc, list);
-		VSL_stats->backend_unused++;
+		VSC_main->backend_unused++;
 		Lck_Unlock(&VBE_mtx);
 	} else {
 		Lck_Lock(&VBE_mtx);
-		VSL_stats->n_vbe_conn--;
+		VSC_main->n_vbe_conn--;
 		Lck_Unlock(&VBE_mtx);
 		free(vc);
 	}
@@ -212,7 +212,7 @@
 		Lck_Lock(&VBE_mtx);
 		vc = VTAILQ_FIRST(&vbe_conns);
 		if (vc != NULL) {
-			VSL_stats->backend_unused--;
+			VSC_main->backend_unused--;
 			VTAILQ_REMOVE(&vbe_conns, vc, list);
 		}
 		Lck_Unlock(&VBE_mtx);
@@ -224,7 +224,7 @@
 	vc->magic = VBE_CONN_MAGIC;
 	vc->fd = -1;
 	Lck_Lock(&VBE_mtx);
-	VSL_stats->n_vbe_conn++;
+	VSC_main->n_vbe_conn++;
 	Lck_Unlock(&VBE_mtx);
 	return (vc);
 }
@@ -335,23 +335,23 @@
 			break;
 		if (vbe_CheckFd(vc->fd)) {
 			/* XXX locking of stats */
-			VSL_stats->backend_reuse += 1;
+			VSC_main->backend_reuse += 1;
 			WSP(sp, SLT_Backend, "%d %s %s",
 			    vc->fd, sp->director->vcl_name, bp->vcl_name);
 			return (vc);
 		}
-		VSL_stats->backend_toolate++;
+		VSC_main->backend_toolate++;
 		sp->vbe = vc;
 		VBE_ClosedFd(sp);
 	}
 
 	if (!vbe_Healthy(sp->t_req, (uintptr_t)sp->objhead, bp)) {
-		VSL_stats->backend_unhealthy++;
+		VSC_main->backend_unhealthy++;
 		return (NULL);
 	}
 
 	if (bp->max_conn > 0 && bp->n_conn >= bp->max_conn) {
-		VSL_stats->backend_busy++;
+		VSC_main->backend_busy++;
 		return (NULL);
 	}
 
@@ -361,11 +361,11 @@
 	vc->fd = bes_conn_try(sp, bp);
 	if (vc->fd < 0) {
 		VBE_ReleaseConn(vc);
-		VSL_stats->backend_fail++;
+		VSC_main->backend_fail++;
 		return (NULL);
 	}
 	vc->backend = bp;
-	VSL_stats->backend_conn++;
+	VSC_main->backend_conn++;
 	WSP(sp, SLT_Backend, "%d %s %s",
 	    vc->fd, sp->director->vcl_name, bp->vcl_name);
 	return (vc);
@@ -412,7 +412,7 @@
 	 */
 	WSL_Flush(sp->wrk, 0);
 	Lck_Lock(&bp->mtx);
-	VSL_stats->backend_recycle++;
+	VSC_main->backend_recycle++;
 	VTAILQ_INSERT_HEAD(&bp->connlist, sp->vbe, list);
 	sp->vbe = NULL;
 	VBE_DropRefLocked(bp);

Modified: trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -72,7 +72,7 @@
 	free(b->ipv4);
 	free(b->ipv6);
 	FREE_OBJ(b);
-	VSL_stats->n_backend--;
+	VSC_main->n_backend--;
 }
 
 /*--------------------------------------------------------------------
@@ -253,7 +253,7 @@
 
 	VBP_Start(b, &vb->probe);
 	VTAILQ_INSERT_TAIL(&backends, b, list);
-	VSL_stats->n_backend++;
+	VSC_main->n_backend++;
 	return (b);
 }
 

Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_ban.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_ban.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -323,8 +323,8 @@
 	Lck_Lock(&ban_mtx);
 	VTAILQ_INSERT_HEAD(&ban_head, b, list);
 	ban_start = b;
-	VSL_stats->n_purge++;
-	VSL_stats->n_purge_add++;
+	VSC_main->n_purge++;
+	VSC_main->n_purge_add++;
 
 	be = VTAILQ_LAST(&ban_head, banhead);
 	if (params->purge_dups && be != b)
@@ -352,7 +352,7 @@
 	}
 	Lck_Lock(&ban_mtx);
 	be->refcount--;
-	VSL_stats->n_purge_dups += pcount;
+	VSC_main->n_purge_dups += pcount;
 	Lck_Unlock(&ban_mtx);
 }
 
@@ -379,8 +379,8 @@
 	Lck_AssertHeld(&ban_mtx);
 	b = VTAILQ_LAST(&ban_head, banhead);
 	if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) {
-		VSL_stats->n_purge--;
-		VSL_stats->n_purge_retire++;
+		VSC_main->n_purge--;
+		VSC_main->n_purge_retire++;
 		VTAILQ_REMOVE(&ban_head, b, list);
 	} else {
 		b = NULL;
@@ -455,8 +455,8 @@
 		VTAILQ_INSERT_TAIL(&b0->objcore, o->objcore, ban_list);
 		b0->refcount++;
 	}
-	VSL_stats->n_purge_obj_test++;
-	VSL_stats->n_purge_re_test += tests;
+	VSC_main->n_purge_obj_test++;
+	VSC_main->n_purge_re_test += tests;
 	Lck_Unlock(&ban_mtx);
 
 	if (b == o->ban) {	/* not banned */
@@ -629,8 +629,8 @@
 			break;
 	}
 
-	VSL_stats->n_purge++;
-	VSL_stats->n_purge_add++;
+	VSC_main->n_purge++;
+	VSC_main->n_purge_add++;
 
 	b2 = BAN_New();
 	AN(b2);

Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_esi.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_esi.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -200,7 +200,7 @@
 	char buf[256], *q;
 	txt t;
 
-	VSL_stats->esi_errors++;
+	VSC_main->esi_errors++;
 	if (i == 0)
 		i = p - ew->t.b;
 	if (i > 20) {
@@ -733,7 +733,7 @@
 	/* XXX: debugging hack */
 	hack = sp->wrk->ws->f;
 
-	VSL_stats->esi_parse++;
+	VSC_main->esi_parse++;
 	/* XXX: only if GET ? */
 	ew = eww;
 	memset(eww, 0, sizeof eww);

Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -194,7 +194,7 @@
 	if (oc->flags & OC_F_ONLRU) {	/* XXX ?? */
 		VLIST_REMOVE(oc, lru_list);
 		VLIST_INSERT_BEFORE(&lru->senteniel, oc, lru_list);
-		VSL_stats->n_lru_moved++;
+		VSC_main->n_lru_moved++;
 		retval = 1;
 	}
 	Lck_Unlock(&exp_mtx);
@@ -288,7 +288,7 @@
 			oc->flags &= ~OC_F_ONLRU;
 		}
 
-		VSL_stats->n_expired++;
+		VSC_main->n_expired++;
 
 		Lck_Unlock(&exp_mtx);
 
@@ -353,7 +353,7 @@
 		oc->flags &= ~OC_F_ONLRU;
 		binheap_delete(exp_heap, oc->timer_idx);
 		assert(oc->timer_idx == BINHEAP_NOIDX);
-		VSL_stats->n_lru_nuked++;
+		VSC_main->n_lru_nuked++;
 	}
 	Lck_Unlock(&exp_mtx);
 

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -383,7 +383,7 @@
 	WSL_Flush(w, 0);
 
 	/* XXX is this the right place? */
-	VSL_stats->backend_req++;
+	VSC_main->backend_req++;
 
 	/* Receive response */
 

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -484,7 +484,7 @@
 			 * We could not schedule the session, leave the
 			 * rest on the busy list.
 			 */
-			VSL_stats->client_drop_late++;
+			VSC_main->client_drop_late++;
 			break;
 		}
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -408,7 +408,7 @@
 			WSLH(w, fd, hp, hp->nhd);
 			hp->nhd++;
 		} else {
-			VSL_stats->losthdr++;
+			VSC_main->losthdr++;
 			WSL(w, SLT_LostHeader, fd, "%.*s", q - p, p);
 			return (400);
 		}
@@ -650,7 +650,7 @@
 		to->hdf[to->nhd] = 0;
 		to->nhd++;
 	} else  {
-		VSL_stats->losthdr++;
+		VSC_main->losthdr++;
 		WSLR(w, SLT_LostHeader, fd, fm->hd[n]);
 	}
 }
@@ -759,7 +759,7 @@
 			hp->hd[u].e = p + l;
 		} else {
 			/* XXX This leaves a slot empty */
-			VSL_stats->losthdr++;
+			VSC_main->losthdr++;
 			WSLR(w, SLT_LostHeader, fd, hp->hd[u]);
 			hp->hd[u].b = NULL;
 			hp->hd[u].e = NULL;
@@ -787,7 +787,7 @@
 
 	CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
 	if (to->nhd >= to->shd) {
-		VSL_stats->losthdr++;
+		VSC_main->losthdr++;
 		WSL(w, SLT_LostHeader, fd, "%s", hdr);
 		return;
 	}
@@ -859,7 +859,7 @@
 	n = vsnprintf(to->ws->f, l, fmt, ap);
 	va_end(ap);
 	if (n + 1 >= l || to->nhd >= to->shd) {
-		VSL_stats->losthdr++;
+		VSC_main->losthdr++;
 		WSL(w, SLT_LostHeader, fd, "%s", to->ws->f);
 		WS_Release(to->ws, 0);
 	} else {

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -95,7 +95,7 @@
 
 	Lck_AssertHeld(&wstat_mtx);
 #define L0(n)
-#define L1(n) (VSL_stats->n += w->stats.n)
+#define L1(n) (VSC_main->n += w->stats.n)
 #define VSC_F_MAIN(n, t, l, f, d) L##l(n);
 #include "vsc_fields.h"
 #undef VSC_F_MAIN
@@ -445,10 +445,10 @@
 		for (u = 0; u < nwq; u++)
 			wrk_decimate_flock(wq[u], t_idle, vs);
 
-		VSL_stats->n_wrk= vs->n_wrk;
-		VSL_stats->n_wrk_queue = vs->n_wrk_queue;
-		VSL_stats->n_wrk_drop = vs->n_wrk_drop;
-		VSL_stats->n_wrk_overflow = vs->n_wrk_overflow;
+		VSC_main->n_wrk= vs->n_wrk;
+		VSC_main->n_wrk_queue = vs->n_wrk_queue;
+		VSC_main->n_wrk_drop = vs->n_wrk_drop;
+		VSC_main->n_wrk_overflow = vs->n_wrk_overflow;
 
 		TIM_sleep(params->wthread_purge_delay * 1e-3);
 	}
@@ -472,15 +472,15 @@
 	    (qp->nqueue > params->wthread_add_threshold && /* more needed */
 	    qp->nqueue > qp->lqueue)) {	/* not getting better since last */
 		if (qp->nthr >= nthr_max) {
-			VSL_stats->n_wrk_max++;
+			VSC_main->n_wrk_max++;
 		} else if (pthread_create(&tp, tp_attr, wrk_thread, qp)) {
 			VSL(SLT_Debug, 0, "Create worker thread failed %d %s",
 			    errno, strerror(errno));
-			VSL_stats->n_wrk_failed++;
+			VSC_main->n_wrk_failed++;
 			TIM_sleep(params->wthread_fail_delay * 1e-3);
 		} else {
 			AZ(pthread_detach(tp));
-			VSL_stats->n_wrk_create++;
+			VSC_main->n_wrk_create++;
 			TIM_sleep(params->wthread_add_delay * 1e-3);
 		}
 	}

Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -343,12 +343,12 @@
 		 */
 		if (st->fd >= 0 &&
 		    st->len >= params->sendfile_threshold) {
-			VSL_stats->n_objsendfile++;
+			VSC_main->n_objsendfile++;
 			WRW_Sendfile(sp->wrk, st->fd, st->where + off, len);
 			continue;
 		}
 #endif /* SENDFILE_WORKS */
-		VSL_stats->n_objwrite++;
+		VSC_main->n_objwrite++;
 		(void)WRW_Write(sp->wrk, st->ptr + off, len);
 	}
 	assert(u == sp->obj->len);

Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -107,7 +107,7 @@
 	volatile unsigned nhttp;
 	unsigned l, hl;
 
-	if (VSL_stats->n_sess_mem >= params->max_sess)
+	if (VSC_main->n_sess_mem >= params->max_sess)
 		return (NULL);
 	/*
 	 * It is not necessary to lock these, but we need to
@@ -124,7 +124,7 @@
 	q = p + l;
 
 	Lck_Lock(&stat_mtx);
-	VSL_stats->n_sess_mem++;
+	VSC_main->n_sess_mem++;
 	Lck_Unlock(&stat_mtx);
 
 	/* Don't waste time zeroing the workspace */
@@ -216,7 +216,7 @@
 		CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	}
 
-	VSL_stats->n_sess++;		/* XXX: locking  ? */
+	VSC_main->n_sess++;		/* XXX: locking  ? */
 
 	return (sp);
 }
@@ -256,7 +256,7 @@
 
 	AZ(sp->obj);
 	AZ(sp->vcl);
-	VSL_stats->n_sess--;			/* XXX: locking ? */
+	VSC_main->n_sess--;			/* XXX: locking ? */
 	assert(!isnan(b->first));
 	assert(!isnan(sp->t_end));
 	VSL(SLT_StatSess, sp->id, "%s %s %.0f %ju %ju %ju %ju %ju %ju %ju",
@@ -265,7 +265,7 @@
 	    b->fetch, b->hdrbytes, b->bodybytes);
 	if (sm->workspace != params->sess_workspace) {
 		Lck_Lock(&stat_mtx);
-		VSL_stats->n_sess_mem--;
+		VSC_main->n_sess_mem--;
 		Lck_Unlock(&stat_mtx);
 		free(sm);
 	} else {
@@ -277,7 +277,7 @@
 	}
 
 	/* Try to precreate some ses-mem so the acceptor will not have to */
-	if (VSL_stats->n_sess_mem < VSL_stats->n_sess + 10) {
+	if (VSC_main->n_sess_mem < VSC_main->n_sess + 10) {
 		sm = ses_sm_alloc();
 		if (sm != NULL) {
 			ses_setup(sm);

Modified: trunk/varnish-cache/bin/varnishd/cache_shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_shmlog.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_shmlog.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -84,7 +84,7 @@
 		*vsl_ptr = VSL_WRAPMARKER;
 		vsl_ptr = vsl_start + 1;
 	}
-	VSL_stats->shm_cycles++;
+	VSC_main->shm_cycles++;
 }
 
 /*--------------------------------------------------------------------
@@ -98,14 +98,14 @@
 
 	if (pthread_mutex_trylock(&vsl_mtx)) {
 		AZ(pthread_mutex_lock(&vsl_mtx));
-		VSL_stats->shm_cont++;
+		VSC_main->shm_cont++;
 	}
 	assert(vsl_ptr < vsl_end);
 	assert(((uintptr_t)vsl_ptr & 0x3) == 0);
 
-	VSL_stats->shm_writes++;
-	VSL_stats->shm_flushes += flushes;
-	VSL_stats->shm_records += records;
+	VSC_main->shm_writes++;
+	VSC_main->shm_flushes += flushes;
+	VSC_main->shm_records += records;
 
 	/* Wrap if necessary */
 	if (VSL_END(vsl_ptr, len) >= vsl_end)
@@ -289,6 +289,6 @@
 	vsl_wrap();
 	vsm_head->starttime = (intmax_t)TIM_real();
 	vsm_head->panicstr[0] = '\0';
-	memset(VSL_stats, 0, sizeof *VSL_stats);
+	memset(VSC_main, 0, sizeof *VSC_main);
 	vsm_head->child_pid = getpid();
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vcl.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/cache_vcl.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -180,8 +180,8 @@
 	Lck_Unlock(&vcl_mtx);
 	cli_out(cli, "Loaded \"%s\" as \"%s\"", fn , name);
 	vcl->conf->init_func(cli);
-	VSL_stats->n_vcl++;
-	VSL_stats->n_vcl_avail++;
+	VSC_main->n_vcl++;
+	VSC_main->n_vcl_avail++;
 	return (0);
 }
 
@@ -203,8 +203,8 @@
 	free(vcl->name);
 	(void)dlclose(vcl->dlh);
 	FREE_OBJ(vcl);
-	VSL_stats->n_vcl--;
-	VSL_stats->n_vcl_discard--;
+	VSC_main->n_vcl--;
+	VSC_main->n_vcl_discard--;
 }
 
 /*--------------------------------------------------------------------*/
@@ -278,8 +278,8 @@
 		cli_out(cli, "VCL %s is the active VCL", av[2]);
 		return;
 	}
-	VSL_stats->n_vcl_discard++;
-	VSL_stats->n_vcl_avail--;
+	VSC_main->n_vcl_discard++;
+	VSC_main->n_vcl_avail--;
 	vcl->conf->discard = 1;
 	Lck_Unlock(&vcl_mtx);
 	if (vcl->conf->busy == 0)

Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/common.h	2010-06-17 08:47:19 UTC (rev 4970)
@@ -39,7 +39,7 @@
 void VCA_tweak_waiter(struct cli *cli, const char *arg);
 
 /* mgt_shmem.c */
-extern struct vsc_main *VSL_stats;
+extern struct vsc_main *VSC_main;
 
 /* varnishd.c */
 struct vsb;

Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/hash_critbit.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -437,19 +437,19 @@
 			}
 			AN(sp->wrk->nhashpriv);
 			Lck_Lock(&hcb_mtx);
-			VSL_stats->hcb_lock++;
+			VSC_main->hcb_lock++;
 			assert(noh->refcnt == 1);
 			oh = hcb_insert(sp->wrk, &hcb_root, noh, 1);
 			Lck_Unlock(&hcb_mtx);
 		} else {
-			VSL_stats->hcb_nolock++;
+			VSC_main->hcb_nolock++;
 			oh = hcb_insert(sp->wrk, &hcb_root, noh, 0);
 		}
 
 		if (oh != NULL && oh == noh) {
 			/* Assert that we only muck with the tree with a lock */
 			assert(with_lock);
-			VSL_stats->hcb_insert++;
+			VSC_main->hcb_insert++;
 			assert(oh->refcnt > 0);
 			return (oh);
 		}

Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -80,10 +80,10 @@
 	(void)av;
 	(void)priv;
 
-	AN(VSL_stats);
+	AN(VSC_main);
 #define VSC_F_MAIN(n, t, l, f, d) \
-	if (VSL_stats->n != 0) \
-	    cli_out(cli, "%12ju  %s\n", (VSL_stats->n), d);
+	if (VSC_main->n != 0) \
+	    cli_out(cli, "%12ju  %s\n", (VSC_main->n), d);
 #include "vsc_fields.h"
 #undef VSC_F_MAIN
 }

Modified: trunk/varnish-cache/bin/varnishd/mgt_shmem.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_shmem.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/mgt_shmem.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -113,7 +113,7 @@
 #define MAP_NOSYNC 0 /* XXX Linux */
 #endif
 
-struct vsc_main	*VSL_stats;
+struct vsc_main	*VSC_main;
 
 static int vsl_fd = -1;
 
@@ -288,9 +288,9 @@
 
 	vsm_end = (void*)((uint8_t*)vsm_head + size);
 
-	VSL_stats = VSM_Alloc(sizeof *VSL_stats,
+	VSC_main = VSM_Alloc(sizeof *VSC_main,
 	    VSC_CLASS, VSC_TYPE_MAIN, "");
-	AN(VSL_stats);
+	AN(VSC_main);
 
 	pp = VSM_Alloc(sizeof *pp, VSM_CLASS_PARAM, "", "");
 	AN(pp);

Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -181,9 +181,9 @@
 	b = sp->size / sc->pagesize;
 	if (b >= NBUCKET) {
 		b = NBUCKET - 1;
-		VSL_stats->n_smf_large++;
+		VSC_main->n_smf_large++;
 	} else {
-		VSL_stats->n_smf_frag++;
+		VSC_main->n_smf_frag++;
 	}
 	sp->flist = &sc->free[b];
 	ns = b * sc->pagesize;
@@ -211,9 +211,9 @@
 	b = sp->size / sc->pagesize;
 	if (b >= NBUCKET) {
 		b = NBUCKET - 1;
-		VSL_stats->n_smf_large--;
+		VSC_main->n_smf_large--;
 	} else {
-		VSL_stats->n_smf_frag--;
+		VSC_main->n_smf_frag--;
 	}
 	assert(sp->flist == &sc->free[b]);
 	VTAILQ_REMOVE(sp->flist, sp, status);
@@ -259,7 +259,7 @@
 	/* Split from front */
 	sp2 = malloc(sizeof *sp2);
 	XXXAN(sp2);
-	VSL_stats->n_smf++;
+	VSC_main->n_smf++;
 	*sp2 = *sp;
 
 	sp->offset += bytes;
@@ -301,7 +301,7 @@
 		VTAILQ_REMOVE(&sc->order, sp2, order);
 		remfree(sc, sp2);
 		free(sp2);
-		VSL_stats->n_smf--;
+		VSC_main->n_smf--;
 	}
 
 	sp2 = VTAILQ_PREV(sp, smfhead, order);
@@ -313,7 +313,7 @@
 		sp2->size += sp->size;
 		VTAILQ_REMOVE(&sc->order, sp, order);
 		free(sp);
-		VSL_stats->n_smf--;
+		VSC_main->n_smf--;
 		sp = sp2;
 	}
 
@@ -338,7 +338,7 @@
 	CHECK_OBJ_NOTNULL(sp, SMF_MAGIC);
 	sp2 = malloc(sizeof *sp2);
 	XXXAN(sp2);
-	VSL_stats->n_smf++;
+	VSC_main->n_smf++;
 	*sp2 = *sp;
 
 	sp2->size -= bytes;
@@ -364,7 +364,7 @@
 	XXXAN(sp);
 	sp->magic = SMF_MAGIC;
 	sp->s.magic = STORAGE_MAGIC;
-	VSL_stats->n_smf++;
+	VSC_main->n_smf++;
 
 	sp->sc = sc;
 	sp->size = len;
@@ -450,7 +450,7 @@
 	if (sum < MINPAGES * (off_t)getpagesize())
 		exit (2);
 
-	VSL_stats->sm_bfree += sc->filesize;
+	VSC_main->sm_bfree += sc->filesize;
 }
 
 /*--------------------------------------------------------------------*/
@@ -466,16 +466,16 @@
 	size += (sc->pagesize - 1);
 	size &= ~(sc->pagesize - 1);
 	Lck_Lock(&sc->mtx);
-	VSL_stats->sm_nreq++;
+	VSC_main->sm_nreq++;
 	smf = alloc_smf(sc, size);
 	if (smf == NULL) {
 		Lck_Unlock(&sc->mtx);
 		return (NULL);
 	}
 	CHECK_OBJ_NOTNULL(smf, SMF_MAGIC);
-	VSL_stats->sm_nobj++;
-	VSL_stats->sm_balloc += smf->size;
-	VSL_stats->sm_bfree -= smf->size;
+	VSC_main->sm_nobj++;
+	VSC_main->sm_balloc += smf->size;
+	VSC_main->sm_bfree -= smf->size;
 	Lck_Unlock(&sc->mtx);
 	CHECK_OBJ_NOTNULL(&smf->s, STORAGE_MAGIC);	/*lint !e774 */
 	XXXAN(smf);
@@ -509,8 +509,8 @@
 	size &= ~(sc->pagesize - 1);
 	if (smf->size > size) {
 		Lck_Lock(&sc->mtx);
-		VSL_stats->sm_balloc -= (smf->size - size);
-		VSL_stats->sm_bfree += (smf->size - size);
+		VSC_main->sm_balloc -= (smf->size - size);
+		VSC_main->sm_bfree += (smf->size - size);
 		trim_smf(smf, size);
 		assert(smf->size == size);
 		Lck_Unlock(&sc->mtx);
@@ -531,9 +531,9 @@
 	CAST_OBJ_NOTNULL(smf, s->priv, SMF_MAGIC);
 	sc = smf->sc;
 	Lck_Lock(&sc->mtx);
-	VSL_stats->sm_nobj--;
-	VSL_stats->sm_balloc -= smf->size;
-	VSL_stats->sm_bfree += smf->size;
+	VSC_main->sm_nobj--;
+	VSC_main->sm_balloc -= smf->size;
+	VSC_main->sm_bfree += smf->size;
 	free_smf(smf);
 	Lck_Unlock(&sc->mtx);
 }

Modified: trunk/varnish-cache/bin/varnishd/storage_synth.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_synth.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/storage_synth.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -52,9 +52,9 @@
 
 	CHECK_OBJ_NOTNULL(sto, STORAGE_MAGIC);
 	Lck_Lock(&sms_mtx);
-	VSL_stats->sms_nobj--;
-	VSL_stats->sms_nbytes -= sto->len;
-	VSL_stats->sms_bfree += sto->len;
+	VSC_main->sms_nobj--;
+	VSC_main->sms_nbytes -= sto->len;
+	VSC_main->sms_bfree += sto->len;
 	Lck_Unlock(&sms_mtx);
 	vsb_delete(sto->priv);
 	free(sto);
@@ -84,8 +84,8 @@
 	obj->len = 0;
 
 	Lck_Lock(&sms_mtx);
-	VSL_stats->sms_nreq++;
-	VSL_stats->sms_nobj++;
+	VSC_main->sms_nreq++;
+	VSC_main->sms_nobj++;
 	Lck_Unlock(&sms_mtx);
 
 	sto = calloc(sizeof *sto, 1);
@@ -120,6 +120,6 @@
 	sto->len = vsb_len(vsb);
 	sto->space = vsb_len(vsb);
 	obj->len = sto->len;
-	VSL_stats->sms_nbytes += sto->len;
-	VSL_stats->sms_balloc += sto->len;
+	VSC_main->sms_nbytes += sto->len;
+	VSC_main->sms_balloc += sto->len;
 }

Modified: trunk/varnish-cache/bin/varnishd/storage_umem.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_umem.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishd/storage_umem.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -62,13 +62,13 @@
 	struct smu *smu;
 
 	Lck_Lock(&smu_mtx);
-	VSL_stats->sma_nreq++;
-	if (VSL_stats->sma_nbytes + size > smu_max)
+	VSC_main->sma_nreq++;
+	if (VSC_main->sma_nbytes + size > smu_max)
 		size = 0;
 	else {
-		VSL_stats->sma_nobj++;
-		VSL_stats->sma_nbytes += size;
-		VSL_stats->sma_balloc += size;
+		VSC_main->sma_nobj++;
+		VSC_main->sma_nbytes += size;
+		VSC_main->sma_balloc += size;
 	}
 	Lck_Unlock(&smu_mtx);
 
@@ -100,9 +100,9 @@
 	smu = s->priv;
 	assert(smu->sz == smu->s.space);
 	Lck_Lock(&smu_mtx);
-	VSL_stats->sma_nobj--;
-	VSL_stats->sma_nbytes -= smu->sz;
-	VSL_stats->sma_bfree += smu->sz;
+	VSC_main->sma_nobj--;
+	VSC_main->sma_nbytes -= smu->sz;
+	VSC_main->sma_bfree += smu->sz;
 	Lck_Unlock(&smu_mtx);
 	umem_free(smu->s.ptr, smu->s.space);
 	umem_free(smu, sizeof *smu);
@@ -121,8 +121,8 @@
 		memcpy(p, smu->s.ptr, size);
 		umem_free(smu->s.ptr, smu->s.space);
 		Lck_Lock(&smu_mtx);
-		VSL_stats->sma_nbytes -= (smu->sz - size);
-		VSL_stats->sma_bfree += smu->sz - size;
+		VSC_main->sma_nbytes -= (smu->sz - size);
+		VSC_main->sma_bfree += smu->sz - size;
 		smu->sz = size;
 		Lck_Unlock(&smu_mtx);
 		smu->s.ptr = p;

Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c
===================================================================
--- trunk/varnish-cache/bin/varnishstat/varnishstat.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishstat/varnishstat.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -121,12 +121,12 @@
 }
 
 static void
-do_once(struct VSM_data *vd, const struct vsc_main *VSL_stats)
+do_once(struct VSM_data *vd, const struct vsc_main *VSC_main)
 {
 	struct once_priv op;
 
 	memset(&op, 0, sizeof op);
-	op.up = VSL_stats->uptime;
+	op.up = VSC_main->uptime;
 	op.pad = 18;
 
 	(void)VSC_Iter(vd, do_once_cb, &op);
@@ -195,7 +195,7 @@
 {
 	int c;
 	struct VSM_data *vd;
-	const struct vsc_main *VSL_stats;
+	const struct vsc_main *VSC_main;
 	int delay = 1, once = 0, xml = 0;
 
 	vd = VSM_New();
@@ -230,14 +230,14 @@
 	if (VSC_Open(vd, 1))
 		exit(1);
 
-	VSL_stats = VSC_Main(vd);
+	VSC_main = VSC_Main(vd);
 
 	if (xml)
 		do_xml(vd);
 	else if (once)
-		do_once(vd, VSL_stats);
+		do_once(vd, VSC_main);
 	else
-		do_curses(vd, VSL_stats, delay);
+		do_curses(vd, VSC_main, delay);
 
 	exit(0);
 }

Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.h
===================================================================
--- trunk/varnish-cache/bin/varnishstat/varnishstat.h	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishstat/varnishstat.h	2010-06-17 08:47:19 UTC (rev 4970)
@@ -27,4 +27,4 @@
  *
  */
 
-void do_curses(struct VSM_data *vd, const struct vsc_main *VSL_stats, int delay);
+void do_curses(struct VSM_data *vd, const struct vsc_main *VSC_main, int delay);

Modified: trunk/varnish-cache/bin/varnishstat/varnishstat_curses.c
===================================================================
--- trunk/varnish-cache/bin/varnishstat/varnishstat_curses.c	2010-06-17 08:46:17 UTC (rev 4969)
+++ trunk/varnish-cache/bin/varnishstat/varnishstat_curses.c	2010-06-17 08:47:19 UTC (rev 4970)
@@ -123,7 +123,7 @@
 }
 
 void
-do_curses(struct VSM_data *vd, const struct vsc_main *VSL_stats,
+do_curses(struct VSM_data *vd, const struct vsc_main *VSC_main,
     int delay)
 {
 	intmax_t ju;
@@ -167,7 +167,7 @@
 			 * Break to outher loop if we need to re-read file.
 			 * Only check if it looks like nothing is happening.
 			 */
-			act = VSL_stats->cache_hit + VSL_stats->cache_miss + 1;
+			act = VSC_main->cache_hit + VSC_main->cache_miss + 1;
 			if (act == lact && VSM_ReOpen(vd, 1))
 				break;
 			lact = act;
@@ -176,15 +176,15 @@
 			tt = tv.tv_usec * 1e-6 + tv.tv_sec;
 			lt = tt - lt;
 
-			rt = VSL_stats->uptime;
+			rt = VSC_main->uptime;
 			up = rt;
 
 			AC(mvprintw(0, 0, "%*s", COLS - 1, VSM_Name(vd)));
 			AC(mvprintw(0, 0, "%d+%02d:%02d:%02d", rt / 86400,
 			    (rt % 86400) / 3600, (rt % 3600) / 60, rt % 60));
 
-			hit = VSL_stats->cache_hit;
-			miss = VSL_stats->cache_miss;
+			hit = VSC_main->cache_hit;
+			miss = VSC_main->cache_miss;
 			hr = (hit - lhit) / lt;
 			mr = (miss - lmiss) / lt;
 			lhit = hit;




More information about the varnish-commit mailing list