Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: chrome/test/functional/perf.py

Issue 8342055: Added some comments and a warning message to pyauto perf tests in perf.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if values: 105 if values:
106 avg = float(sum(values)) / len(values) 106 avg = float(sum(values)) / len(values)
107 if len(values) > 1: 107 if len(values) > 1:
108 temp_vals = [math.pow(x - avg, 2) for x in values] 108 temp_vals = [math.pow(x - avg, 2) for x in values]
109 std_dev = math.sqrt(sum(temp_vals) / (len(temp_vals) - 1)) 109 std_dev = math.sqrt(sum(temp_vals) / (len(temp_vals) - 1))
110 return avg, std_dev 110 return avg, std_dev
111 111
112 def _OutputPerfGraphValue(self, description, value): 112 def _OutputPerfGraphValue(self, description, value):
113 """Outputs a performance value to have it graphed on the performance bots. 113 """Outputs a performance value to have it graphed on the performance bots.
114 114
115 Only used for ChromeOS. 115 Only used for ChromeOS. The performance bots have a 30-character limit on
116 the length of the description for a performance value. Any characters
117 beyond that are truncated before results are stored in the autotest
118 database.
116 119
117 Args: 120 Args:
118 description: A string description of the performance value. 121 description: A string description of the performance value. This will
122 be truncated to 30 characters when stored in the autotest
123 database.
119 value: A numeric value representing a single performance measurement. 124 value: A numeric value representing a single performance measurement.
120 """ 125 """
121 if self.IsChromeOS(): 126 if self.IsChromeOS():
127 if len(description) > 30:
128 logging.warning('The description "%s" will be truncated to "%s" '
129 '(length 30) when added to the autotest database.' %
truty 2011/10/20 00:12:01 Not a big deal, but I think it's preferred when ca
dennis_jeffrey 2011/10/20 01:18:21 Done (also changed in several other places in this
130 (description, description[:30]))
122 print '\n%s(\'%s\', %.2f)%s' % (self._PERF_OUTPUT_MARKER_PRE, description, 131 print '\n%s(\'%s\', %.2f)%s' % (self._PERF_OUTPUT_MARKER_PRE, description,
123 value, self._PERF_OUTPUT_MARKER_POST) 132 value, self._PERF_OUTPUT_MARKER_POST)
124 133
125 def _PrintSummaryResults(self, description, values, units): 134 def _PrintSummaryResults(self, description, values, units):
126 """Logs summary measurement information. 135 """Logs summary measurement information.
127 136
137 This function computes and outputs the average and standard deviation of
138 the specified list of value measurements. It also invokes
139 _OutputPerfGraphValue() with the computed *average* value, to ensure the
140 average value can be plotted in a performance graph.
141
128 Args: 142 Args:
129 description: A string description for the specified results. 143 description: A string description for the specified results.
130 values: A list of numeric value measurements. 144 values: A list of numeric value measurements.
131 units: A string specifying the units for the specified measurements. 145 units: A string specifying the units for the specified measurements.
132 """ 146 """
133 logging.info('Results for: ' + description) 147 logging.info('Results for: ' + description)
134 if values: 148 if values:
135 avg, std_dev = self._AvgAndStdDev(values) 149 avg, std_dev = self._AvgAndStdDev(values)
136 logging.info('Number of iterations: %d', len(values)) 150 logging.info('Number of iterations: %d', len(values))
137 for val in values: 151 for val in values:
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 """Identifies the port number to which the server is currently bound. 891 """Identifies the port number to which the server is currently bound.
878 892
879 Returns: 893 Returns:
880 The numeric port number to which the server is currently bound. 894 The numeric port number to which the server is currently bound.
881 """ 895 """
882 return self._server.server_address[1] 896 return self._server.server_address[1]
883 897
884 898
885 if __name__ == '__main__': 899 if __name__ == '__main__':
886 pyauto_functional.Main() 900 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698