| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/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 '''Generate stats of CQ usage.''' | 5 '''Generate stats of CQ usage.''' |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import calendar | 8 import calendar |
| 9 import collections | 9 import collections |
| 10 import copy | 10 import copy |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 if 'per-day' in stats: | 1163 if 'per-day' in stats: |
| 1164 output() | 1164 output() |
| 1165 output('Per-day stats:') | 1165 output('Per-day stats:') |
| 1166 for day_stats in stats['per-day']: | 1166 for day_stats in stats['per-day']: |
| 1167 false_rejections = _get_patches_by_reason( | 1167 false_rejections = _get_patches_by_reason( |
| 1168 day_stats, 'false-rejections', committed=True) | 1168 day_stats, 'false-rejections', committed=True) |
| 1169 infra_false_rejections = _get_patches_by_reason( | 1169 infra_false_rejections = _get_patches_by_reason( |
| 1170 day_stats, 'infra-false-rejections', committed=True) | 1170 day_stats, 'infra-false-rejections', committed=True) |
| 1171 | 1171 |
| 1172 output(' %s: %4d attempts; 50%% %4.1f; 90%% %4.1f; ' | 1172 output(' %s: %4d attempts; 50%% %4.1f; 90%% %4.1f; ' |
| 1173 'false rejections %.1f%% (%.1f%% infra)', | 1173 'false rejections %4.1f%% (%4.1f%% infra)', |
| 1174 day_stats['begin'].date(), | 1174 day_stats['begin'].date(), |
| 1175 day_stats['attempt-count'], | 1175 day_stats['attempt-count'], |
| 1176 day_stats['patchset-committed-durations']['50'] / 3600.0, | 1176 day_stats['patchset-committed-durations']['50'] / 3600.0, |
| 1177 day_stats['patchset-committed-durations']['90'] / 3600.0, | 1177 day_stats['patchset-committed-durations']['90'] / 3600.0, |
| 1178 percentage(sum(p['count'] for p in false_rejections), | 1178 percentage(sum(p['count'] for p in false_rejections), |
| 1179 stats['attempt-count']), | 1179 day_stats['attempt-count']), |
| 1180 percentage(sum(p['count'] for p in infra_false_rejections), | 1180 percentage(sum(p['count'] for p in infra_false_rejections), |
| 1181 stats['attempt-count'])) | 1181 day_stats['attempt-count'])) |
| 1182 | 1182 |
| 1183 output() | 1183 output() |
| 1184 output('Slowest CLs:') | 1184 output('Slowest CLs:') |
| 1185 slowest_cls = sorted( | 1185 slowest_cls = sorted( |
| 1186 stats['patch_stats'], | 1186 stats['patch_stats'], |
| 1187 key=lambda p: stats['patch_stats'][p]['patchset-duration'], | 1187 key=lambda p: stats['patch_stats'][p]['patchset-duration'], |
| 1188 reverse=True) | 1188 reverse=True) |
| 1189 for p in slowest_cls[:40]: | 1189 for p in slowest_cls[:40]: |
| 1190 output('%s (%s hrs)' % ( | 1190 output('%s (%s hrs)' % ( |
| 1191 patch_url(p), | 1191 patch_url(p), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 logger = logging.getLogger() | 1223 logger = logging.getLogger() |
| 1224 # TODO(sergeyberezin): how do I derive local timezone string? | 1224 # TODO(sergeyberezin): how do I derive local timezone string? |
| 1225 # Need to be able to pass dateutil.tz.tzlocal() directly. | 1225 # Need to be able to pass dateutil.tz.tzlocal() directly. |
| 1226 infra_libs.logs.process_argparse_options(args, logger) | 1226 infra_libs.logs.process_argparse_options(args, logger) |
| 1227 stats = acquire_stats(args) | 1227 stats = acquire_stats(args) |
| 1228 print_stats(args, stats) | 1228 print_stats(args, stats) |
| 1229 | 1229 |
| 1230 | 1230 |
| 1231 if __name__ == '__main__': | 1231 if __name__ == '__main__': |
| 1232 sys.exit(main()) | 1232 sys.exit(main()) |
| OLD | NEW |