Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
|
eakuefner
2016/11/18 21:37:11
no need
| |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 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 argparse | |
| 7 import json | |
| 8 import os | |
| 9 import sys | |
| 10 | |
| 11 tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__), | |
| 12 '..')) | |
| 13 sys.path.append(tracing_path) | |
| 14 from tracing.value import convert_chart_json | |
| 15 | |
| 16 | |
| 17 def Main(argv): | |
| 18 parser = argparse.ArgumentParser( | |
| 19 description='Compare samples.') | |
| 20 parser.add_argument('chart_json', type=str, help='(input)') | |
| 21 parser.add_argument('histogram_json', type=str, help='(input/output)') | |
| 22 args = parser.parse_args(argv[1:]) | |
| 23 | |
| 24 vinn_result = convert_chart_json.ConvertChartJson(args.chart_json) | |
| 25 | |
| 26 if vinn_result.returncode == 0: | |
| 27 histograms = json.loads(vinn_result.stdout) | |
| 28 if os.path.exists(args.histogram_json): | |
| 29 histograms.extend(json.load(file(args.histogram_json, 'r'))) | |
| 30 json.dump(histograms, file(args.histogram_json, 'w')) | |
| 31 | |
| 32 return vinn_result.returncode | |
| 33 | |
| 34 if __name__ == '__main__': | |
| 35 sys.exit(Main(sys.argv)) | |
| OLD | NEW |