| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 import json |
| 4 import logging |
| 5 import multiprocessing |
| 6 import sys |
| 7 import time |
| 8 |
| 9 import buildbot |
| 10 |
| 11 |
| 12 MASTER_NAME = 'chromium.perf' |
| 13 BUILDER_NAMES = ('Win 7 Perf (1)', 'Mac 10.9 Perf (1)') |
| 14 BENCHMARK_NAME = 'smoothness.top_25_smooth' |
| 15 VALUE_NAME = 'frame_times' |
| 16 |
| 17 BUILD_COUNT = 100 |
| 18 |
| 19 |
| 20 def QueryBuild(build): |
| 21 steps = build.steps |
| 22 if not BENCHMARK_NAME in steps: |
| 23 return None |
| 24 |
| 25 step = steps[BENCHMARK_NAME] |
| 26 if step.result != buildbot.SUCCESS: |
| 27 return None |
| 28 |
| 29 revision_data = [] |
| 30 trace_results = step.results['chart_data']['charts'][VALUE_NAME].iteritems() |
| 31 for user_story_name, user_story_data in trace_results: |
| 32 revision_data.append({ |
| 33 'user_story': user_story_name, |
| 34 'start_time': step.start_time, |
| 35 'end_time': step.end_time, |
| 36 'values': user_story_data['values'], |
| 37 }) |
| 38 return { |
| 39 'start_time': build.start_time, |
| 40 'end_time': build.end_time, |
| 41 'user_story_runs': revision_data, |
| 42 } |
| 43 |
| 44 |
| 45 def QueryBuilds(builder): |
| 46 return map(QueryBuild, builder.LastBuilds(BUILD_COUNT)) |
| 47 |
| 48 |
| 49 def main(): |
| 50 logging.getLogger().setLevel(logging.INFO) |
| 51 |
| 52 builders = buildbot.Builders(MASTER_NAME) |
| 53 process_pool = multiprocessing.Pool(8) |
| 54 |
| 55 start_time = time.time() |
| 56 data = process_pool.map(QueryBuilds, |
| 57 (builders[name] for name in BUILDER_NAMES)) |
| 58 data = dict(zip(BUILDER_NAMES, data)) |
| 59 logging.info('Queried %d builds in %2.2f seconds.', |
| 60 BUILD_COUNT, time.time() - start_time) |
| 61 |
| 62 start_time = time.time() |
| 63 json.dump(data, sys.stdout) |
| 64 logging.info('Wrote data in %2.2f seconds.', time.time() - start_time) |
| 65 |
| 66 |
| 67 if __name__ == '__main__': |
| 68 main() |
| OLD | NEW |