| 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_mb( | 55 self.m.chromium.run_gyp_chromium() |
| 56 self.m.properties['mastername'], | |
| 57 self.m.properties['buildername'], | |
| 58 use_goma=False, | |
| 59 phase=1) | |
| 60 # Remove the profile files from the previous builds. | 56 # Remove the profile files from the previous builds. |
| 61 self.m.file.rmwildcard('*.pg[cd]', str(self.m.chromium.output_dir)) | 57 self.m.file.rmwildcard('*.pg[cd]', str(self.m.chromium.output_dir)) |
| 62 self.m.chromium.compile(name='Compile: Instrumentation phase.') | 58 self.m.chromium.compile(name='Compile: Instrumentation phase.') |
| 63 | 59 |
| 64 def _run_pgo_benchmarks(self): | 60 def _run_pgo_benchmarks(self): |
| 65 """ | 61 """ |
| 66 Run a suite of telemetry benchmarks to generate some profiling data. | 62 Run a suite of telemetry benchmarks to generate some profiling data. |
| 67 """ | 63 """ |
| 68 for benchmark in _BENCHMARKS_TO_RUN: | 64 for benchmark in _BENCHMARKS_TO_RUN: |
| 69 try: | 65 try: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 84 step_result = self.m.step.active_result | 80 step_result = self.m.step.active_result |
| 85 step_result.presentation.status = self.m.step.WARNING | 81 step_result.presentation.status = self.m.step.WARNING |
| 86 | 82 |
| 87 def _compile_optimized_image(self, bot_config): | 83 def _compile_optimized_image(self, bot_config): |
| 88 """ | 84 """ |
| 89 Generates the optimized version of the binaries. | 85 Generates the optimized version of the binaries. |
| 90 """ | 86 """ |
| 91 self.m.chromium.set_config(bot_config['chromium_config_optimize'], | 87 self.m.chromium.set_config(bot_config['chromium_config_optimize'], |
| 92 **bot_config.get('chromium_config_kwargs')) | 88 **bot_config.get('chromium_config_kwargs')) |
| 93 self.m.chromium.runhooks(name='Runhooks: Optimization phase.') | 89 self.m.chromium.runhooks(name='Runhooks: Optimization phase.') |
| 94 self.m.chromium.run_mb( | 90 self.m.chromium.run_gyp_chromium() |
| 95 self.m.properties['mastername'], | |
| 96 self.m.properties['buildername'], | |
| 97 use_goma=False, | |
| 98 phase=2) | |
| 99 self.m.chromium.compile(name='Compile: Optimization phase.') | 91 self.m.chromium.compile(name='Compile: Optimization phase.') |
| 100 | 92 |
| 101 def compile_pgo(self, bot_config): | 93 def compile_pgo(self, bot_config): |
| 102 """ | 94 """ |
| 103 Do a PGO build. This takes care of building an instrumented image, profiling | 95 Do a PGO build. This takes care of building an instrumented image, profiling |
| 104 it and then compiling the optimized version of it. | 96 it and then compiling the optimized version of it. |
| 105 """ | 97 """ |
| 106 self.m.gclient.set_config(bot_config['gclient_config']) | 98 self.m.gclient.set_config(bot_config['gclient_config']) |
| 107 | 99 |
| 108 # Augment the solution if needed. | 100 # Augment the solution if needed. |
| 109 self.m.gclient.c.solutions[0].url += bot_config.get('url_suffix', '') | 101 self.m.gclient.c.solutions[0].url += bot_config.get('url_suffix', '') |
| 110 | 102 |
| 111 if self.m.properties.get('slavename') != 'fake_slave': | 103 if self.m.properties.get('slavename') != 'fake_slave': |
| 112 self.m.chromium.taskkill() | 104 self.m.chromium.taskkill() |
| 113 | 105 |
| 114 self.m.bot_update.ensure_checkout(force=True) | 106 self.m.bot_update.ensure_checkout(force=True) |
| 115 if bot_config.get('patch_root'): | 107 if bot_config.get('patch_root'): |
| 116 self.m.path['checkout'] = self.m.path['slave_build'].join( | 108 self.m.path['checkout'] = self.m.path['slave_build'].join( |
| 117 bot_config.get('patch_root')) | 109 bot_config.get('patch_root')) |
| 118 | 110 |
| 119 # First step: compilation of the instrumented build. | 111 # First step: compilation of the instrumented build. |
| 120 self._compile_instrumented_image(bot_config) | 112 self._compile_instrumented_image(bot_config) |
| 121 | 113 |
| 122 # Second step: profiling of the instrumented build. | 114 # Second step: profiling of the instrumented build. |
| 123 self._run_pgo_benchmarks() | 115 self._run_pgo_benchmarks() |
| 124 | 116 |
| 125 # Third step: Compilation of the optimized build, this will use the | 117 # Third step: Compilation of the optimized build, this will use the |
| 126 # profile data files produced by the previous step. | 118 # profile data files produced by the previous step. |
| 127 self._compile_optimized_image(bot_config) | 119 self._compile_optimized_image(bot_config) |
| OLD | NEW |