summaryrefslogtreecommitdiffstats
path: root/src/cmd/venti/srv/lumpcache.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-01-30 10:30:45 -0500
committerRuss Cox <rsc@swtch.com>2008-01-30 10:30:45 -0500
commit54dd92bebc97da7efb955f703c20cac8f4cbbb9f (patch)
tree4662b5d6e0a182b14afad3fbc49b6ba9eb558fe9 /src/cmd/venti/srv/lumpcache.c
parent0206bd5113e727870d4eb24fbd5f17843745237d (diff)
parent0206bd5113e727870d4eb24fbd5f17843745237d (diff)
downloadplan9port-54dd92bebc97da7efb955f703c20cac8f4cbbb9f.tar.gz
plan9port-54dd92bebc97da7efb955f703c20cac8f4cbbb9f.zip
merge
Diffstat (limited to 'src/cmd/venti/srv/lumpcache.c')
-rw-r--r--src/cmd/venti/srv/lumpcache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/venti/srv/lumpcache.c b/src/cmd/venti/srv/lumpcache.c
index b989c3cb..d9a6b954 100644
--- a/src/cmd/venti/srv/lumpcache.c
+++ b/src/cmd/venti/srv/lumpcache.c
@@ -71,7 +71,7 @@ lookuplump(u8int *score, int type)
Lump *b;
u32int h;
- ms = msec();
+ ms = 0;
trace(TraceLump, "lookuplump enter");
h = hashbits(score, HashLog);
@@ -112,6 +112,9 @@ again:
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;
@@ -151,7 +154,7 @@ found:
addstat(StatLumpStall, -1);
trace(TraceLump, "lookuplump exit");
- addstat2(StatLcacheRead, 1, StatLcacheReadTime, msec()-ms);
+ addstat2(StatLcacheRead, 1, StatLcacheReadTime, ms ? msec()-ms : 0);
return b;
}