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

Unified Diff: chrome/test/functional/perf/endure_result_parser.py

Issue 10960009: Allow multiple performance values in endure_result_parser.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/perf/endure_result_parser.py
diff --git a/chrome/test/functional/perf/endure_result_parser.py b/chrome/test/functional/perf/endure_result_parser.py
index e5780fa1530454af3fa737762d7f36a13f3120b3..f8d0c801abd6869d41d80b540fa54f970c17cf47 100755
--- a/chrome/test/functional/perf/endure_result_parser.py
+++ b/chrome/test/functional/perf/endure_result_parser.py
@@ -118,15 +118,14 @@ def WriteToDataFile(new_line, existing_lines, revision, data_file):
os.chmod(data_file, 0755)
-def OutputPerfData(revision, graph_name, description, value, units, units_x,
- dest_dir):
+def OutputPerfData(revision, graph_name, values, units, units_x, dest_dir):
"""Outputs perf data to a local text file to be graphed.
Args:
revision: The string revision number associated with the perf data.
graph_name: The string name of the graph on which to plot the data.
- description: A string description of the perf value to be graphed.
- value: Either a single data value to be graphed, or a list of 2-tuples
+ values: A dict which maps a description to a value. A value is either a
+ single data value to be graphed, or a list of 2-tuples
representing (x, y) points to be graphed for long-running tests.
units: The string description for the y-axis units on the graph.
units_x: The string description for the x-axis units on the graph. Should
@@ -166,17 +165,16 @@ def OutputPerfData(revision, graph_name, description, value, units, units_x,
with open(data_file, 'r') as f:
existing_lines = f.readlines()
existing_lines = map(lambda x: x.strip(), existing_lines)
- if units_x:
- points = []
- for point in value:
- points.append([str(point[0]), str(point[1])])
- new_traces = {
- description: points
- }
- else:
- new_traces = {
- description: [str(value), str(0.0)]
- }
+ new_traces = {}
+ for description in values:
+ value = values[description]
+ if units_x:
+ points = []
+ for point in value:
+ points.append([str(point[0]), str(point[1])])
+ new_traces[description] = points
+ else:
+ new_traces[description] = [str(value), str(0.0)]
new_line = {
'traces': new_traces,
'rev': revision
@@ -185,13 +183,13 @@ def OutputPerfData(revision, graph_name, description, value, units, units_x,
WriteToDataFile(new_line, existing_lines, revision, data_file)
-def OutputEventData(revision, description, event_list, dest_dir):
+def OutputEventData(revision, event_dict, dest_dir):
"""Outputs event data to a local text file to be graphed.
Args:
revision: The string revision number associated with the event data.
- description: A string description of the event values to be graphed.
- event_list: An array of tuples representing event data to be graphed.
+ event_dict: A dict which maps a description to an array of tuples
+ representing event data to be graphed.
dest_dir: The name of the destination directory to which to write.
"""
data_file_name = '_EVENT_-summary.dat'
@@ -202,12 +200,13 @@ def OutputEventData(revision, description, event_list, dest_dir):
existing_lines = f.readlines()
existing_lines = map(lambda x: x.strip(), existing_lines)
- value_list = []
- for event_time, event_data in event_list:
- value_list.append([str(event_time), event_data])
- new_events = {
- description: value_list
- }
+ new_events = {}
+ for description in event_dict:
+ event_list = event_dict[description]
+ value_list = []
+ for event_time, event_data in event_list:
+ value_list.append([str(event_time), event_data])
+ new_events[description] = value_list
new_line = {
'rev': revision,
@@ -345,16 +344,26 @@ def UpdatePerfDataForSlaveAndBuild(slave_info, build_num):
# results, keep just one if more than one is specified.
perf_data = {} # Maps a graph-line key to a perf data dictionary.
for data in perf_data_raw:
- key = data['graph_name'] + '|' + data['description']
+ key1 = data['graph_name']
dennis_jeffrey 2012/09/26 00:34:29 use a more descriptive variable name, such as "key
Dai Mikurube (NOT FULLTIME) 2012/09/26 02:44:51 Done.
+ key2 = data['description']
dennis_jeffrey 2012/09/26 00:34:29 use a more descriptive variable name, such as "key
Dai Mikurube (NOT FULLTIME) 2012/09/26 02:44:51 Done.
+ if not key1 in perf_data:
+ perf_data[key1] = {
+ 'graph_name': data['graph_name'],
+ 'value': {},
+ 'units': data['units'],
+ 'units_x': data['units_x'],
+ 'webapp_name': data['webapp_name'],
+ 'test_name': data['test_name'],
+ }
if data['graph_name'] != '_EVENT_' and not data['units_x']:
# Short-running test result.
- perf_data[key] = data
+ perf_data[key1]['value'][key2] = data['value']
else:
# Long-running test result or event.
- if key in perf_data:
- perf_data[key]['value'] += data['value']
+ if key2 in perf_data[key1]['value']:
+ perf_data[key1]['value'][key2] += data['value']
else:
- perf_data[key] = data
+ perf_data[key1]['value'][key2] = data['value']
# Finally, for each graph-line in |perf_data|, update the associated local
# graph data files if necessary.
@@ -370,11 +379,10 @@ def UpdatePerfDataForSlaveAndBuild(slave_info, build_num):
SetupBaseGraphDirIfNeeded(perf_data_dict['webapp_name'],
perf_data_dict['test_name'], dest_dir)
if perf_data_dict['graph_name'] == '_EVENT_':
- OutputEventData(revision, perf_data_dict['description'],
- perf_data_dict['value'], dest_dir)
+ OutputEventData(revision, perf_data_dict['value'], dest_dir)
else:
OutputPerfData(revision, perf_data_dict['graph_name'],
- perf_data_dict['description'], perf_data_dict['value'],
+ perf_data_dict['value'],
perf_data_dict['units'], perf_data_dict['units_x'],
dest_dir)
« 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