Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/scripts/file_copy.py

Issue 848002: Changes to enable dev in stateful partition for usb and startup (Closed)
Patch Set: Add legacy support Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform/init/chromeos_startup ('k') | src/scripts/image_to_usb.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # This program operates much like dd, but with two important differences: 3 # This program operates much like dd, but with two important differences:
4 # 1. Many features lacking 4 # 1. Many features lacking
5 # 2. seek_bytes= param can specify seek offset in bytes, not block size 5 # 2. seek_bytes= param can specify seek offset in bytes, not block size
6 6
7 import os 7 import os
8 import sys 8 import sys
9 import time 9 import time
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 t1 = time.time() 79 t1 = time.time()
80 80
81 buf = os.read(if_fd, arg_bs) 81 buf = os.read(if_fd, arg_bs)
82 while len(buf) > 0: 82 while len(buf) > 0:
83 bytes_written = 0 83 bytes_written = 0
84 while bytes_written < len(buf): 84 while bytes_written < len(buf):
85 bytes_written += os.write(of_fd, buf[bytes_written:]) 85 bytes_written += os.write(of_fd, buf[bytes_written:])
86 bytes_copied += bytes_written 86 bytes_copied += bytes_written
87 buf = os.read(if_fd, arg_bs) 87 buf = os.read(if_fd, arg_bs)
88 88
89 t2 = time.time()
90
91 os.close(if_fd) 89 os.close(if_fd)
92 os.close(of_fd) 90 os.close(of_fd)
91
92 t2 = time.time()
93 93
94 # print timing info 94 # print timing info
95 print >> sys.stderr, 'copy %d bytes took %0.3f s' % (bytes_copied, t2 - t1) 95 print >> sys.stderr, 'copy %d bytes took %0.3f s' % (bytes_copied, t2 - t1)
96 print >> sys.stderr, 'speed: %0.1f MB/s' % \ 96 print >> sys.stderr, 'speed: %0.1f MB/s' % \
97 ((bytes_copied / 1000000) / (t2 - t1)) 97 ((bytes_copied / 1000000) / (t2 - t1))
98 98
99 if __name__ == '__main__': 99 if __name__ == '__main__':
100 main(sys.argv) 100 main(sys.argv)
OLDNEW
« no previous file with comments | « src/platform/init/chromeos_startup ('k') | src/scripts/image_to_usb.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698