Permalink
Browse files

correct output of summary at the end

  • Loading branch information...
timo committed Sep 11, 2011
1 parent acaa12b commit bc9bd86f38ea403ea9e0f4b7f3e965e951ecc101
Showing with 8 additions and 4 deletions.
  1. +8 −4 find_all_classes.py
View
@@ -91,11 +91,13 @@ def __init__(self, neighbourhood, bits_set, taskname=None, base=2):
self.cache = defaultdict(lambda: 0)
- cache_mb_size = 100
+ cache_mb_size = 80
cache_byte_size = cache_mb_size * 1024 * 1024
cache_entry_size = cache_byte_size / 8
self.cachesize = cache_entry_size
+ self.items_done = 0
+
self.fast_forward()
def res(self, name):
@@ -198,7 +200,7 @@ def inner_loop(self):
self.cachehits += 1
if cachecontents > self.max_cache_fill:
self.max_cache_fill = cachecontents
- if cachecontents > 0.75 * self.max_cache_fill:
+ if cachecontents > 0.75 * cachesize:
care_about_ordering = True
cachecontents -= 1
val = self.cache[number]
@@ -209,6 +211,8 @@ def inner_loop(self):
endtime, last_time = time() - last_time, time()
self.timings.write("%f\n" % ((endtime * 1000) / stats_step))
+ self.items_done += 1
+
def loop(self):
start = time()
self.cachehits = 0
@@ -219,8 +223,8 @@ def loop(self):
if self.outfile:
self.outfile.close()
if self.task_size != 0:
- print "done %d steps in %s (%d cache hits - %f%%)" % (self.task_size, time() - start, self.cachehits, 100.0 * self.cachehits / self.task_size)
- print " that's a speed of %f steps per second" % (self.task_size / (time() - start))
+ print "done %d steps in %s (%d cache hits - %f%%)" % (self.items_done, time() - start, self.cachehits, 100.0 * self.cachehits / self.items_done)
+ print " that's a speed of %f steps per second" % (self.items_done / (time() - start))
print " cache was filled with %d at its peak" % (self.max_cache_fill)
def new_main(start, end):

0 comments on commit bc9bd86

Please sign in to comment.