OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 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 |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import argparse |
| 7 import codecs |
| 8 import json |
| 9 import sys |
| 10 import os |
| 11 |
| 12 tracing_path = os.path.abspath(os.path.join( |
| 13 os.path.dirname(os.path.realpath(__file__)), '..')) |
| 14 sys.path.append(tracing_path) |
| 15 import tracing_project |
| 16 tracing_project.UpdateSysPathIfNeeded() |
| 17 import vinn |
| 18 |
| 19 |
| 20 _HISTOGRAMS_TO_CSV_CMD_LINE = os.path.join( |
| 21 tracing_path, 'tracing', 'value', 'histograms_to_csv_cmdline.html') |
| 22 |
| 23 |
| 24 def main(): |
| 25 parser = argparse.ArgumentParser( |
| 26 description='Upgrade a results2 instance or add a new HistogramSet.', |
| 27 add_help=False) |
| 28 parser.add_argument('json_path', |
| 29 help='HistogramSet JSON file path (input).') |
| 30 parser.add_argument('csv_path', |
| 31 help='CSV file path (output).') |
| 32 parser.add_argument('-h', '--help', action='help', |
| 33 help='Show this help message and exit.') |
| 34 args = parser.parse_args() |
| 35 result = vinn.RunFile( |
| 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: |
| 40 sys.stderr.write(result.stdout) |
| 41 else: |
| 42 file(args.csv_path, 'w').write(result.stdout) |
| 43 return result.returncode |
| 44 |
| 45 if __name__ == '__main__': |
| 46 sys.exit(main()) |
OLD | NEW |