Commit 744ed090 authored by Guido van Rossum's avatar Guido van Rossum

Report hit rate for load requests.

parent f8e54a4f
......@@ -148,6 +148,7 @@ def main():
addcommas(datarecords),
100.0 * datarecords / records,
datasize / 1024.0 / datarecords)
print "Hit rate: %.1f%% (load hits / loads)" % hitrate(bycode)
print
codes = bycode.keys()
codes.sort()
......@@ -158,6 +159,20 @@ def main():
code,
explain.get(code) or "*** unknown code ***")
def hitrate(bycode):
loads = 0
hits = 0
for code in bycode.keys():
if code & 0x70 == 0x20:
n = bycode[code]
loads += n
if code in (0x2A, 0x2C, 0x2E):
hits += n
if loads:
return 100.0 * hits / loads
else:
return 0.0
def U64(s):
h, v = struct.unpack(">II", s)
return (long(h) << 32) + v
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment