From 6c639523dec1b3197a69ec59660e7ca45b2eb7e0 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 11 Sep 2006 08:58:42 +0000 Subject: [PATCH] Save more time() calls git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@953 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_center.c | 4 ++-- varnish-cache/bin/varnishd/cache_session.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index aa4e5017..94dca2a3 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -251,7 +251,7 @@ struct sess { 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; diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index 440f2ede..838d5665 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -104,8 +104,8 @@ cnt_done(struct sess *sp) 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); diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index 2937fc2c..01c55e89 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -72,7 +72,7 @@ SES_RefSrcAddr(struct sess *sp) 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 @@ SES_Charge(struct sess *sp) 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 @@ SES_Delete(struct sess *sp) 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) { -- 2.39.5