Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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 12:32:57 by
