OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 import BaseHTTPServer | 24 import BaseHTTPServer |
25 import commands | 25 import commands |
26 import logging | 26 import logging |
27 import math | 27 import math |
28 import os | 28 import os |
29 import posixpath | 29 import posixpath |
30 import re | 30 import re |
31 import SimpleHTTPServer | 31 import SimpleHTTPServer |
32 import SocketServer | 32 import SocketServer |
| 33 import sys |
33 import tempfile | 34 import tempfile |
34 import threading | 35 import threading |
35 import time | 36 import time |
36 import timeit | 37 import timeit |
37 import urllib | 38 import urllib |
38 import urllib2 | 39 import urllib2 |
39 import urlparse | 40 import urlparse |
40 | 41 |
41 import pyauto_functional # Must be imported before pyauto. | 42 import pyauto_functional # Must be imported before pyauto. |
42 import pyauto | 43 import pyauto |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 database. | 129 database. |
129 value: A numeric value representing a single performance measurement. | 130 value: A numeric value representing a single performance measurement. |
130 """ | 131 """ |
131 if self.IsChromeOS(): | 132 if self.IsChromeOS(): |
132 if len(description) > 30: | 133 if len(description) > 30: |
133 logging.warning('The description "%s" will be truncated to "%s" ' | 134 logging.warning('The description "%s" will be truncated to "%s" ' |
134 '(length 30) when added to the autotest database.', | 135 '(length 30) when added to the autotest database.', |
135 description, description[:30]) | 136 description, description[:30]) |
136 print '\n%s(\'%s\', %.2f)%s' % (self._PERF_OUTPUT_MARKER_PRE, description, | 137 print '\n%s(\'%s\', %.2f)%s' % (self._PERF_OUTPUT_MARKER_PRE, description, |
137 value, self._PERF_OUTPUT_MARKER_POST) | 138 value, self._PERF_OUTPUT_MARKER_POST) |
| 139 sys.stdout.flush() |
138 | 140 |
139 def _PrintSummaryResults(self, description, values, units): | 141 def _PrintSummaryResults(self, description, values, units): |
140 """Logs summary measurement information. | 142 """Logs summary measurement information. |
141 | 143 |
142 This function computes and outputs the average and standard deviation of | 144 This function computes and outputs the average and standard deviation of |
143 the specified list of value measurements. It also invokes | 145 the specified list of value measurements. It also invokes |
144 _OutputPerfGraphValue() with the computed *average* value, to ensure the | 146 _OutputPerfGraphValue() with the computed *average* value, to ensure the |
145 average value can be plotted in a performance graph. | 147 average value can be plotted in a performance graph. |
146 | 148 |
147 Args: | 149 Args: |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 """Identifies the port number to which the server is currently bound. | 1460 """Identifies the port number to which the server is currently bound. |
1459 | 1461 |
1460 Returns: | 1462 Returns: |
1461 The numeric port number to which the server is currently bound. | 1463 The numeric port number to which the server is currently bound. |
1462 """ | 1464 """ |
1463 return self._server.server_address[1] | 1465 return self._server.server_address[1] |
1464 | 1466 |
1465 | 1467 |
1466 if __name__ == '__main__': | 1468 if __name__ == '__main__': |
1467 pyauto_functional.Main() | 1469 pyauto_functional.Main() |
OLD | NEW |