OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # 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.
| |
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 os | |
7 import sys | |
8 | |
9 tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__), | |
10 '..')) | |
11 sys.path.append(tracing_path) | |
12 from tracing.metrics import compare_samples | |
13 | |
14 def Main(argv): | |
15 parser = argparse.ArgumentParser( | |
16 description='Compare samples.') | |
17 parser.add_argument('sample_a', type=str, | |
18 help='comma-separated list of paths to valuesets from ' | |
19 'sample a') | |
20 parser.add_argument('sample_b', type=str, | |
21 help='comma-separated list of paths to valuesets from ' | |
22 'sample b') | |
23 parser.add_argument('metric', type=str, | |
24 help='name of the metric to compare') | |
25 parser.add_argument('--chartjson', dest='format', action='store_const', | |
26 const='chartjson', | |
27 help='assume chartjson format for the input data') | |
28 parser.add_argument('--buildbot', dest='format', action='store_const', | |
29 const='buildbot', | |
30 help='assume buildbot result line format for the data') | |
31 parser.add_argument('--valueset', dest='format', action='store_const', | |
32 const='valueset', | |
33 help='assume valueset format for the input data') | |
34 args = parser.parse_args(argv[1:]) | |
35 | |
36 if not args.format: | |
37 filename = os.path.basename(sample_a.split(',')[0]) | |
38 if filename == 'results-valueset.json': | |
39 args.format = 'valueset' | |
40 else: | |
41 args.format = 'chartjson' | |
42 | |
43 vinn_result = compare_samples.CompareSamples( | |
44 args.sample_a, | |
45 args.sample_b, | |
46 args.metric, | |
47 args.format | |
48 ) | |
49 print vinn_result.stdout | |
50 return vinn_result.returncode | |
51 | |
52 if __name__ == '__main__': | |
53 sys.exit(Main(sys.argv)) | |
OLD | NEW |