]> err.no Git - varnish/commitdiff
Save more time() calls
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 11 Sep 2006 08:58:42 +0000 (08:58 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 11 Sep 2006 08:58:42 +0000 (08:58 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@953 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_session.c

index aa4e501744d932ef816795ff34cd14ef1495edfa..94dca2a3fc0d886ded8f05b3971e8265e5f6a906 100644 (file)
@@ -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;
index 440f2edec0f4fc88be785f1105becb41a9407c88..838d5665b43168e545b2653643f74af34caeb4e5 100644 (file)
@@ -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);
index 2937fc2c029fc52185146d2f23d366942e9513d4..01c55e89f54644f3ba83b2870b2850b21e704a11 100644 (file)
@@ -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) {