| Index: tracing/bin/histograms2csv
|
| diff --git a/tracing/bin/histograms2csv b/tracing/bin/histograms2csv
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..f39da4f9cbde36008e4187f3cb8bd83c75ef1831
|
| --- /dev/null
|
| +++ b/tracing/bin/histograms2csv
|
| @@ -0,0 +1,46 @@
|
| +#!/usr/bin/env python
|
| +# Copyright 2016 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import argparse
|
| +import codecs
|
| +import json
|
| +import sys
|
| +import os
|
| +
|
| +tracing_path = os.path.abspath(os.path.join(
|
| + os.path.dirname(os.path.realpath(__file__)), '..'))
|
| +sys.path.append(tracing_path)
|
| +import tracing_project
|
| +tracing_project.UpdateSysPathIfNeeded()
|
| +import vinn
|
| +
|
| +
|
| +_HISTOGRAMS_TO_CSV_CMD_LINE = os.path.join(
|
| + tracing_path, 'tracing', 'value', 'histograms_to_csv_cmdline.html')
|
| +
|
| +
|
| +def main():
|
| + parser = argparse.ArgumentParser(
|
| + description='Upgrade a results2 instance or add a new HistogramSet.',
|
| + add_help=False)
|
| + parser.add_argument('json_path',
|
| + help='HistogramSet JSON file path (input).')
|
| + parser.add_argument('csv_path',
|
| + help='CSV file path (output).')
|
| + parser.add_argument('-h', '--help', action='help',
|
| + help='Show this help message and exit.')
|
| + args = parser.parse_args()
|
| + result = vinn.RunFile(
|
| + _HISTOGRAMS_TO_CSV_CMD_LINE,
|
| + source_paths=list(tracing_project.TracingProject().source_paths),
|
| + js_args=[os.path.abspath(args.json_path)])
|
| + if result.returncode != 0:
|
| + sys.stderr.write(result.stdout)
|
| + else:
|
| + file(args.csv_path, 'w').write(result.stdout)
|
| + return result.returncode
|
| +
|
| +if __name__ == '__main__':
|
| + sys.exit(main())
|
|
|