Commit 3ca3fb27 authored by Jamie Madill's avatar Jamie Madill Committed by Commit Bot

Add multi results in legacy perf dashboard script.

Currently when the script reads multiple results it outputs the
last value read as well as a zero placehold for standard deviation.

According to benjhayden@ we can return all results in an array.
This change does just that and adds a test. It also updates the
expected unit test output.

Bug: 900677
Change-Id: Icc38808ea83caddbdf6b8582e2ddc34db4f8cdf0
Reviewed-on: https://chromium-review.googlesource.com/c/1338468Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608882}
parent 4d0e4483
...@@ -73,15 +73,9 @@ class LegacyResultsProcessor(object): ...@@ -73,15 +73,9 @@ class LegacyResultsProcessor(object):
def __init__(self): def __init__(self):
self.important = False self.important = False
self.value = 0.0 self.values = []
self.stddev = 0.0 self.stddev = 0.0
def __str__(self):
result = _FormatHumanReadable(self.value)
if self.stddev:
result += '+/-%s' % _FormatHumanReadable(self.stddev)
return result
class Graph(object): class Graph(object):
"""Encapsulates a set of points that should appear on the same graph.""" """Encapsulates a set of points that should appear on the same graph."""
...@@ -100,7 +94,7 @@ class LegacyResultsProcessor(object): ...@@ -100,7 +94,7 @@ class LegacyResultsProcessor(object):
"""Returns a dictionary mapping trace names to [value, stddev].""" """Returns a dictionary mapping trace names to [value, stddev]."""
traces_dict = {} traces_dict = {}
for name, trace in self.traces.items(): for name, trace in self.traces.items():
traces_dict[name] = [str(trace.value), str(trace.stddev)] traces_dict[name] = trace.values
return traces_dict return traces_dict
...@@ -141,37 +135,39 @@ class LegacyResultsProcessor(object): ...@@ -141,37 +135,39 @@ class LegacyResultsProcessor(object):
graph = self._graphs.get(graph_name, self.Graph()) graph = self._graphs.get(graph_name, self.Graph())
graph.units = (match_dict['UNITS'] or '').strip() graph.units = (match_dict['UNITS'] or '').strip()
trace = graph.traces.get(trace_name, self.Trace()) trace = graph.traces.get(trace_name, self.Trace())
trace.value = match_dict['VALUE'] value = match_dict['VALUE']
trace.important = match_dict['IMPORTANT'] or False trace.important = match_dict['IMPORTANT'] or False
# Compute the mean and standard deviation for a list or a histogram, # Compute the mean and standard deviation for a list or a histogram,
# or the numerical value of a scalar value. # or the numerical value of a scalar value.
if trace.value.startswith('['): if value.startswith('['):
try: try:
value_list = [float(x) for x in trace.value.strip('[],').split(',')] value_list = [float(x) for x in value.strip('[],').split(',')]
except ValueError: except ValueError:
# Report, but ignore, corrupted data lines. (Lines that are so badly # Report, but ignore, corrupted data lines. (Lines that are so badly
# broken that they don't even match the RESULTS_REGEX won't be # broken that they don't even match the RESULTS_REGEX won't be
# detected.) # detected.)
logging.warning("Bad test output: '%s'" % trace.value.strip()) logging.warning("Bad test output: '%s'" % value.strip())
return return
trace.value, trace.stddev, filedata = self._CalculateStatistics( value, trace.stddev, filedata = self._CalculateStatistics(
value_list, trace_name) value_list, trace_name)
assert filedata is not None assert filedata is not None
for filename in filedata: for filename in filedata:
self._PrependLog(filename, filedata[filename]) self._PrependLog(filename, filedata[filename])
elif trace.value.startswith('{'): trace.values += value_list
stripped = trace.value.strip('{},') elif value.startswith('{'):
stripped = value.strip('{},')
try: try:
trace.value, trace.stddev = [float(x) for x in stripped.split(',')] value, trace.stddev = [float(x) for x in stripped.split(',')]
except ValueError: except ValueError:
logging.warning("Bad test output: '%s'" % trace.value.strip()) logging.warning("Bad test output: '%s'" % value.strip())
return return
trace.values.append(value)
else: else:
try: try:
trace.value = float(trace.value) trace.values.append(float(value))
except ValueError: except ValueError:
logging.warning("Bad test output: '%s'" % trace.value.strip()) logging.warning("Bad test output: '%s'" % value.strip())
return return
graph.traces[trace_name] = trace graph.traces[trace_name] = trace
......
{"traces": {"trace_with_one_sample": ["177.0", "0.0"], "trace_with_one_sample_comma": ["177.0", "0.0"], "trace_with_three_samples": ["140.0", "43.2049379894"], "trace_with_three_samples_comma": ["140.0", "43.2049379894"]}, "units": "you-nits"} {"traces": {"trace_with_multiple_samples": [100.0, 200.0, 300.0, 400.0], "trace_with_one_sample": [177.0], "trace_with_one_sample_comma": [177.0], "trace_with_three_samples": [100.0, 120.0, 200.0], "trace_with_three_samples_comma": [100.0, 120.0, 200.0]}, "units": "you-nits"}
\ No newline at end of file
{"traces": {"12t_cc": ["50200.0", "0.0"], "1t_cc": ["22536.0", "0.0"], "1t_cc_ref": ["22536.0", "0.0"], "5t_cc": ["49412.0", "0.0"]}, "important": ["12t_cc", "1t_cc", "1t_cc_ref", "5t_cc"], "units": "kb"} {"important": ["12t_cc", "1t_cc", "1t_cc_ref", "5t_cc"], "traces": {"12t_cc": [50200.0], "1t_cc": [22536.0], "1t_cc_ref": [22536.0], "5t_cc": [49412.0]}, "units": "kb"}
\ No newline at end of file
...@@ -47,3 +47,10 @@ RESULT artificial_graph: trace_with_one_sample= [177.0] you-nits ...@@ -47,3 +47,10 @@ RESULT artificial_graph: trace_with_one_sample= [177.0] you-nits
RESULT artificial_graph: trace_with_one_sample_comma= [177.0,] you-nits RESULT artificial_graph: trace_with_one_sample_comma= [177.0,] you-nits
RESULT artificial_graph: trace_with_three_samples= [100.0,120.0,200.0] you-nits RESULT artificial_graph: trace_with_three_samples= [100.0,120.0,200.0] you-nits
RESULT artificial_graph: trace_with_three_samples_comma= [100.0,120.0,200.0,] you-nits RESULT artificial_graph: trace_with_three_samples_comma= [100.0,120.0,200.0,] you-nits
# Artificial log output to test multiple results with the same name
RESULT artificial_graph: trace_with_multiple_samples= 100 you-nits
RESULT artificial_graph: trace_with_multiple_samples= 200 you-nits
RESULT artificial_graph: trace_with_multiple_samples= 300 you-nits
RESULT artificial_graph: trace_with_multiple_samples= 400 you-nits
{"traces": {"1t_proc": ["2.0", "0.0"], "1t_proc_ref": ["1.0", "0.0"], "12t_proc": ["3.0", "0.0"], "5t_proc": ["3.0", "0.0"]}, "units": ""} {"traces": {"12t_proc": [3.0], "1t_proc": [2.0], "1t_proc_ref": [1.0], "5t_proc": [3.0]}, "units": ""}
\ No newline at end of file
{"traces": {"1t_vm_b": ["8712.0", "0.0"], "1t_vm_b_ref": ["5712.0", "0.0"], "12t_vm_b": ["10556.0", "0.0"], "5t_vm_b": ["10404.0", "0.0"]}, "units": "kb"} {"traces": {"12t_vm_b": [10556.0], "1t_vm_b": [8712.0], "1t_vm_b_ref": [5712.0], "5t_vm_b": [10404.0]}, "units": "kb"}
\ No newline at end of file
{"traces": {"1t_vm": ["29696.0", "0.0"], "1t_vm_ref": ["9696.0", "0.0"], "12t_vm": ["55740.0", "0.0"], "5t_vm": ["54936.0", "0.0"]}, "units": "kb"} {"traces": {"12t_vm": [55740.0], "1t_vm": [29696.0], "1t_vm_ref": [9696.0], "5t_vm": [54936.0]}, "units": "kb"}
\ No newline at end of file
{"traces": {"1t_ws_b": ["16892.0", "0.0"], "1t_ws_b_ref": ["26892.0", "0.0"], "12t_ws_b": ["18612.0", "0.0"], "5t_ws_b": ["18504.0", "0.0"]}, "units": "kb"} {"traces": {"12t_ws_b": [18612.0], "1t_ws_b": [16892.0], "1t_ws_b_ref": [26892.0], "5t_ws_b": [18504.0]}, "units": "kb"}
\ No newline at end of file
{"traces": {"12t_ws": ["63984.0", "0.0"], "1t_ws": ["41960.0", "0.0"], "1t_ws_ref": ["41960.0", "0.0"], "5t_ws": ["63276.0", "0.0"]}, "important": ["12t_ws", "1t_ws", "1t_ws_ref", "5t_ws"], "units": "kb"} {"important": ["12t_ws", "1t_ws", "1t_ws_ref", "5t_ws"], "traces": {"12t_ws": [63984.0], "1t_ws": [41960.0], "1t_ws_ref": [41960.0], "5t_ws": [63276.0]}, "units": "kb"}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment