commit - 0206bd5113e727870d4eb24fbd5f17843745237d
commit + 54dd92bebc97da7efb955f703c20cac8f4cbbb9f
blob - 04f2480c0c398f16bda523110b71e5e97ccfad5a
blob + e4224aa783867a1420c03bb4866b71cb59186997
--- src/cmd/delatex.lx
+++ src/cmd/delatex.lx
{
int i;
- BEGIN Normal; /* Starts yylex off in the right state */
if (argc==1) {
yyin = stdin;
+ BEGIN Normal; /* Starts yylex off in the right state */
yylex();
}
else for (i=1; i<argc; i++) {
fprintf(stderr,"can't open %s\n",argv[i]);
exit(1);
}
+ BEGIN Normal; /* Starts yylex off in the right state */
yylex();
}
exit(0);
blob - f50c91ab604f25bf97a684ccf5a8bc977c77e6b1
blob + 1db36bd92b7af2b42d6c26b24e5b452fdd14dd14
--- src/cmd/venti/srv/bloom.c
+++ src/cmd/venti/srv/bloom.c
inbloomfilter(Bloom *b, u8int *score)
{
int r;
- uint ms;
if(b == nil || b->data == nil)
return 1;
if(ignorebloom)
return 1;
- ms = msec();
rlock(&b->lk);
r = _inbloomfilter(b, score);
runlock(&b->lk);
- ms = ms - msec();
- addstat2(StatBloomLookup, 1, StatBloomLookupTime, ms);
+ addstat(StatBloomLookup, 1);
if(r)
addstat(StatBloomMiss, 1);
else
blob - 4ed8832cfba867a2882394f7090aefb0a35278cb
blob + 382923c7a07affa5f20ee2d23595b8128c2648c1
--- src/cmd/venti/srv/dat.h
+++ src/cmd/venti/srv/dat.h
StatBloomLookup,
StatBloomOnes,
StatBloomBits,
- StatBloomLookupTime,
StatApartRead,
StatApartReadBytes,
blob - abbd26a403c75397a037adbe9f0adae20a084a29
blob + a50ef0c5c2bbc4b71eae3778d0e25c71316f430f
--- src/cmd/venti/srv/dcache.c
+++ src/cmd/venti/srv/dcache.c
dcache.mem = MKNZ(u8int, (nblocks+1+128) * blocksize);
last = nil;
- p = (u8int*)(((ulong)dcache.mem+blocksize-1)&~(ulong)(blocksize-1));
+ p = (u8int*)(((uintptr)dcache.mem+blocksize-1)&~(uintptr)(blocksize-1));
for(i = 0; i < nblocks; i++){
b = &dcache.blocks[i];
b->data = &p[i * blocksize];
getdblock(Part *part, u64int addr, int mode)
{
DBlock *b;
- uint ms;
- ms = msec();
b = _getdblock(part, addr, mode, 1);
if(mode == OREAD || mode == ORDWR)
addstat(StatDcacheRead, 1);
if(mode == OWRITE || mode == ORDWR)
addstat(StatDcacheWrite, 1);
- ms = msec() - ms;
- addstat2(StatDcacheLookup, 1, StatDcacheLookupTime, ms);
return b;
}
_getdblock(Part *part, u64int addr, int mode, int load)
{
DBlock *b;
- u32int h, size;
+ u32int h, size, ms;
+ ms = 0;
trace(TraceBlock, "getdblock enter %s 0x%llux", part->name, addr);
size = part->blocksize;
if(size > dcache.size){
seterr(EAdmin, "block size %d too big for cache with size %d", size, dcache.size);
+ if(load)
+ addstat(StatDcacheLookup, 1);
return nil;
}
h = pbhash(addr);
for(b = dcache.heads[h]; b != nil; b = b->next){
if(b->part == part && b->addr == addr){
if(load)
- addstat(StatDcacheHit, 1);
+ addstat2(StatDcacheHit, 1, StatDcacheLookup, 1);
goto found;
}
}
return nil;
}
- addstat(StatDcacheMiss, 1);
+ /*
+ * Only start timer here, on cache miss - calling msec() on plain cache hits
+ * makes cache hits system-call bound.
+ */
+ ms = msec();
+ addstat2(StatDcacheLookup, 1, StatDcacheMiss, 1);
b = bumpdblock();
if(b == nil){
b->mode = mode;
trace(TraceBlock, "getdblock exit");
+ if(ms)
+ addstat(StatDcacheLookupTime, msec() - ms);
return b;
}
blob - 687616e1772838fade8380d392ef21e45299c7b6
blob + d43b64c7fe21698d033c2a2c9e44e2bede1ebe09
--- src/cmd/venti/srv/disksched.c
+++ src/cmd/venti/srv/disksched.c
diskaccess(int level)
{
if(level < 0 || level >= nelem(lasttime)){
- fprint(2, "bad level in diskaccess; caller=%lux\n", getcallerpc(&level));
+ fprint(2, "bad level in diskaccess; caller=%#p\n",
+ getcallerpc(&level));
return;
}
lasttime[level] = time(0);
blob - 5e4bbe74152e542e8b142c82d9cbe15b97b3f6f1
blob + 623d4e47660ff73abd21c9878b9a1e6c60f1d320
--- src/cmd/venti/srv/httpd.c
+++ src/cmd/venti/srv/httpd.c
"bloomlookup",
"bloomones",
"bloombits",
- "bloomlookuptime",
"apartread",
"apartreadbyte",
blob - b1935d42c84d6bc42442f36a53f567e8b9e2db06
blob + 5875406bcd2fce15b858d7d81f87073640429f2e
--- src/cmd/venti/srv/icache.c
+++ src/cmd/venti/srv/icache.c
{
ISum *s;
+ if(!icacheprefetch)
+ return nil;
s = scachelookup(addr);
if(s == nil){
/* first time: make an entry in the cache but don't populate it yet */
return 0;
}
-static int
-lookupscore_untimed(u8int score[VtScoreSize], int type, IAddr *ia)
+int
+lookupscore(u8int score[VtScoreSize], int type, IAddr *ia)
{
+ int ms, ret;
IEntry d;
- if(icachelookup(score, type, ia) >= 0)
+ if(icachelookup(score, type, ia) >= 0){
+ addstat(StatIcacheRead, 1);
return 0;
+ }
+ ms = msec();
addstat(StatIcacheFill, 1);
if(loadientry(mainindex, score, type, &d) < 0)
- return -1;
-
- insertscore(score, &d.ia, IEClean, nil);
- *ia = d.ia;
- return 0;
-}
-
-int
-lookupscore(u8int score[VtScoreSize], int type, IAddr *ia)
-{
- int ms, ret;
-
- ms = msec();
- ret = lookupscore_untimed(score, type, ia);
- ms = msec() - ms;
- addstat2(StatIcacheRead, 1, StatIcacheReadTime, ms);
+ ret = -1;
+ else{
+ ret = 0;
+ insertscore(score, &d.ia, IEClean, nil);
+ *ia = d.ia;
+ }
+ addstat2(StatIcacheRead, 1, StatIcacheReadTime, msec() - ms);
return ret;
}
blob - 1cb9fc0e25aad1c512c6b84009e11b3487ecac80
blob + 5d8d437d52550ec2ec53c89b2dd9646e68f6ba5f
--- src/cmd/venti/srv/icachewrite.c
+++ src/cmd/venti/srv/icachewrite.c
bsize = 1<<is->blocklog;
buf = emalloc(Bufsize+bsize);
- buf = (u8int*)(((ulong)buf+bsize-1)&~(ulong)(bsize-1));
+ buf = (u8int*)(((uintptr)buf+bsize-1)&~(uintptr)(bsize-1));
for(;;){
trace(TraceProc, "icachewriteproc recv");
blob - b989c3cbfd45658a94a3df0283ccc03b449d8696
blob + d9a6b954e824bab6df3f344b25ac85a2ce761940
--- src/cmd/venti/srv/lumpcache.c
+++ src/cmd/venti/srv/lumpcache.c
Lump *b;
u32int h;
- ms = msec();
+ ms = 0;
trace(TraceLump, "lookuplump enter");
h = hashbits(score, HashLog);
CHECK(checklumpcache());
}
+ /* start timer on cache miss to avoid system call on cache hit */
+ ms = msec();
+
addstat(StatLcacheMiss, 1);
b = lumpcache.free;
lumpcache.free = b->next;
addstat(StatLumpStall, -1);
trace(TraceLump, "lookuplump exit");
- addstat2(StatLcacheRead, 1, StatLcacheReadTime, msec()-ms);
+ addstat2(StatLcacheRead, 1, StatLcacheReadTime, ms ? msec()-ms : 0);
return b;
}
blob - 5ee4d91fc9802c1d237df60ecbb8afa0e20f523c
blob + bb944760b4e47acd3497bac1c65a6694ecafd600
--- src/cmd/venti/srv/stats.c
+++ src/cmd/venti/srv/stats.c
{ "bloom filter lookups", },
{ "bloom filter ones", },
{ "bloom filter bits", },
- { "bloom filter lookup time", },
{ "arena block reads", },
{ "arena block read bytes", },
blob - 73c1d0689f671f7a88c689a73cb04c23b24a396f
blob + d810c53d8926fbf925fdbd6157257d9d4a8458b0
--- src/cmd/venti/srv/utils.c
+++ src/cmd/venti/srv/utils.c
}
memset(p, 0xa5, n);
setmalloctag(p, getcallerpc(&n));
-if(0)print("emalloc %p-%p by %lux\n", p, (char*)p+n, getcallerpc(&n));
+if(0)print("emalloc %p-%p by %#p\n", p, (char*)p+n, getcallerpc(&n));
return p;
}
}
memset(p, 0, n);
setmalloctag(p, getcallerpc(&n));
-if(0)print("ezmalloc %p-%p by %lux\n", p, (char*)p+n, getcallerpc(&n));
+if(0)print("ezmalloc %p-%p by %#p\n", p, (char*)p+n, getcallerpc(&n));
return p;
}
sysfatal("out of memory allocating %lud", n);
}
setrealloctag(p, getcallerpc(&p));
-if(0)print("erealloc %p-%p by %lux\n", p, (char*)p+n, getcallerpc(&p));
+if(0)print("erealloc %p-%p by %#p\n", p, (char*)p+n, getcallerpc(&p));
return p;
}
t = emalloc(n);
memmove(t, s, n);
setmalloctag(t, getcallerpc(&s));
-if(0)print("estrdup %p-%p by %lux\n", t, (char*)t+n, getcallerpc(&s));
+if(0)print("estrdup %p-%p by %#p\n", t, (char*)t+n, getcallerpc(&s));
return t;
}
blob - 0d6e1bc3c2bb598cd5e9b0864b2d463310f12195
blob + ab485a32099b65ed05f8ddd9809f102cf82947f6
--- src/cmd/xd.c
+++ src/cmd/xd.c
int flush;
int abase=2;
int xd(char *, int);
-void xprint(char *, long);
+void xprint(char *, ulong);
void initarg(void), swizz(void);
enum{
Narg=10
{
int i;
for(i=0; i<ndata; i+=sizeof(unsigned long))
- xprint(f, (data[i]<<24)|(data[i+1]<<16)|(data[i+2]<<8)|data[i+3]);
+ xprint(f, (u32int)((data[i]<<24)|(data[i+1]<<16)|(data[i+2]<<8)|data[i+3]));
}
void
}
void
-xprint(char *fmt, long d)
+xprint(char *fmt, ulong d)
{
if(Bprint(&bout, fmt, d)<0){
fprint(2, "xd: i/o error\n");