aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/venti/srv/icache.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/icache.c
parent0206bd5113e727870d4eb24fbd5f17843745237d (diff)
parent0206bd5113e727870d4eb24fbd5f17843745237d (diff)
downloadplan9port-54dd92bebc97da7efb955f703c20cac8f4cbbb9f.tar.gz
plan9port-54dd92bebc97da7efb955f703c20cac8f4cbbb9f.tar.bz2
plan9port-54dd92bebc97da7efb955f703c20cac8f4cbbb9f.zip
merge
Diffstat (limited to 'src/cmd/venti/srv/icache.c')
-rw-r--r--src/cmd/venti/srv/icache.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/cmd/venti/srv/icache.c b/src/cmd/venti/srv/icache.c
index b1935d42..5875406b 100644
--- a/src/cmd/venti/srv/icache.c
+++ b/src/cmd/venti/srv/icache.c
@@ -250,6 +250,8 @@ scachemiss(u64int addr)
{
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 */
@@ -439,32 +441,27 @@ insertscore(u8int score[VtScoreSize], IAddr *ia, int state, AState *as)
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;
}