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

Side by Side Diff: build/android/pylib/instrumentation/json_perf_parser.py

Issue 132463007: Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase vs tot and only disabling F0401 in specific spots Created 6 years, 10 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 """A helper module for parsing JSON objects from perf tests results.""" 6 """A helper module for parsing JSON objects from perf tests results."""
7 7
8 import json 8 import json
9 9
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if result['min'] == -1 or result['min'] > delta: 118 if result['min'] == -1 or result['min'] > delta:
119 result['min'] = delta 119 result['min'] = delta
120 if result['max'] == -1 or result['max'] < delta: 120 if result['max'] == -1 or result['max'] < delta:
121 result['max'] = delta 121 result['max'] = delta
122 total_sum += delta 122 total_sum += delta
123 result['count'] += 1 123 result['count'] += 1
124 result['data_points'].append(delta) 124 result['data_points'].append(delta)
125 if entry['ph'] == 'I': 125 if entry['ph'] == 'I':
126 result['type'] = 'Instant' 126 result['type'] = 'Instant'
127 last_val = val 127 last_val = val
128 if result['count'] > 0: result['average'] = total_sum / result['count'] 128 if result['count'] > 0:
129 result['average'] = total_sum / result['count']
129 130
130 return result 131 return result
131 132
132 133
133 def GetAverageRunInfoFromJSONString(json_string, name): 134 def GetAverageRunInfoFromJSONString(json_string, name):
134 """Returns the results from GetAverageRunInfo using a JSON string. 135 """Returns the results from GetAverageRunInfo using a JSON string.
135 136
136 Args: 137 Args:
137 json_string: The string containing JSON. 138 json_string: The string containing JSON.
138 name: The 'name' tag to filter on in the JSON file. 139 name: The 'name' tag to filter on in the JSON file.
(...skipping 12 matching lines...) Expand all
151 name: The 'name' tag to filter on in the JSON file. 152 name: The 'name' tag to filter on in the JSON file.
152 153
153 Returns: 154 Returns:
154 See GetAverageRunInfo Returns section. 155 See GetAverageRunInfo Returns section.
155 """ 156 """
156 with open(json_file, 'r') as f: 157 with open(json_file, 'r') as f:
157 data = f.read() 158 data = f.read()
158 perf = json.loads(data) 159 perf = json.loads(data)
159 160
160 return GetAverageRunInfo(perf, name) 161 return GetAverageRunInfo(perf, name)
OLDNEW
« no previous file with comments | « build/android/pylib/host_driven/tests_annotations.py ('k') | build/android/pylib/instrumentation/setup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698