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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 the |units_x| argument must also be specified. | 369 the |units_x| argument must also be specified. |
370 units: A string representing the units of the performance measurement(s). | 370 units: A string representing the units of the performance measurement(s). |
371 Should not include spaces. | 371 Should not include spaces. |
372 graph_name: A string name for the graph associated with this performance | 372 graph_name: A string name for the graph associated with this performance |
373 value. Only used on Chrome desktop. | 373 value. Only used on Chrome desktop. |
374 units_x: A string representing the units of the x-axis values associated | 374 units_x: A string representing the units of the x-axis values associated |
375 with the performance measurements, such as 'iteration' if the x values | 375 with the performance measurements, such as 'iteration' if the x values |
376 are iteration numbers. If this argument is specified, then the | 376 are iteration numbers. If this argument is specified, then the |
377 |value| argument must be a list of (x, y) tuples. | 377 |value| argument must be a list of (x, y) tuples. |
378 """ | 378 """ |
379 if isinstance(value, list) and value[0] and isinstance(value[0], tuple): | 379 if (isinstance(value, list) and value[0] is not None and |
| 380 isinstance(value[0], tuple)): |
380 assert units_x | 381 assert units_x |
381 if units_x: | 382 if units_x: |
382 assert isinstance(value, list) | 383 assert isinstance(value, list) |
383 | 384 |
384 if self.IsChromeOS(): | 385 if self.IsChromeOS(): |
385 # ChromeOS results don't support lists. | 386 # ChromeOS results don't support lists. |
386 if (isinstance(value, list) and value[0] and | 387 if (isinstance(value, list) and value[0] is not None and |
387 not isinstance(value[0], tuple)): | 388 not isinstance(value[0], tuple)): |
388 value = Mean(value) | 389 value = Mean(value) |
389 | 390 |
390 if units_x: | 391 if units_x: |
391 # TODO(dennisjeffrey): Support long-running performance measurements on | 392 # TODO(dennisjeffrey): Support long-running performance measurements on |
392 # ChromeOS in a way that can be graphed: crosbug.com/21881. | 393 # ChromeOS in a way that can be graphed: crosbug.com/21881. |
393 pyauto_utils.PrintPerfResult(graph_name, description, value, | 394 pyauto_utils.PrintPerfResult(graph_name, description, value, |
394 units + ' ' + units_x) | 395 units + ' ' + units_x) |
395 else: | 396 else: |
396 # Output short-running performance results in a format understood by | 397 # Output short-running performance results in a format understood by |
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 """Identifies the port number to which the server is currently bound. | 2510 """Identifies the port number to which the server is currently bound. |
2510 | 2511 |
2511 Returns: | 2512 Returns: |
2512 The numeric port number to which the server is currently bound. | 2513 The numeric port number to which the server is currently bound. |
2513 """ | 2514 """ |
2514 return self._server.server_address[1] | 2515 return self._server.server_address[1] |
2515 | 2516 |
2516 | 2517 |
2517 if __name__ == '__main__': | 2518 if __name__ == '__main__': |
2518 pyauto_functional.Main() | 2519 pyauto_functional.Main() |
OLD | NEW |