| 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_lines[0]| is the latest. |
| 328 if units_x: | 329 if units_x: |
| 329 points = [] | 330 new_line = { |
| 331 'rev': revision, |
| 332 'traces': { description: [] } |
| 333 } |
| 330 if seen_key in self._seen_graph_lines: | 334 if seen_key in self._seen_graph_lines: |
| 331 # We've added points previously for this graph line in the current | 335 # We've added points previously for this graph line in the current |
| 332 # test execution, so retrieve the original set of points specified in | 336 # test execution, so retrieve the original set of points specified in |
| 333 # the most recent revision in the data file. | 337 # the most recent revision in the data file. |
| 334 points = existing_lines[0]['traces'][description] | 338 new_line = existing_lines[0] |
| 339 if not description in new_line['traces']: |
| 340 new_line['traces'][description] = [] |
| 335 for x_value, y_value in value: | 341 for x_value, y_value in value: |
| 336 points.append([str(x_value), str(y_value)]) | 342 new_line['traces'][description].append([str(x_value), str(y_value)]) |
| 337 new_traces = { | 343 else: |
| 338 description: points | 344 new_line = { |
| 345 'rev': revision, |
| 346 'traces': { description: [str(value), str(0.0)] } |
| 339 } | 347 } |
| 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 | 348 |
| 350 if seen_key in self._seen_graph_lines: | 349 if seen_key in self._seen_graph_lines: |
| 351 # Update results for the most recent revision. | 350 # Update results for the most recent revision. |
| 352 existing_lines[0] = new_line | 351 existing_lines[0] = new_line |
| 353 else: | 352 else: |
| 354 # New results for a new revision. | 353 # New results for a new revision. |
| 355 existing_lines.insert(0, new_line) | 354 existing_lines.insert(0, new_line) |
| 356 self._seen_graph_lines[seen_key] = True | 355 self._seen_graph_lines[seen_key] = True |
| 357 | 356 |
| 358 existing_lines = map(str, existing_lines) | 357 existing_lines = map(str, existing_lines) |
| (...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2661 """Identifies the port number to which the server is currently bound. | 2660 """Identifies the port number to which the server is currently bound. |
| 2662 | 2661 |
| 2663 Returns: | 2662 Returns: |
| 2664 The numeric port number to which the server is currently bound. | 2663 The numeric port number to which the server is currently bound. |
| 2665 """ | 2664 """ |
| 2666 return self._server.server_address[1] | 2665 return self._server.server_address[1] |
| 2667 | 2666 |
| 2668 | 2667 |
| 2669 if __name__ == '__main__': | 2668 if __name__ == '__main__': |
| 2670 pyauto_functional.Main() | 2669 pyauto_functional.Main() |
| OLD | NEW |