bst-vs-heap 764 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python3
  2. import common
  3. class Main(common.LkmcCliFunction):
  4. def __init__(self):
  5. super().__init__(
  6. defaults={
  7. 'emulator': 'gem5',
  8. 'show_time': False,
  9. },
  10. description='''\
  11. Convert a BST vs heap stat file into a gnuplot input
  12. ''',
  13. )
  14. def timed_main(self):
  15. stats = self.get_stats()
  16. it = iter(stats)
  17. i = 1
  18. for stat in it:
  19. try:
  20. next_stat = next(it)
  21. except StopIteration:
  22. # Automatic dumpstats at end may lead to odd number of stats.
  23. break
  24. print('{} {} {}'.format(i, stat, next_stat))
  25. i += 1
  26. if __name__ == '__main__':
  27. Main().cli()