Chromium Code Reviews| Index: scripts/slave/recipes/chromium_pgo.py |
| diff --git a/scripts/slave/recipes/chromium_pgo.py b/scripts/slave/recipes/chromium_pgo.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6c23e0347815b58ec21a4a650dd3eeb8581b307f |
| --- /dev/null |
| +++ b/scripts/slave/recipes/chromium_pgo.py |
| @@ -0,0 +1,115 @@ |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +DEPS = [ |
| + 'bot_update', |
| + 'chromium', |
| + 'gclient', |
| + 'path', |
| + 'platform', |
| + 'properties', |
| + 'python', |
| + 'step', |
| + 'step_history', |
| +] |
| + |
| + |
| +# List of the benchmark that we run during the profiling step. |
| +_BENCHMARKS_TO_RUN = { |
| + 'peacekeeper.dom', |
| + 'peacekeeper.array', |
| + 'peacekeeper.html5', |
| + 'peacekeeper.string', |
| + 'peacekeeper.render', |
| + 'dromaeo.domcoreattr', |
| + 'dromaeo.domcoremodify', |
| + 'dromaeo.domcorequery', |
| + 'dromaeo.domcoretraverse', |
| + 'dromaeo.jslibattrjquery', |
| + 'dromaeo.jslibattrprototype', |
| + 'dromaeo.jslibeventjquery', |
| + 'dromaeo.jslibeventprototype', |
| + 'dromaeo.jslibmodifyjquery', |
| + 'dromaeo.jslibmodifyprototype', |
| + 'dromaeo.jslibstylejquery', |
| + 'dromaeo.jslibstyleprototype', |
| + 'dromaeo.jslibtraversejquery', |
| + 'dromaeo.jslibtraverseprototype', |
| + 'sunspider', |
| + 'jsgamebench', |
| + 'kraken', |
| +} |
| + |
| + |
| +# Run a telemetry benchmark under the Windows PGO profiler. |
| +def RunTelemetryBenchmark(api, testname): |
| + args = [ |
| + '--profiler=win_pgo_profiler', |
| + '--use-live-sites', |
| + testname, |
| + ] |
| + return api.python( |
| + 'Telemetry benchmark: %s' % testname, |
| + api.path['checkout'].join('tools', |
| + 'perf', |
| + 'run_benchmark'), |
| + args) |
| + |
| + |
| +def GenSteps(api): |
| + api.step.auto_resolve_conflicts = True |
| + api.gclient.set_config('chromium_lkgr') |
| + api.chromium.set_config('chromium', 'Release') |
| + |
| + if api.platform.is_win: |
|
iannucci
2014/05/27 20:44:21
can this recipe even run on non-windows? PGO is pr
Sébastien Marchand
2014/06/05 14:54:52
PGO isn't really Windows specific (it could potent
|
| + yield api.chromium.taskkill() |
| + yield api.bot_update.ensure_checkout(), |
| + if not api.step_history.last_step().json.output['did_run']: |
| + yield api.gclient.checkout(), |
| + |
| + # First step: compilation of the instrumented build. |
| + api.chromium.apply_config('chrome_pgo_instrument') |
| + yield api.chromium.runhooks() |
| + yield api.chromium.compile(targets=['chrome']) |
| + |
| + # Remove the profile files from the previous builds. |
| + yield api.python.inline( |
|
iannucci
2014/05/27 20:44:21
I think theres api.path.rmcontents which does (bas
Sébastien Marchand
2014/06/12 15:13:31
Done, this is a little bit ugly because glob.glob(
|
| + 'Remove previous profile files.', |
| + """ |
| + import glob |
| + import os |
| + import sys |
| + for filename in glob.glob(os.path.join(sys.argv[1],'*.pgc')): |
| + os.remove(filename) |
| + """, |
| + args=[api.chromium.c.build_dir] |
| + ) |
| + |
| + # Second step: profiling of the instrumented build. |
| + for benchmark in _BENCHMARKS_TO_RUN: |
| + yield RunTelemetryBenchmark(api, benchmark) |
| + |
| + # Third step: Compilation of the optimized build, this will use the profile |
| + # data files produced by the previous step. |
| + api.chromium.apply_config('chrome_pgo_optimize') |
| + yield api.chromium.runhooks() |
| + yield api.chromium.compile(targets=['chrome']) |
|
iannucci
2014/05/27 20:44:21
should probably plan to upload the artifacts to go
Sébastien Marchand
2014/06/05 14:54:52
I'm not sure at this point... The purpose of this
|
| + |
| + |
| +def _sanitize_nonalpha(text): |
| + return ''.join(c if c.isalnum() else '_' for c in text) |
|
iannucci
2014/05/27 20:44:21
You can nest this inside the GenTests function :)
Sébastien Marchand
2014/06/05 14:54:52
Done.
|
| + |
| + |
| +def GenTests(api): |
| + mastername = 'chromium.fyi' |
| + buildername = 'Chromium Win PGO Builder' |
| + |
| + test = ( |
|
iannucci
2014/05/27 20:44:21
nit: I would just yield this directly instead of h
Sébastien Marchand
2014/06/05 14:54:52
Done.
|
| + api.test('full_%s_%s' % (_sanitize_nonalpha(mastername), |
| + _sanitize_nonalpha(buildername))) + |
| + api.properties.generic(mastername=mastername, buildername=buildername) + |
| + api.platform('win', 32) |
| + ) |
| + |
| + yield test |