init
Embed:
(wiki syntax)
Show/hide line numbers
stats.py
00001 #!/usr/bin/env python 00002 00003 import struct 00004 import sys 00005 import time 00006 import os 00007 import re 00008 00009 def main(): 00010 with open('blocks/config') as file: 00011 s = struct.unpack('<LLLL', file.read()) 00012 print 'read_size: %d' % s[0] 00013 print 'prog_size: %d' % s[1] 00014 print 'block_size: %d' % s[2] 00015 print 'block_size: %d' % s[3] 00016 00017 print 'real_size: %d' % sum( 00018 os.path.getsize(os.path.join('blocks', f)) 00019 for f in os.listdir('blocks') if re.match('\d+', f)) 00020 00021 with open('blocks/stats') as file: 00022 s = struct.unpack('<QQQ', file.read()) 00023 print 'read_count: %d' % s[0] 00024 print 'prog_count: %d' % s[1] 00025 print 'erase_count: %d' % s[2] 00026 00027 print 'runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime) 00028 00029 if __name__ == "__main__": 00030 main(*sys.argv[1:])
Generated on Tue Jul 12 2022 13:25:13 by
1.7.2