def permscan(self, address_space, offset = 0, maxlen = None):
times = []
# Run a warm-up scan to ensure the file is cached as much as possible
self.oldscan(address_space, offset, maxlen)
perms = list(itertools.permutations(self.checks))
for i in range(len(perms)):
self.checks = perms[i]
print "Running scan {0}/{1}...".format(i + 1, len(perms))
profobj = ScanProfInstance(self.oldscan, address_space, offset, maxlen)
value = timeit.timeit(profobj, number = self.repeats)
times.append((value, len(list(profobj.results)), i))
print "Scan results"
print "{0:20} | {1:7} | {2:6} | {3}".format("Time", "Results", "Perm #", "Ordering")
for val, l, ordering in sorted(times):
print "{0:20} | {1:7} | {2:6} | {3}".format(val, l, ordering, perms[ordering])
sys.exit(1)
评论列表
文章目录