]> err.no Git - varnish/commitdiff
Use workerthres log buffer much more extensively
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 17 Sep 2006 20:26:35 +0000 (20:26 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 17 Sep 2006 20:26:35 +0000 (20:26 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1054 d4fa192b-c00b-0410-8231-f00ffab90ce4

12 files changed:
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_http.c
varnish-cache/bin/varnishd/cache_pass.c
varnish-cache/bin/varnishd/cache_pipe.c
varnish-cache/bin/varnishd/cache_response.c
varnish-cache/bin/varnishd/cache_session.c
varnish-cache/bin/varnishd/cache_vcl.c
varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/bin/varnishd/shmlog.c
varnish-cache/include/stat_field.h

index 0c261458cb2335fc2ebcaa1c635196b756d1f371..f8cd81acfab516b1dcd0821de58b006b2b8df961 100644 (file)
@@ -120,6 +120,7 @@ struct worker {
        struct acct             acct;
        unsigned char           wlog[WLOGSPACE];
        unsigned char           *wlp, *wle;
+       unsigned                wlr;
 };
 
 struct workreq {
@@ -334,13 +335,13 @@ void HTTP_Init(void);
 void http_ClrHeader(struct http *to);
 void http_CopyHttp(struct http *to, struct http *fm);
 unsigned http_Write(struct worker *w, struct http *hp, int resp);
-void http_GetReq(int fd, struct http *to, struct http *fm);
-void http_CopyReq(int fd, struct http *to, struct http *fm);
-void http_CopyResp(int fd, struct http *to, struct http *fm);
-void http_SetResp(int fd, struct http *to, const char *proto, const char *status, const char *response);
-void http_FilterHeader(int fd, struct http *to, struct http *fm, unsigned how);
-void http_PrintfHeader(int fd, struct http *to, const char *fmt, ...);
-void http_SetHeader(int fd, struct http *to, const char *hdr);
+void http_GetReq(struct worker *w, int fd, struct http *to, struct http *fm);
+void http_CopyReq(struct worker *w, int fd, struct http *to, struct http *fm);
+void http_CopyResp(struct worker *w, int fd, struct http *to, struct http *fm);
+void http_SetResp(struct worker *w, int fd, struct http *to, const char *proto, const char *status, const char *response);
+void http_FilterHeader(struct worker *w, int fd, struct http *to, struct http *fm, unsigned how);
+void http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...);
+void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr);
 int http_IsHdr(struct http_hdr *hh, char *hdr);
 void http_Setup(struct http *ht, void *space, unsigned len);
 int http_GetHdr(struct http *hp, const char *hdr, char **ptr);
index ee743523987b6aeac663edfed457ac4635040b85..3e11e50cae1e61c5306b17a7eda7062d6a420856 100644 (file)
@@ -156,6 +156,7 @@ cnt_done(struct sess *sp)
        if (sp->fd < 0) {
                VSL_stats->sess_closed++;
                sp->wrk->idle = sp->t_open.tv_sec;
+               sp->wrk = NULL;
                vca_return_session(sp);
                return (1);
        }
@@ -172,6 +173,7 @@ cnt_done(struct sess *sp)
        }
        VSL_stats->sess_herd++;
        sp->wrk->idle = sp->t_open.tv_sec;
+       sp->wrk = NULL;
        vca_return_session(sp);
        return (1);
 }
index 9c2f8583dc32eefb0b60d986a162957b12f52107..1ad353f1534a54afc2093784496bfe14153fe6dd 100644 (file)
@@ -233,8 +233,8 @@ FetchBody(struct sess *sp)
        hp = vc->http2;
        http_ClrHeader(hp);
        hp->logtag = HTTP_Obj;
-       http_CopyResp(sp->fd, hp, vc->http);
-       http_FilterHeader(sp->fd, hp, vc->http, HTTPH_A_INS);
+       http_CopyResp(sp->wrk, sp->fd, hp, vc->http);
+       http_FilterHeader(sp->wrk, sp->fd, hp, vc->http, HTTPH_A_INS);
        
        if (body) {
                if (http_GetHdr(vc->http, H_Content_Length, &b))
@@ -243,7 +243,7 @@ FetchBody(struct sess *sp)
                        cls = fetch_chunked(sp, vc->fd, vc->http);
                else 
                        cls = fetch_eof(sp, vc->fd, vc->http);
-               http_PrintfHeader(sp->fd, hp,
+               http_PrintfHeader(sp->wrk, sp->fd, hp,
                    "Content-Length: %u", sp->obj->len);
        } else
                cls = 0;
@@ -294,15 +294,15 @@ FetchHeaders(struct sess *sp)
        if (vc == NULL)
                vc = VBE_GetFd(sp->backend, sp->xid);
        XXXAN(vc);
-       VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
+       WSL(w, SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
        http_ClrHeader(vc->http);
        vc->http->logtag = HTTP_Tx;
-       http_GetReq(vc->fd, vc->http, sp->http);
-       http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_FETCH);
-       http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
+       http_GetReq(w, vc->fd, vc->http, sp->http);
+       http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_FETCH);
+       http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid);
        if (!http_GetHdr(vc->http, H_Host, &b)) {
-               http_PrintfHeader(vc->fd, vc->http, "Host: %s",
+               http_PrintfHeader(w, vc->fd, vc->http, "Host: %s",
                    sp->backend->hostname);
        }
 
index 5d671b268d3ac98b5a08f597bb2d162b061bb32d..54cdf7b069c74af1059ff22b4d8c46be5ea83ff7 100644 (file)
@@ -625,7 +625,7 @@ http_CopyHttp(struct http *to, struct http *fm)
 /*--------------------------------------------------------------------*/
 
 static void
-http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
+http_seth(struct worker *w, int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
 {
 
        assert(n < HTTP_HDR_MAX);
@@ -633,11 +633,11 @@ http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
        to->hd[n].b = (void*)(uintptr_t)fm;
        to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0');
        to->hdf[n] = 0;
-       VSLH(tag, fd, to, n);
+       WSLH(w, tag, fd, to, n);
 }
 
 static void
-http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum httptag tag)
+http_copyh(struct worker *w, int fd, struct http *to, struct http *fm, unsigned n, enum httptag tag)
 {
 
        assert(n < HTTP_HDR_MAX);
@@ -645,54 +645,54 @@ http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum httptag ta
        to->hd[n].b = fm->hd[n].b;
        to->hd[n].e = fm->hd[n].e;
        to->hdf[n] = fm->hdf[n];
-       VSLH(tag, fd, to, n);
+       WSLH(w, tag, fd, to, n);
 }
 
 void
-http_GetReq(int fd, struct http *to, struct http *fm)
+http_GetReq(struct worker *w, int fd, struct http *to, struct http *fm)
 {
 
        CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-       http_seth(fd, to, HTTP_HDR_REQ, HTTP_T_Request, "GET");
-       http_copyh(fd, to, fm, HTTP_HDR_URL, HTTP_T_URL);
-       http_seth(fd, to, HTTP_HDR_PROTO, HTTP_T_Protocol, "HTTP/1.1");
+       http_seth(w, fd, to, HTTP_HDR_REQ, HTTP_T_Request, "GET");
+       http_copyh(w, fd, to, fm, HTTP_HDR_URL, HTTP_T_URL);
+       http_seth(w, fd, to, HTTP_HDR_PROTO, HTTP_T_Protocol, "HTTP/1.1");
 }
 
 void
-http_CopyReq(int fd, struct http *to, struct http *fm)
+http_CopyReq(struct worker *w, int fd, struct http *to, struct http *fm)
 {
 
        CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-       http_copyh(fd, to, fm, HTTP_HDR_REQ, HTTP_T_Request);
-       http_copyh(fd, to, fm, HTTP_HDR_URL, HTTP_T_URL);
-       http_copyh(fd, to, fm, HTTP_HDR_PROTO, HTTP_T_Protocol);
+       http_copyh(w, fd, to, fm, HTTP_HDR_REQ, HTTP_T_Request);
+       http_copyh(w, fd, to, fm, HTTP_HDR_URL, HTTP_T_URL);
+       http_copyh(w, fd, to, fm, HTTP_HDR_PROTO, HTTP_T_Protocol);
 }
 
 
 void
-http_CopyResp(int fd, struct http *to, struct http *fm)
+http_CopyResp(struct worker *w, int fd, struct http *to, struct http *fm)
 {
 
        CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-       http_copyh(fd, to, fm, HTTP_HDR_PROTO, HTTP_T_Protocol);
-       http_copyh(fd, to, fm, HTTP_HDR_STATUS, HTTP_T_Status);
-       http_copyh(fd, to, fm, HTTP_HDR_RESPONSE, HTTP_T_Response);
+       http_copyh(w, fd, to, fm, HTTP_HDR_PROTO, HTTP_T_Protocol);
+       http_copyh(w, fd, to, fm, HTTP_HDR_STATUS, HTTP_T_Status);
+       http_copyh(w, fd, to, fm, HTTP_HDR_RESPONSE, HTTP_T_Response);
 }
 
 void
-http_SetResp(int fd, struct http *to, const char *proto, const char *status, const char *response)
+http_SetResp(struct worker *w, int fd, struct http *to, const char *proto, const char *status, const char *response)
 {
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-       http_seth(fd, to, HTTP_HDR_PROTO, HTTP_T_Protocol, proto);
-       http_seth(fd, to, HTTP_HDR_STATUS, HTTP_T_Status, status);
-       http_seth(fd, to, HTTP_HDR_RESPONSE, HTTP_T_Response, response);
+       http_seth(w, fd, to, HTTP_HDR_PROTO, HTTP_T_Protocol, proto);
+       http_seth(w, fd, to, HTTP_HDR_STATUS, HTTP_T_Status, status);
+       http_seth(w, fd, to, HTTP_HDR_RESPONSE, HTTP_T_Response, response);
 }
 
 static void
-http_copyheader(int fd, struct http *to, struct http *fm, unsigned n)
+http_copyheader(struct worker *w, int fd, struct http *to, struct http *fm, unsigned n)
 {
 
        CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
@@ -702,18 +702,18 @@ http_copyheader(int fd, struct http *to, struct http *fm, unsigned n)
        if (to->nhd < HTTP_HDR_MAX) {
                to->hd[to->nhd].b = fm->hd[n].b;
                to->hd[to->nhd].e = fm->hd[n].e;
-               VSLH(HTTP_T_Header, fd, to, to->nhd);
+               WSLH(w, HTTP_T_Header, fd, to, to->nhd);
                to->nhd++;
        } else  {
                VSL_stats->losthdr++;
-               VSLH(HTTP_T_LostHeader, fd, fm, n);
+               WSLH(w, HTTP_T_LostHeader, fd, fm, n);
        }
 }
 
 /*--------------------------------------------------------------------*/
 
 void
-http_FilterHeader(int fd, struct http *to, struct http *fm, unsigned how)
+http_FilterHeader(struct worker *w, int fd, struct http *to, struct http *fm, unsigned how)
 {
        unsigned u;
 
@@ -728,7 +728,7 @@ http_FilterHeader(int fd, struct http *to, struct http *fm, unsigned how)
                        continue;
 #include "http_headers.h"
 #undef HTTPH
-               http_copyheader(fd, to, fm, u);
+               http_copyheader(w, fd, to, fm, u);
        }
 }
 
@@ -747,22 +747,22 @@ http_ClrHeader(struct http *to)
 /*--------------------------------------------------------------------*/
 
 void
-http_SetHeader(int fd, struct http *to, const char *hdr)
+http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr)
 {
 
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
        if (to->nhd >= HTTP_HDR_MAX) {
                VSL_stats->losthdr++;
-               VSL(T(to, HTTP_T_LostHeader), fd, "%s", hdr);
+               WSL(w, T(to, HTTP_T_LostHeader), fd, "%s", hdr);
                return;
        }
-       http_seth(fd, to, to->nhd++, HTTP_T_Header, hdr);
+       http_seth(w, fd, to, to->nhd++, HTTP_T_Header, hdr);
 }
 
 /*--------------------------------------------------------------------*/
 
 void
-http_PrintfHeader(int fd, struct http *to, const char *fmt, ...)
+http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...)
 {
        va_list ap;
        unsigned l, n;
@@ -773,13 +773,13 @@ http_PrintfHeader(int fd, struct http *to, const char *fmt, ...)
        n = vsnprintf(to->f, l, fmt, ap);
        if (n + 1 > l || to->nhd >= HTTP_HDR_MAX) {
                VSL_stats->losthdr++;
-               VSL(T(to, HTTP_T_LostHeader), fd, "%s", to->f);
+               WSL(w, T(to, HTTP_T_LostHeader), fd, "%s", to->f);
        } else {
                assert(to->f < to->e);
                to->hd[to->nhd].b = to->f;
                to->hd[to->nhd].e = to->f + n;
                to->f += n + 1;
-               VSLH(HTTP_T_Header, fd, to, to->nhd);
+               WSLH(w, HTTP_T_Header, fd, to, to->nhd);
                to->nhd++;
        }
        va_end(ap);
index 00e324e23632b73781aa8e78808d1b8c9c3c14b4..dca4425ff49e1196b7a5928dea839a74f2c62c67 100644 (file)
@@ -157,12 +157,12 @@ PassBody(struct sess *sp)
        clock_gettime(CLOCK_REALTIME, &sp->t_resp);
 
        http_ClrHeader(sp->http);
-       http_CopyResp(sp->fd, sp->http, vc->http);
-       http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_PASS);
-       http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid);
+       http_CopyResp(sp->wrk, sp->fd, sp->http, vc->http);
+       http_FilterHeader(sp->wrk, sp->fd, sp->http, vc->http, HTTPH_A_PASS);
+       http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid);
        /* XXX */
        if (http_HdrIs(vc->http, H_Transfer_Encoding, "chunked"))
-               http_PrintfHeader(sp->fd, sp->http, "Transfer-Encoding: chunked");
+               http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Transfer-Encoding: chunked");
        WRK_Reset(sp->wrk, &sp->fd);
        sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
 
@@ -209,9 +209,9 @@ PassSession(struct sess *sp)
        }
        WSL(w, SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
-       http_CopyReq(vc->fd, vc->http, sp->http);
-       http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_PASS);
-       http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
+       http_CopyReq(w, vc->fd, vc->http, sp->http);
+       http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_PASS);
+       http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid);
        WRK_Reset(w, &vc->fd);
        http_Write(w, vc->http, 0);
        i = WRK_Flush(w);
index 408399347232d3359cc180436ad927df34893540..78c58986b60082615b554003fb21b33c045db60d 100644 (file)
@@ -61,9 +61,9 @@ PipeSession(struct sess *sp)
        VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
        vc->http->logtag = HTTP_Tx;
 
-       http_CopyReq(vc->fd, vc->http, sp->http);
-       http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_PIPE);
-       http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
+       http_CopyReq(w, vc->fd, vc->http, sp->http);
+       http_FilterHeader(w, vc->fd, vc->http, sp->http, HTTPH_R_PIPE);
+       http_PrintfHeader(w, vc->fd, vc->http, "X-Varnish: %u", sp->xid);
        WRK_Reset(w, &vc->fd);
        http_Write(w, vc->http, 0);
 
index f0dcacea0a0b04339ba3c1f1c9835cd56ca3ad67..09708f00a0b5647e28ee6eb89b9e71b9943788e6 100644 (file)
@@ -129,9 +129,9 @@ RES_Error(struct sess *sp, int code, const char *expl)
        WRK_Reset(sp->wrk, &sp->fd);
        sp->wrk->acct.hdrbytes += WRK_Write(sp->wrk, vsb_data(sb), vsb_len(sb));
        WRK_Flush(sp->wrk);
-       VSL(SLT_TxStatus, sp->id, "%d", code);
-       VSL(SLT_TxProtocol, sp->id, "HTTP/1.1");
-       VSL(SLT_TxResponse, sp->id, msg);
+       WSL(sp->wrk, SLT_TxStatus, sp->id, "%d", code);
+       WSL(sp->wrk, SLT_TxProtocol, sp->id, "HTTP/1.1");
+       WSL(sp->wrk, SLT_TxResponse, sp->id, msg);
        vca_close_session(sp, expl);
        vsb_delete(sb);
 }
@@ -144,19 +144,19 @@ res_do_304(struct sess *sp)
 {
        char lm[64];
 
-       VSL(SLT_Length, sp->fd, "%u", 0);
+       WSL(sp->wrk, SLT_Length, sp->fd, "%u", 0);
 
        http_ClrHeader(sp->http);
        sp->http->logtag = HTTP_Tx;
-       http_SetResp(sp->fd, sp->http, "HTTP/1.1", "304", "Not Modified");
+       http_SetResp(sp->wrk, sp->fd, sp->http, "HTTP/1.1", "304", "Not Modified");
        TIM_format(sp->t_req.tv_sec, lm);
-       http_PrintfHeader(sp->fd, sp->http, "Date: %s", lm);
-       http_SetHeader(sp->fd, sp->http, "Via: 1.1 varnish");
-       http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid);
+       http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Date: %s", lm);
+       http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish");
+       http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid);
        TIM_format(sp->obj->last_modified, lm);
-       http_PrintfHeader(sp->fd, sp->http, "Last-Modified: %s", lm);
+       http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Last-Modified: %s", lm);
        if (sp->doclose != NULL)
-               http_SetHeader(sp->fd, sp->http, "Connection: close");
+               http_SetHeader(sp->wrk, sp->fd, sp->http, "Connection: close");
        WRK_Reset(sp->wrk, &sp->fd);
        sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
        if (WRK_Flush(sp->wrk))
@@ -199,22 +199,22 @@ RES_WriteObj(struct sess *sp)
        if (sp->obj->response == 200 && sp->http->conds && res_do_conds(sp))
                return;
                
-       VSL(SLT_Length, sp->fd, "%u", sp->obj->len);
+       WSL(sp->wrk, SLT_Length, sp->fd, "%u", sp->obj->len);
 
        http_ClrHeader(sp->http);
        sp->http->logtag = HTTP_Tx;
-       http_CopyResp(sp->fd, sp->http, &sp->obj->http);
-       http_FilterHeader(sp->fd, sp->http, &sp->obj->http, HTTPH_A_DELIVER);
+       http_CopyResp(sp->wrk, sp->fd, sp->http, &sp->obj->http);
+       http_FilterHeader(sp->wrk, sp->fd, sp->http, &sp->obj->http, HTTPH_A_DELIVER);
        if (sp->xid != sp->obj->xid)
-               http_PrintfHeader(sp->fd, sp->http,
+               http_PrintfHeader(sp->wrk, sp->fd, sp->http,
                    "X-Varnish: %u %u", sp->xid, sp->obj->xid);
        else
-               http_PrintfHeader(sp->fd, sp->http, "X-Varnish: %u", sp->xid);
-       http_PrintfHeader(sp->fd, sp->http, "Age: %u",
+               http_PrintfHeader(sp->wrk, sp->fd, sp->http, "X-Varnish: %u", sp->xid);
+       http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Age: %u",
            sp->obj->age + sp->t_req.tv_sec - sp->obj->entered);
-       http_SetHeader(sp->fd, sp->http, "Via: 1.1 varnish");
+       http_SetHeader(sp->wrk, sp->fd, sp->http, "Via: 1.1 varnish");
        if (sp->doclose != NULL)
-               http_SetHeader(sp->fd, sp->http, "Connection: close");
+               http_SetHeader(sp->wrk, sp->fd, sp->http, "Connection: close");
        WRK_Reset(sp->wrk, &sp->fd);
        sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
index 0ed3cadd0682bbced6751565124186377fb19424..2dc01d9e04f17b90156828e3c307560e5a8500b6 100644 (file)
@@ -205,7 +205,8 @@ SES_Charge(struct sess *sp)
                ses_sum_acct(&sp->srcaddr->acct, a);
                b = sp->srcaddr->acct;
                UNLOCK(&sp->srcaddr->sah->mtx);
-               VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju",
+               WSL(sp->wrk, SLT_StatAddr, 0,
+                   "%s 0 %d %ju %ju %ju %ju %ju %ju %ju",
                    sp->srcaddr->addr, sp->t_end.tv_sec - b.first,
                    b.sess, b.req, b.pipe, b.pass,
                    b.fetch, b.hdrbytes, b.bodybytes);
index 01a5514721977ec32ccf6120c7b0a2a7bf18f30a..f8c17d1ca307e9c0322f141f76817f116c9ee111 100644 (file)
@@ -278,9 +278,9 @@ VCL_##func##_method(struct sess *sp)                                        \
 {                                                                      \
                                                                        \
        sp->handling = 0;                                               \
-       VSL(SLT_VCL_call, sp->fd, "%s", #func);                         \
+       WSL(sp->wrk, SLT_VCL_call, sp->fd, "%s", #func);                \
        sp->vcl->func##_func(sp);                                       \
-       VSL(SLT_VCL_return, sp->fd, "%s",                               \
+       WSL(sp->wrk, SLT_VCL_return, sp->fd, "%s",                      \
             vcl_handlingname(sp->handling));                           \
        assert(sp->handling & bitmap);                                  \
        assert(!(sp->handling & ~bitmap));                              \
index 86c24d9a062612d3395b331ab2bc5e5bc1d2ce1e..065b80dd90d2197d6976cbadb0fc37cbd9af6043 100644 (file)
@@ -23,7 +23,7 @@ VRT_error(struct sess *sp, unsigned code, const char *expl)
 { 
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-       VSL(SLT_Debug, 0, "VCL_error(%u, %s)", code, expl);
+       WSL(sp->wrk, SLT_Debug, 0, "VCL_error(%u, %s)", code, expl);
        sp->err_code = code;
        sp->err_expl = expl;
 }
@@ -36,7 +36,7 @@ VRT_count(struct sess *sp, unsigned u)
        
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        if (params->vcl_trace)
-               VSL(SLT_VCL_trace, sp->fd, "%u %d.%d", u,
+               WSL(sp->wrk, SLT_VCL_trace, sp->fd, "%u %d.%d", u,
                    sp->vcl->ref[u].line, sp->vcl->ref[u].pos);
 }
 
@@ -150,7 +150,7 @@ VRT_l_obj_ttl(struct sess *sp, double a)
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);       /* XXX */
-       VSL(SLT_TTL, sp->fd, "%u VCL %.0f %u",
+       WSL(sp->wrk, SLT_TTL, sp->fd, "%u VCL %.0f %u",
            sp->obj->xid, a, sp->t_req.tv_sec);
        if (a < 0)
                a = 0;
index e54ffaf8232fbc3574885a0bc9f8860f34d45777..8a6ad565a96bb08db092e7448892240906644245 100644 (file)
@@ -74,6 +74,8 @@ VSLR(enum shmlogtag tag, unsigned id, const char *b, const char *e)
 
        /* Only hold the lock while we find our space */
        LOCKSHM(&vsl_mtx);
+       VSL_stats->shm_writes++;        
+       VSL_stats->shm_records++;       
        assert(loghead->ptr < loghead->size);
 
        /* Wrap if necessary */
@@ -112,6 +114,8 @@ VSL(enum shmlogtag tag, unsigned id, const char *fmt, ...)
        }
 
        LOCKSHM(&vsl_mtx);
+       VSL_stats->shm_writes++;        
+       VSL_stats->shm_records++;       
        assert(loghead->ptr < loghead->size);
 
        /* Wrap if we cannot fit a full size record */
@@ -153,6 +157,8 @@ WSL_Flush(struct worker *w)
                return;
        l = w->wlp - w->wlog;
        LOCKSHM(&vsl_mtx);
+       VSL_stats->shm_writes++;        
+       VSL_stats->shm_records += w->wlr;
        if (loghead->ptr + l + 1 >= loghead->size)
                vsl_wrap();
        p = logstart + loghead->ptr;
@@ -163,6 +169,7 @@ WSL_Flush(struct worker *w)
        p[0] = w->wlog[0];
        UNLOCKSHM(&vsl_mtx);
        w->wlp = w->wlog;
+       w->wlr = 0;
 }
 
 /*--------------------------------------------------------------------*/
@@ -200,6 +207,7 @@ WSLR(struct worker *w, enum shmlogtag tag, unsigned id, const char *b, const cha
        memcpy(p + 4, b, l);
        p[4 + l] = '\0';
        p[0] = tag;
+       w->wlr++;
 }
 
 /*--------------------------------------------------------------------*/
@@ -241,6 +249,7 @@ WSL(struct worker *w, enum shmlogtag tag, unsigned id, const char *fmt, ...)
 
        w->wlp += 5 + n;
        assert(w->wlp < w->wle);
+       w->wlr++;
        va_end(ap);
 }
 
index f85ec9969d28c6fa2514edda52f39cce167ab7ed..f20ac59b9bd19bd54cb7265ba37ca536900656ae 100644 (file)
@@ -49,4 +49,6 @@ MAC_STAT(sess_pipeline,               uint64_t, "u", "Session Pipeline")
 MAC_STAT(sess_readahead,       uint64_t, "u", "Session Read Ahead")
 MAC_STAT(sess_herd,            uint64_t, "u", "Session herd")
 
+MAC_STAT(shm_records,          uint64_t, "u", "SHM records")
+MAC_STAT(shm_writes,           uint64_t, "u", "SHM writes")
 MAC_STAT(shm_cont,             uint64_t, "u", "SHM MTX contention")