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

Unified Diff: tracing/bin/histograms2csv

Issue 2508643002: Convert Histograms to CSV. (Closed)
Patch Set: simplify test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tracing/trace_viewer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « no previous file | tracing/trace_viewer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698