Index: tracing/bin/chartjson2histograms |
diff --git a/tracing/bin/chartjson2histograms b/tracing/bin/chartjson2histograms |
new file mode 100755 |
index 0000000000000000000000000000000000000000..cdf76b82efd35967fe3801a33c52712f231806d0 |
--- /dev/null |
+++ b/tracing/bin/chartjson2histograms |
@@ -0,0 +1,35 @@ |
+#!/usr/bin/env python |
eakuefner
2016/11/18 21:37:11
no need
|
+# 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 json |
+import os |
+import sys |
+ |
+tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__), |
+ '..')) |
+sys.path.append(tracing_path) |
+from tracing.value import convert_chart_json |
+ |
+ |
+def Main(argv): |
+ parser = argparse.ArgumentParser( |
+ description='Compare samples.') |
+ parser.add_argument('chart_json', type=str, help='(input)') |
+ parser.add_argument('histogram_json', type=str, help='(input/output)') |
+ args = parser.parse_args(argv[1:]) |
+ |
+ vinn_result = convert_chart_json.ConvertChartJson(args.chart_json) |
+ |
+ if vinn_result.returncode == 0: |
+ histograms = json.loads(vinn_result.stdout) |
+ if os.path.exists(args.histogram_json): |
+ histograms.extend(json.load(file(args.histogram_json, 'r'))) |
+ json.dump(histograms, file(args.histogram_json, 'w')) |
+ |
+ return vinn_result.returncode |
+ |
+if __name__ == '__main__': |
+ sys.exit(Main(sys.argv)) |