diff options
| author | rsc <devnull@localhost> | 2004-03-11 19:14:09 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-03-11 19:14:09 +0000 |
| commit | 24998851775d2d2a737a172dc614d9b5c91706dc (patch) | |
| tree | 6b249cd18b9ca71aec829c7a4686974f0594cf88 /src/cmd/venti/httpd.c | |
| parent | d49a2e4801752c8a1211c7fac8cc08055a6b6fa5 (diff) | |
| download | plan9port-24998851775d2d2a737a172dc614d9b5c91706dc.tar.gz plan9port-24998851775d2d2a737a172dc614d9b5c91706dc.zip | |
Implement write buffer.
Diffstat (limited to 'src/cmd/venti/httpd.c')
| -rw-r--r-- | src/cmd/venti/httpd.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/cmd/venti/httpd.c b/src/cmd/venti/httpd.c index cd207cd1..8215ccb6 100644 --- a/src/cmd/venti/httpd.c +++ b/src/cmd/venti/httpd.c @@ -137,12 +137,14 @@ httpproc(void *v) c = v; for(t = 15*60*1000; ; t = 15*1000){ - if(hparsereq(c, t) <= 0) +fprint(2, "httpd: get headers\n"); + if(hparsereq(c, t) < 0) break; ok = -1; for(i = 0; i < MaxObjs && objs[i].name[0]; i++){ if(strcmp(c->req.uri, objs[i].name) == 0){ +fprint(2, "httpd: call function %p\n", objs[i].f); ok = (*objs[i].f)(c); break; } @@ -180,7 +182,10 @@ static int preq(HConnect *c) { if(hparseheaders(c, 15*60*1000) < 0) +{ +fprint(2, "hparseheaders failed\n"); return -1; +} if(strcmp(c->req.meth, "GET") != 0 && strcmp(c->req.meth, "HEAD") != 0) return hunallowed(c, "GET, HEAD"); @@ -196,7 +201,7 @@ preqtext(HConnect *c) int r; r = preq(c); - if(r <= 0) + if(r < 0) return r; hout = &c->hout; @@ -221,7 +226,7 @@ notfound(HConnect *c) int r; r = preq(c); - if(r <= 0) + if(r < 0) return r; return hfail(c, HNotFound, c->req.uri); } @@ -233,9 +238,13 @@ estats(HConnect *c) int r; r = preqtext(c); - if(r <= 0) + if(r < 0) +{ +fprint(2, "preqtext failed\n"); return r; +} +fprint(2, "write stats\n"); hout = &c->hout; hprint(hout, "lump writes=%,ld\n", stats.lumpwrites); hprint(hout, "lump reads=%,ld\n", stats.lumpreads); @@ -268,13 +277,21 @@ estats(HConnect *c) hprint(hout, "disk cache misses=%,ld\n", stats.pcmiss); hprint(hout, "disk cache reads=%,ld\n", stats.pcreads); hprint(hout, "disk cache bytes read=%,lld\n", stats.pcbreads); +fprint(2, "write new stats\n"); + hprint(hout, "disk cache writes=%,ld\n", stats.dirtydblocks); + hprint(hout, "disk cache writes absorbed=%,ld %d%%\n", stats.absorbedwrites, + percent(stats.absorbedwrites, stats.dirtydblocks)); + +fprint(2, "back to old stats\n"); hprint(hout, "disk writes=%,ld\n", stats.diskwrites); hprint(hout, "disk bytes written=%,lld\n", stats.diskbwrites); hprint(hout, "disk reads=%,ld\n", stats.diskreads); hprint(hout, "disk bytes read=%,lld\n", stats.diskbreads); +fprint(2, "hflush stats\n"); hflush(hout); +fprint(2, "done with stats\n"); return 0; } @@ -288,7 +305,7 @@ sindex(HConnect *c) int i, r, active; r = preqtext(c); - if(r <= 0) + if(r < 0) return r; hout = &c->hout; @@ -348,7 +365,7 @@ dindex(HConnect *c) int i, r; r = preqtext(c); - if(r <= 0) + if(r < 0) return r; hout = &c->hout; @@ -376,7 +393,7 @@ xindex(HConnect *c) int r; r = preq(c); - if(r <= 0) + if(r < 0) return r; hout = &c->hout; |
