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):
'--device={}'.format(
self._profiler._device.serial),
'--browser=exact',
'--output-format=chartjson',
'--output-format=csv',
'--output-dir={}'.format(out_dir),
'--reset-results',
'--browser-executable={}'.format(apk),
'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):
raise Exception('Results file not found!')
results = {}
with open(out_file_path, 'r') as f:
json_results = json.load(f)
if not json_results:
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"):
reader = csv.DictReader(f)
for row in reader:
if not row['name'].endswith('NativeCodeResidentMemory'):
continue
# Note: NativeCodeResidentMemory records a single sample from each
# story run, so this average (reported as 'avg') is exactly the value
# 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'])
results[story] = dict()
for substory in charts[story]:
if substory == 'summary':
continue
if not 'values' in charts[story][substory]:
raise Exception(
'Values can not be found in charts:%s:%s' % (story, substory))
if not results:
raise Exception('Could not find relevant results')
results[story][substory] = charts[story][substory]['values']
return results
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