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

Side by Side Diff: tracing/bin/results2json

Issue 2528113003: Revert of Convert chart-json to Histograms. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « telemetry/telemetry/internal/results/results_options.py ('k') | tracing/bin/valueset2html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved. 2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import json 7 import json
8 import sys 8 import sys
9 import os 9 import os
10 10
11 tracing_path = os.path.abspath(os.path.join( 11 tracing_path = os.path.abspath(os.path.join(
12 os.path.dirname(os.path.realpath(__file__)), '..')) 12 os.path.dirname(os.path.realpath(__file__)), '..'))
13 sys.path.append(tracing_path) 13 sys.path.append(tracing_path)
14 from tracing import results_renderer 14 from tracing import results_renderer
15 15
16 16
17 def main(): 17 def main():
18 parser = argparse.ArgumentParser( 18 parser = argparse.ArgumentParser(
19 description='Extract HistogramSet JSON from results2.html.', 19 description='Extract HistogramSet JSON from results2.html.',
20 add_help=False) 20 add_help=False)
21 parser.add_argument('html_path', metavar='HTML_PATH', 21 parser.add_argument('html_path', metavar='HTML_PATH',
22 help='HTML file path (input).') 22 help='HTML file path (input).')
23 parser.add_argument('json_path', metavar='JSON_PATH', 23 parser.add_argument('json_path', metavar='JSON_PATH',
24 help='JSON file path (input/output).') 24 help='JSON file path (input/output).')
25 parser.add_argument('-h', '--help', action='help', 25 parser.add_argument('-h', '--help', action='help',
26 help='Show this help message and exit.') 26 help='Show this help message and exit.')
27 args = parser.parse_args() 27 args = parser.parse_args()
28 28
29 histograms = results_renderer.ReadExistingResults( 29 histograms = results_renderer.ReadExistingResults(open(args.html_path, 'r'))
30 open(args.html_path, 'r').read())
31 if os.path.exists(args.json_path): 30 if os.path.exists(args.json_path):
32 histograms.extend(json.load(open(args.json_path, 'r'))) 31 histograms.extend(json.load(open(args.json_path, 'r')))
33 json.dump(histograms, open(args.json_path, 'w')) 32 json.dump(histograms, open(args.json_path, 'w'))
34 33
35 if __name__ == '__main__': 34 if __name__ == '__main__':
36 sys.exit(main()) 35 sys.exit(main())
OLDNEW
« no previous file with comments | « telemetry/telemetry/internal/results/results_options.py ('k') | tracing/bin/valueset2html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698