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

Side by Side Diff: tracing/bin/histograms2csv

Issue 3003163002: Add CsvOutputFormatter to Telemetry. (Closed)
Patch Set: Created 3 years, 3 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
« no previous file with comments | « telemetry/telemetry/internal/results/results_options.py ('k') | tracing/tracing/base/unit.html » ('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 codecs 7 import codecs
8 import json 8 import json
9 import sys 9 import sys
10 import os 10 import os
11 11
12 tracing_path = os.path.abspath(os.path.join( 12 tracing_path = os.path.abspath(os.path.join(
13 os.path.dirname(os.path.realpath(__file__)), '..')) 13 os.path.dirname(os.path.realpath(__file__)), '..'))
14 sys.path.append(tracing_path) 14 sys.path.append(tracing_path)
15 import tracing_project 15 import tracing_project
16 tracing_project.UpdateSysPathIfNeeded() 16 tracing_project.UpdateSysPathIfNeeded()
17 import vinn
18 17
19 18 from tracing.value import histograms_to_csv
20 _HISTOGRAMS_TO_CSV_CMD_LINE = os.path.join(
21 tracing_path, 'tracing', 'value', 'histograms_to_csv_cmdline.html')
22 19
23 20
24 def main(): 21 def main():
25 parser = argparse.ArgumentParser( 22 parser = argparse.ArgumentParser(
26 description='Upgrade a results2 instance or add a new HistogramSet.', 23 description='Upgrade a results2 instance or add a new HistogramSet.',
27 add_help=False) 24 add_help=False)
28 parser.add_argument('json_path', 25 parser.add_argument('json_path',
29 help='HistogramSet JSON file path (input).') 26 help='HistogramSet JSON file path (input).')
30 parser.add_argument('csv_path', 27 parser.add_argument('csv_path',
31 help='CSV file path (output).') 28 help='CSV file path (output).')
32 parser.add_argument('-h', '--help', action='help', 29 parser.add_argument('-h', '--help', action='help',
33 help='Show this help message and exit.') 30 help='Show this help message and exit.')
34 args = parser.parse_args() 31 args = parser.parse_args()
35 result = vinn.RunFile( 32 result = histograms_to_csv.HistogramsToCsv(args.json_path)
36 _HISTOGRAMS_TO_CSV_CMD_LINE,
37 source_paths=list(tracing_project.TracingProject().source_paths),
38 js_args=[os.path.abspath(args.json_path)])
39 if result.returncode != 0: 33 if result.returncode != 0:
40 sys.stderr.write(result.stdout) 34 sys.stderr.write(result.stdout)
41 else: 35 else:
42 file(args.csv_path, 'w').write(result.stdout) 36 file(args.csv_path, 'w').write(result.stdout)
43 return result.returncode 37 return result.returncode
44 38
45 if __name__ == '__main__': 39 if __name__ == '__main__':
46 sys.exit(main()) 40 sys.exit(main())
OLDNEW
« no previous file with comments | « telemetry/telemetry/internal/results/results_options.py ('k') | tracing/tracing/base/unit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698