r953 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Sep 11 10:58:42 CEST 2006


Author: phk
Date: 2006-09-11 10:58:42 +0200 (Mon, 11 Sep 2006)
New Revision: 953

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_session.c
Log:
Save more time() calls


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-09-11 08:53:53 UTC (rev 952)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-09-11 08:58:42 UTC (rev 953)
@@ -251,7 +251,7 @@
 	struct timespec		t_open;
 	struct timespec		t_req;
 	struct timespec		t_resp;
-	struct timespec		t_idle;
+	struct timespec		t_end;
 
 	enum step		step;
 	unsigned 		handling;

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-11 08:53:53 UTC (rev 952)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2006-09-11 08:58:42 UTC (rev 953)
@@ -104,8 +104,8 @@
 	VCL_Rel(sp->vcl);
 	sp->vcl = NULL;
 
-	clock_gettime(CLOCK_REALTIME, &te);
-	sp->wrk->idle = te.tv_sec;
+	clock_gettime(CLOCK_REALTIME, &sp->t_end);
+	sp->wrk->idle = sp->t_end.tv_sec;
 	dh = cnt_dt(&sp->t_open, &sp->t_req);
 	dp = cnt_dt(&sp->t_req, &sp->t_resp);
 	da = cnt_dt(&sp->t_resp, &te);

Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c	2006-09-11 08:53:53 UTC (rev 952)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c	2006-09-11 08:58:42 UTC (rev 953)
@@ -72,7 +72,7 @@
 	u = crc32_2s(sp->addr, "");
 	v = u % CLIENT_HASH;
 	ch = &srcaddr_hash[v];
-	now = time(NULL);
+	now = sp->t_open.tv_sec;
 
 	LOCK(&ses_mtx);
 	c3 = NULL;
@@ -150,7 +150,7 @@
 	LOCK(&stat_mtx);
 	ses_sum_acct(b, a);
 	VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju",
-	    sp->srcaddr->addr, time(NULL) - b->first,
+	    sp->srcaddr->addr, sp->t_end.tv_sec - b->first,
 	    b->sess, b->req, b->pipe, b->pass,
 	    b->fetch, b->hdrbytes, b->bodybytes);
 	VSL_stats->s_sess += a->sess;
@@ -257,7 +257,7 @@
 	VSL_stats->n_sess--;
 	ses_relsrcaddr(sp);
 	VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju",
-	    sp->addr, sp->port, time(NULL) - b->first,
+	    sp->addr, sp->port, sp->t_end.tv_sec - b->first,
 	    b->sess, b->req, b->pipe, b->pass,
 	    b->fetch, b->hdrbytes, b->bodybytes);
 	if (sm->workspace != params->mem_workspace) { 




More information about the varnish-commit mailing list