Commit 5b0867f7 authored by Juan Antonio Navarro Perez's avatar Juan Antonio Navarro Perez Committed by Commit Bot

[tools/cygprofile] Migrate orderfile_generator away from chartjson

Replace instead with a simpler csv based implementation.

Bug: 981605
Change-Id: I901601136a43833b8c83ef2f77117e4ba22014cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869417
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Reviewed-by: default avatarChristopher Grant <cjgrant@chromium.org>
Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707814}
parent c0fe960d
...@@ -855,40 +855,32 @@ class OrderfileGenerator(object): ...@@ -855,40 +855,32 @@ class OrderfileGenerator(object):
'--device={}'.format( '--device={}'.format(
self._profiler._device.serial), self._profiler._device.serial),
'--browser=exact', '--browser=exact',
'--output-format=chartjson', '--output-format=csv',
'--output-dir={}'.format(out_dir), '--output-dir={}'.format(out_dir),
'--reset-results', '--reset-results',
'--browser-executable={}'.format(apk), '--browser-executable={}'.format(apk),
'orderfile.memory_mobile']) 'orderfile.memory_mobile'])
out_file_path = os.path.join(out_dir, 'results-chart.json') out_file_path = os.path.join(out_dir, 'results.csv')
if not os.path.exists(out_file_path): if not os.path.exists(out_file_path):
raise Exception('Results file not found!') raise Exception('Results file not found!')
results = {}
with open(out_file_path, 'r') as f: with open(out_file_path, 'r') as f:
json_results = json.load(f) reader = csv.DictReader(f)
for row in reader:
if not json_results: if not row['name'].endswith('NativeCodeResidentMemory'):
raise Exception('Results file is empty')
if not 'charts' in json_results:
raise Exception('charts can not be found in results!')
charts = json_results['charts']
results = dict()
for story in charts:
if not story.endswith("NativeCodeResidentMemory_avg"):
continue
results[story] = dict()
for substory in charts[story]:
if substory == 'summary':
continue continue
if not 'values' in charts[story][substory]: # Note: NativeCodeResidentMemory records a single sample from each
raise Exception( # story run, so this average (reported as 'avg') is exactly the value
'Values can not be found in charts:%s:%s' % (story, substory)) # of that one sample. Each story is run multiple times, so this loop
# will accumulate into a list all values for all runs of each story.
results.setdefault(row['name'], {}).setdefault(
row['stories'], []).append(row['avg'])
if not results:
raise Exception('Could not find relevant results')
results[story][substory] = charts[story][substory]['values']
return results return results
except Exception as e: except Exception as e:
......
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