| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
| 6 | 6 |
| 7 | 7 |
| 8 # List of the benchmark that we run during the profiling step. | 8 # List of the benchmark that we run during the profiling step. |
| 9 # | 9 # |
| 10 # TODO(sebmarchand): Move this into a BenchmarkSuite in telemetry, this way | 10 # TODO(sebmarchand): Move this into a BenchmarkSuite in telemetry, this way |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 def __init__(self, **kwargs): | 45 def __init__(self, **kwargs): |
| 46 super(PGOApi, self).__init__(**kwargs) | 46 super(PGOApi, self).__init__(**kwargs) |
| 47 | 47 |
| 48 def _compile_instrumented_image(self, bot_config): | 48 def _compile_instrumented_image(self, bot_config): |
| 49 """ | 49 """ |
| 50 Generates the instrumented version of the binaries. | 50 Generates the instrumented version of the binaries. |
| 51 """ | 51 """ |
| 52 self.m.chromium.set_config(bot_config['chromium_config_instrument'], | 52 self.m.chromium.set_config(bot_config['chromium_config_instrument'], |
| 53 **bot_config.get('chromium_config_kwargs')) | 53 **bot_config.get('chromium_config_kwargs')) |
| 54 self.m.chromium.runhooks(name='Runhooks: Instrumentation phase.') | 54 self.m.chromium.runhooks(name='Runhooks: Instrumentation phase.') |
| 55 self.m.chromium.run_gyp_chromium() | 55 self.m.chromium.run_mb( |
| 56 self.m.properties['mastername'], |
| 57 self.m.properties['buildername'], |
| 58 use_goma=False, |
| 59 phase=1) |
| 56 # Remove the profile files from the previous builds. | 60 # Remove the profile files from the previous builds. |
| 57 self.m.file.rmwildcard('*.pg[cd]', str(self.m.chromium.output_dir)) | 61 self.m.file.rmwildcard('*.pg[cd]', str(self.m.chromium.output_dir)) |
| 58 self.m.chromium.compile(name='Compile: Instrumentation phase.') | 62 self.m.chromium.compile(name='Compile: Instrumentation phase.') |
| 59 | 63 |
| 60 def _run_pgo_benchmarks(self): | 64 def _run_pgo_benchmarks(self): |
| 61 """ | 65 """ |
| 62 Run a suite of telemetry benchmarks to generate some profiling data. | 66 Run a suite of telemetry benchmarks to generate some profiling data. |
| 63 """ | 67 """ |
| 64 for benchmark in _BENCHMARKS_TO_RUN: | 68 for benchmark in _BENCHMARKS_TO_RUN: |
| 65 try: | 69 try: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 step_result = self.m.step.active_result | 84 step_result = self.m.step.active_result |
| 81 step_result.presentation.status = self.m.step.WARNING | 85 step_result.presentation.status = self.m.step.WARNING |
| 82 | 86 |
| 83 def _compile_optimized_image(self, bot_config): | 87 def _compile_optimized_image(self, bot_config): |
| 84 """ | 88 """ |
| 85 Generates the optimized version of the binaries. | 89 Generates the optimized version of the binaries. |
| 86 """ | 90 """ |
| 87 self.m.chromium.set_config(bot_config['chromium_config_optimize'], | 91 self.m.chromium.set_config(bot_config['chromium_config_optimize'], |
| 88 **bot_config.get('chromium_config_kwargs')) | 92 **bot_config.get('chromium_config_kwargs')) |
| 89 self.m.chromium.runhooks(name='Runhooks: Optimization phase.') | 93 self.m.chromium.runhooks(name='Runhooks: Optimization phase.') |
| 90 self.m.chromium.run_gyp_chromium() | 94 self.m.chromium.run_mb( |
| 95 self.m.properties['mastername'], |
| 96 self.m.properties['buildername'], |
| 97 use_goma=False, |
| 98 phase=2) |
| 91 self.m.chromium.compile(name='Compile: Optimization phase.') | 99 self.m.chromium.compile(name='Compile: Optimization phase.') |
| 92 | 100 |
| 93 def compile_pgo(self, bot_config): | 101 def compile_pgo(self, bot_config): |
| 94 """ | 102 """ |
| 95 Do a PGO build. This takes care of building an instrumented image, profiling | 103 Do a PGO build. This takes care of building an instrumented image, profiling |
| 96 it and then compiling the optimized version of it. | 104 it and then compiling the optimized version of it. |
| 97 """ | 105 """ |
| 98 self.m.gclient.set_config(bot_config['gclient_config']) | 106 self.m.gclient.set_config(bot_config['gclient_config']) |
| 99 | 107 |
| 100 # Augment the solution if needed. | 108 # Augment the solution if needed. |
| 101 self.m.gclient.c.solutions[0].url += bot_config.get('url_suffix', '') | 109 self.m.gclient.c.solutions[0].url += bot_config.get('url_suffix', '') |
| 102 | 110 |
| 103 if self.m.properties.get('slavename') != 'fake_slave': | 111 if self.m.properties.get('slavename') != 'fake_slave': |
| 104 self.m.chromium.taskkill() | 112 self.m.chromium.taskkill() |
| 105 | 113 |
| 106 self.m.bot_update.ensure_checkout(force=True) | 114 self.m.bot_update.ensure_checkout(force=True) |
| 107 if bot_config.get('patch_root'): | 115 if bot_config.get('patch_root'): |
| 108 self.m.path['checkout'] = self.m.path['slave_build'].join( | 116 self.m.path['checkout'] = self.m.path['slave_build'].join( |
| 109 bot_config.get('patch_root')) | 117 bot_config.get('patch_root')) |
| 110 | 118 |
| 111 # First step: compilation of the instrumented build. | 119 # First step: compilation of the instrumented build. |
| 112 self._compile_instrumented_image(bot_config) | 120 self._compile_instrumented_image(bot_config) |
| 113 | 121 |
| 114 # Second step: profiling of the instrumented build. | 122 # Second step: profiling of the instrumented build. |
| 115 self._run_pgo_benchmarks() | 123 self._run_pgo_benchmarks() |
| 116 | 124 |
| 117 # Third step: Compilation of the optimized build, this will use the | 125 # Third step: Compilation of the optimized build, this will use the |
| 118 # profile data files produced by the previous step. | 126 # profile data files produced by the previous step. |
| 119 self._compile_optimized_image(bot_config) | 127 self._compile_optimized_image(bot_config) |
| OLD | NEW |