aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/venti/srv/lumpcache.c
diff options
context:
space:
mode:
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;
}