| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """A tool that runs a perf test and uploads the resulting data to the | 6 """A tool that runs a perf test and uploads the resulting data to the |
| 7 performance dashboard. | 7 performance dashboard. |
| 8 | 8 |
| 9 By default uploads to a local testing dashboard assumed to be running on the | 9 By default uploads to a local testing dashboard assumed to be running on the |
| 10 host. To run such server, check out Catapult and follow instructions at | 10 host. To run such server, check out Catapult and follow instructions at |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 perf_dashboard.add_argparse_server_arguments(parser) | 82 perf_dashboard.add_argparse_server_arguments(parser) |
| 83 parser.add_argument( | 83 parser.add_argument( |
| 84 "--perf-data-path", | 84 "--perf-data-path", |
| 85 help="The path to the perf data that the perf test generates.") | 85 help="The path to the perf data that the perf test generates.") |
| 86 parser.add_argument("command", nargs=argparse.REMAINDER) | 86 parser.add_argument("command", nargs=argparse.REMAINDER) |
| 87 args = parser.parse_args() | 87 args = parser.parse_args() |
| 88 | 88 |
| 89 subprocess.check_call(args.command) | 89 subprocess.check_call(args.command) |
| 90 | 90 |
| 91 if not args.upload: |
| 92 return 0 |
| 93 |
| 91 if args.master_name is None or \ | 94 if args.master_name is None or \ |
| 92 args.perf_id is None or \ | 95 args.bot_name is None or \ |
| 93 args.test_name is None or \ | 96 args.test_name is None or \ |
| 94 args.builder_name is None or \ | 97 args.builder_name is None or \ |
| 95 args.build_number is None or \ | 98 args.build_number is None or \ |
| 96 args.perf_data_path is None: | 99 args.perf_data_path is None: |
| 97 print "Won't upload perf data to the dashboard because not all of the " \ | 100 print "Can't upload perf data to the dashboard because not all of the " \ |
| 98 "following values are specified: master-name, perf-id, test-name, " \ | 101 "following values are specified: master-name, perf-id, test-name, " \ |
| 99 "builder-name, build-number, perf-data-path." | 102 "builder-name, build-number, perf-data-path." |
| 100 return 0 | 103 return 1 |
| 101 | 104 |
| 102 revision = Version().version | 105 revision = Version().version |
| 103 point_id = _GetCurrentCommitCount() | 106 point_id = _GetCurrentCommitCount() |
| 104 with open(args.perf_data_path, "r") as perf_data: | 107 with open(args.perf_data_path, "r") as perf_data: |
| 105 chart_data = _ConvertPerfDataToChartFormat(perf_data, args.test_name) | 108 chart_data = _ConvertPerfDataToChartFormat(perf_data, args.test_name) |
| 106 | 109 |
| 107 result = perf_dashboard.upload_chart_data( | 110 result = perf_dashboard.upload_chart_data( |
| 108 args.master_name, args.perf_id, args.test_name, args.builder_name, | 111 args.master_name, args.bot_name, args.test_name, args.builder_name, |
| 109 args.build_number, revision, chart_data, point_id, args.server_url, | 112 args.build_number, revision, chart_data, point_id, args.server_url, |
| 110 args.dry_run) | 113 args.dry_run) |
| 111 | 114 |
| 112 return 0 if result else 1 | 115 return 0 if result else 1 |
| 113 | 116 |
| 114 | 117 |
| 115 if __name__ == '__main__': | 118 if __name__ == '__main__': |
| 116 sys.exit(main()) | 119 sys.exit(main()) |
| OLD | NEW |