OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Uploads a ton of stuff to isolateserver to test its handling. | 6 """Uploads a ton of stuff to isolateserver to test its handling. |
7 | 7 |
8 Generates an histogram with the latencies to download a just uploaded file. | 8 Generates an histogram with the latencies to download a just uploaded file. |
9 | 9 |
10 Note that it only looks at uploading and downloading and do not test | 10 Note that it only looks at uploading and downloading and do not test |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 data += random.choice(self.pool)[:rest] | 50 data += random.choice(self.pool)[:rest] |
51 return data | 51 return data |
52 | 52 |
53 | 53 |
54 class Progress(threading_utils.Progress): | 54 class Progress(threading_utils.Progress): |
55 def __init__(self, *args, **kwargs): | 55 def __init__(self, *args, **kwargs): |
56 super(Progress, self).__init__(*args, **kwargs) | 56 super(Progress, self).__init__(*args, **kwargs) |
57 self.total = 0 | 57 self.total = 0 |
58 | 58 |
59 def increment_index(self, name): | 59 def increment_index(self, name): |
60 self.update_item(name, index=True) | 60 self.update_item(name, index=1) |
61 | 61 |
62 def increment_count(self): | 62 def increment_count(self): |
63 self.update_item('', size=True) | 63 self.update_item('', size=1) |
64 | 64 |
65 def gen_line(self, name): | 65 def gen_line(self, name): |
66 """Generates the line to be printed. | 66 """Generates the line to be printed. |
67 | 67 |
68 |name| is actually the item size. | 68 |name| is actually the item size. |
69 """ | 69 """ |
70 if name: | 70 if name: |
71 self.total += name | 71 self.total += name |
72 name = graph.to_units(name) | 72 name = graph.to_units(name) |
73 | 73 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 print('') | 256 print('') |
257 print_results(results, options.columns, options.buckets) | 257 print_results(results, options.columns, options.buckets) |
258 if options.dump: | 258 if options.dump: |
259 with open(options.dump, 'w') as f: | 259 with open(options.dump, 'w') as f: |
260 json.dump(results, f, separators=(',',':')) | 260 json.dump(results, f, separators=(',',':')) |
261 return 0 | 261 return 0 |
262 | 262 |
263 | 263 |
264 if __name__ == '__main__': | 264 if __name__ == '__main__': |
265 sys.exit(main()) | 265 sys.exit(main()) |
OLD | NEW |