Support instrumenting all PGO-enabled modules
Bug: http://b/63768402
If ANDROID_PGO_INSTRUMENT has "all" or "ALL", all PGO-enabled modules
are built for profile generation.
Test: Build with and without 'all' in ANDROID_PGO_INSTRUMENT
Change-Id: I3b1a9b562775e80a4ab3965100341d9e8e4ffde9
diff --git a/cc/pgo.go b/cc/pgo.go
index 7ac5b2a..758c3d6 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -197,7 +197,7 @@
}
// This module should be instrumented if ANDROID_PGO_INSTRUMENT is set
- // and includes a benchmark listed for this module
+ // and includes 'all', 'ALL' or a benchmark listed for this module.
//
// TODO Validate that each benchmark instruments at least one module
pgo.Properties.ShouldProfileModule = false
@@ -207,10 +207,14 @@
pgoBenchmarksMap[b] = true
}
- for _, b := range pgo.Properties.Pgo.Benchmarks {
- if pgoBenchmarksMap[b] == true {
- pgo.Properties.ShouldProfileModule = true
- break
+ if pgoBenchmarksMap["all"] == true || pgoBenchmarksMap["ALL"] == true {
+ pgo.Properties.ShouldProfileModule = true
+ } else {
+ for _, b := range pgo.Properties.Pgo.Benchmarks {
+ if pgoBenchmarksMap[b] == true {
+ pgo.Properties.ShouldProfileModule = true
+ break
+ }
}
}
}