|
7 | 7 | import re
|
8 | 8 |
|
9 | 9 | def main():
|
10 |
| - with open('blocks/config') as file: |
| 10 | + with open('blocks/config', 'rb') as file: |
11 | 11 | s = struct.unpack('<LLLL', file.read())
|
12 |
| - print 'read_size: %d' % s[0] |
13 |
| - print 'prog_size: %d' % s[1] |
14 |
| - print 'block_size: %d' % s[2] |
15 |
| - print 'block_size: %d' % s[3] |
| 12 | + print('read_size: %d' % s[0]) |
| 13 | + print('prog_size: %d' % s[1]) |
| 14 | + print('block_size: %d' % s[2]) |
| 15 | + print('block_size: %d' % s[3]) |
16 | 16 |
|
17 |
| - print 'real_size: %d' % sum( |
| 17 | + print('real_size: %d' % sum( |
18 | 18 | os.path.getsize(os.path.join('blocks', f))
|
19 |
| - for f in os.listdir('blocks') if re.match('\d+', f)) |
| 19 | + for f in os.listdir('blocks') if re.match('\d+', f))) |
20 | 20 |
|
21 |
| - with open('blocks/stats') as file: |
| 21 | + with open('blocks/stats', 'rb') as file: |
22 | 22 | s = struct.unpack('<QQQ', file.read())
|
23 |
| - print 'read_count: %d' % s[0] |
24 |
| - print 'prog_count: %d' % s[1] |
25 |
| - print 'erase_count: %d' % s[2] |
| 23 | + print('read_count: %d' % s[0]) |
| 24 | + print('prog_count: %d' % s[1]) |
| 25 | + print('erase_count: %d' % s[2]) |
26 | 26 |
|
27 |
| - print 'runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime) |
| 27 | + print('runtime: %.3f' % (time.time() - os.stat('blocks').st_ctime)) |
28 | 28 |
|
29 | 29 | if __name__ == "__main__":
|
30 | 30 | main(*sys.argv[1:])
|
0 commit comments