bst vs heap: move in fully from cpp-cheat

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-26 00:00:00 +00:00
parent d37344ac11
commit 178a6681df
7 changed files with 266 additions and 91 deletions

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env python3
import common
class Main(common.LkmcCliFunction):
def __init__(self):
super().__init__(
defaults={
'emulator': 'gem5',
'show_time': False,
},
description='''\
Convert a BST vs heap stat file into a gnuplot input
''',
)
def timed_main(self):
stats = self.get_stats()
it = iter(stats)
i = 1
for heap_num_cycles in it:
try:
bst_num_cycles = next(it)
hashmap_num_cycles = next(it)
except StopIteration:
# Automatic dumpstats at end may lead to one extra stat at the end.
break
print('{} {} {} {}'.format(
i,
heap_num_cycles,
bst_num_cycles,
hashmap_num_cycles,
))
i += 1
if __name__ == '__main__':
Main().cli()