OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Basic pyauto performance tests. | 6 """Basic pyauto performance tests. |
7 | 7 |
8 For tests that need to be run for multiple iterations (e.g., so that average | 8 For tests that need to be run for multiple iterations (e.g., so that average |
9 and standard deviation values can be reported), the default number of iterations | 9 and standard deviation values can be reported), the default number of iterations |
10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. | 10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 os.chmod(graphs_file, 0755) | 317 os.chmod(graphs_file, 0755) |
318 | 318 |
319 # Update data file for this particular graph. | 319 # Update data file for this particular graph. |
320 existing_lines = [] | 320 existing_lines = [] |
321 data_file = os.path.join(self._local_perf_dir, graph_name + '-summary.dat') | 321 data_file = os.path.join(self._local_perf_dir, graph_name + '-summary.dat') |
322 if os.path.exists(data_file): | 322 if os.path.exists(data_file): |
323 with open(data_file) as f: | 323 with open(data_file) as f: |
324 existing_lines = f.readlines() | 324 existing_lines = f.readlines() |
325 existing_lines = map(eval, map(lambda x: x.strip(), existing_lines)) | 325 existing_lines = map(eval, map(lambda x: x.strip(), existing_lines)) |
326 | 326 |
327 seen_key = graph_name + '|' + description | 327 seen_key = graph_name |
328 # We assume that the first line |existing_line[0]| is the latest. | |
dennis_jeffrey
2012/08/29 18:47:51
nit: existing_line --> existing_lines
Dai Mikurube (NOT FULLTIME)
2012/08/30 02:24:11
Done.
| |
329 # We update only the first line. | |
dennis_jeffrey
2012/08/29 18:47:51
I recommend removing this line. There's a case wh
Dai Mikurube (NOT FULLTIME)
2012/08/30 02:24:11
Removed. To write it correctly, "We insert a new
dennis_jeffrey
2012/08/30 17:13:23
Yes, I believe that would be a more accurate state
| |
328 if units_x: | 330 if units_x: |
329 points = [] | 331 new_line = { |
332 'rev': revision, | |
333 'traces': { description: [] } | |
334 } | |
330 if seen_key in self._seen_graph_lines: | 335 if seen_key in self._seen_graph_lines: |
331 # We've added points previously for this graph line in the current | 336 # We've added points previously for this graph line in the current |
332 # test execution, so retrieve the original set of points specified in | 337 # test execution, so retrieve the original set of points specified in |
333 # the most recent revision in the data file. | 338 # the most recent revision in the data file. |
334 points = existing_lines[0]['traces'][description] | 339 new_line = existing_lines[0] |
340 if not description in new_line['traces']: | |
341 new_line['traces'][description] = [] | |
335 for x_value, y_value in value: | 342 for x_value, y_value in value: |
336 points.append([str(x_value), str(y_value)]) | 343 new_line['traces'][description].append([str(x_value), str(y_value)]) |
337 new_traces = { | 344 else: |
338 description: points | 345 new_line = { |
346 'rev': revision, | |
347 'traces': { description: [str(value), str(0.0)] } | |
339 } | 348 } |
340 else: | |
341 new_traces = { | |
342 description: [str(value), str(0.0)] | |
343 } | |
344 | |
345 new_line = { | |
346 'rev': revision, | |
347 'traces': new_traces | |
348 } | |
349 | 349 |
350 if seen_key in self._seen_graph_lines: | 350 if seen_key in self._seen_graph_lines: |
dennis_jeffrey
2012/08/29 18:47:51
FYI: The reason for "seen_key" and "self._seen_gra
Dai Mikurube (NOT FULLTIME)
2012/08/30 02:24:11
Thanks for the description. Hmm, my question is:
dennis_jeffrey
2012/08/30 17:13:23
I am not totally clear on exactly what you mean, b
Dai Mikurube (NOT FULLTIME)
2012/09/04 04:32:58
Ok, I'll try it when I have time. Thanks. :)
| |
351 # Update results for the most recent revision. | 351 # Update results for the most recent revision. |
352 existing_lines[0] = new_line | 352 existing_lines[0] = new_line |
353 else: | 353 else: |
354 # New results for a new revision. | 354 # New results for a new revision. |
355 existing_lines.insert(0, new_line) | 355 existing_lines.insert(0, new_line) |
356 self._seen_graph_lines[seen_key] = True | 356 self._seen_graph_lines[seen_key] = True |
357 | 357 |
358 existing_lines = map(str, existing_lines) | 358 existing_lines = map(str, existing_lines) |
359 with open(data_file, 'w') as f: | 359 with open(data_file, 'w') as f: |
360 f.write('\n'.join(existing_lines)) | 360 f.write('\n'.join(existing_lines)) |
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2653 """Identifies the port number to which the server is currently bound. | 2653 """Identifies the port number to which the server is currently bound. |
2654 | 2654 |
2655 Returns: | 2655 Returns: |
2656 The numeric port number to which the server is currently bound. | 2656 The numeric port number to which the server is currently bound. |
2657 """ | 2657 """ |
2658 return self._server.server_address[1] | 2658 return self._server.server_address[1] |
2659 | 2659 |
2660 | 2660 |
2661 if __name__ == '__main__': | 2661 if __name__ == '__main__': |
2662 pyauto_functional.Main() | 2662 pyauto_functional.Main() |
OLD | NEW |