Commit dc94074a authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Commit Bot

[PGO] Use the Clang profiling config during the instrumentation step.

This uses the Clang profiling config during the instrumentation step of
a PGO build. This allows getting the profiling data out of the sandboxed
processes. This is not an ideal end state, ideally the coverage
configuration should be refactored and things common to the two
configurations should be moved to a new base config.

This requires to use the new version of goma, see go/ma-rbe-dogfood
(see crbug.com/990981#c26 for more details).

To build a PGInstrumented build (first step to do a PGO build) compile
with the following GN args:
  is_component_build = false
  is_debug = false
  chrome_pgo_phase = 1
  use_goma = true

Bug: 1056189
Change-Id: I717efdcbb6993ad574acce4c0f91eb5fb5bf3972
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2076424
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750258}
parent bff7ae96
......@@ -14,7 +14,11 @@ config("pgo_instrumentation_flags") {
# Only add flags when chrome_pgo_phase == 1, so that variables we would use
# are not required to be defined when we're not actually using PGO.
if (chrome_pgo_phase == 1 && is_clang && !is_nacl && is_a_target_toolchain) {
cflags = [ "-fprofile-instr-generate" ]
# TODO(sebmarchand): Add a GN flag that allows setting the PGO profile
# name or find a way to remove use {target_name} in the filename?
# This uses the "%m" specifier to allow concurrent runs of the
# instrumented image.
cflags = [ "-fprofile-instr-generate=%m.profraw" ]
if (!is_win) {
# Windows directly calls link.exe instead of the compiler driver when
# linking, and embeds the path to the profile runtime library as
......
......@@ -2,10 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/compiler/pgo/pgo.gni")
import("//build/config/coverage/coverage.gni")
declare_args() {
use_clang_profiling = use_clang_coverage
use_clang_profiling = use_clang_coverage || chrome_pgo_phase == 1
}
assert(!use_clang_profiling || is_clang,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment