Index: tracing/bin/compare_samples |
diff --git a/tracing/bin/compare_samples b/tracing/bin/compare_samples |
new file mode 100755 |
index 0000000000000000000000000000000000000000..79de14d059e4aab6cf5bbef4d03d8d5b1cdf4a29 |
--- /dev/null |
+++ b/tracing/bin/compare_samples |
@@ -0,0 +1,53 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2016 The Chromium Authors. All rights reserved. |
eakuefner
2016/09/29 17:01:11
nit: no (c)
RobertoCN
2016/10/01 01:04:22
Done.
|
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import os |
+import sys |
+ |
+tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__), |
+ '..')) |
+sys.path.append(tracing_path) |
+from tracing.metrics import compare_samples |
+ |
+def Main(argv): |
+ parser = argparse.ArgumentParser( |
+ description='Compare samples.') |
+ parser.add_argument('sample_a', type=str, |
+ help='comma-separated list of paths to valuesets from ' |
+ 'sample a') |
+ parser.add_argument('sample_b', type=str, |
+ help='comma-separated list of paths to valuesets from ' |
+ 'sample b') |
+ parser.add_argument('metric', type=str, |
+ help='name of the metric to compare') |
+ parser.add_argument('--chartjson', dest='format', action='store_const', |
+ const='chartjson', |
+ help='assume chartjson format for the input data') |
+ parser.add_argument('--buildbot', dest='format', action='store_const', |
+ const='buildbot', |
+ help='assume buildbot result line format for the data') |
+ parser.add_argument('--valueset', dest='format', action='store_const', |
+ const='valueset', |
+ help='assume valueset format for the input data') |
+ args = parser.parse_args(argv[1:]) |
+ |
+ if not args.format: |
+ filename = os.path.basename(sample_a.split(',')[0]) |
+ if filename == 'results-valueset.json': |
+ args.format = 'valueset' |
+ else: |
+ args.format = 'chartjson' |
+ |
+ vinn_result = compare_samples.CompareSamples( |
+ args.sample_a, |
+ args.sample_b, |
+ args.metric, |
+ args.format |
+ ) |
+ print vinn_result.stdout |
+ return vinn_result.returncode |
+ |
+if __name__ == '__main__': |
+ sys.exit(Main(sys.argv)) |