Files
linux-kernel-module-cheat/bst-vs-heap-vs-hashmap-gem5-stats
Ciro Santilli 六四事件 法轮功 b7318fb124 bst_vst_heap_vs_hashmap: make graph beautiful
2019-06-28 00:00:00 +00:00

39 lines
1.0 KiB
Python
Executable File

#!/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
https://github.com/cirosantilli/linux-kernel-module-cheat#bst-vs-heap-vs-hashmap
''',
)
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()