results.py 719 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python2
  2. import struct
  3. import sys
  4. import time
  5. import os
  6. import re
  7. def main():
  8. with open('blocks/.config') as file:
  9. read_size, prog_size, block_size, block_count = (
  10. struct.unpack('<LLLL', file.read()))
  11. real_size = sum(
  12. os.path.getsize(os.path.join('blocks', f))
  13. for f in os.listdir('blocks') if re.match('\d+', f))
  14. with open('blocks/.stats') as file:
  15. read_count, prog_count, erase_count = (
  16. struct.unpack('<QQQ', file.read()))
  17. runtime = time.time() - os.stat('blocks').st_ctime
  18. print 'results: %dB %dB %dB %.3fs' % (
  19. read_count, prog_count, erase_count, runtime)
  20. if __name__ == "__main__":
  21. main(*sys.argv[1:])