Enable bazel profiling in soong_build.

Bazel is executed several times during the execution of soong_build.
For each bazel execution, generate a profile and save under the
BAZEL_METRICS_DIR which is defined in soong_ui.

Bug: b/174479924
Test: * USE_BAZEL_ANALYSIS=1 USE_BAZEL=1 m nothing and checked
        if the cquery and graph build bazel profiles were generated.
      * Verified that the generated bazel profiles were uploaded
        to the local dev metrics pipeline.

Change-Id: I3d20204484dc6c5a1525a5d3eec1d62cfb33535b
This commit is contained in:
Patrice Arruda
2020-12-12 06:24:26 +00:00
parent 57fab96e01
commit 05ab2d0731
7 changed files with 54 additions and 7 deletions

View File

@@ -4,4 +4,7 @@ bootstrap_go_package {
srcs: [
"paths.go",
],
deps: [
"soong-bazel",
],
}

View File

@@ -18,6 +18,8 @@ package shared
import (
"path/filepath"
"android/soong/bazel"
)
// A SharedPaths represents a list of paths that are shared between
@@ -37,6 +39,6 @@ func TempDirForOutDir(outDir string) (tempPath string) {
// on the action name. This is to help to store a set of bazel
// profiles since bazel may execute multiple times during a single
// build.
func BazelMetricsFilename(s SharedPaths, actionName string) string {
return filepath.Join(s.BazelMetricsDir(), actionName+"_bazel_profile.gz")
func BazelMetricsFilename(s SharedPaths, actionName bazel.RunName) string {
return filepath.Join(s.BazelMetricsDir(), actionName.String()+"_bazel_profile.gz")
}