Search for PGO profiles in PGO_ADDITIONAL_PROFILE_DIRS
am: 49540800f0
Change-Id: Ia182ff5272cf4f42fde7a6d96a48076c1998a98e
This commit is contained in:
commit
8f7ea0ebdd
|
@ -710,6 +710,10 @@ func (c *deviceConfig) CoverageEnabledForPath(path string) bool {
|
||||||
return coverage
|
return coverage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *deviceConfig) PgoAdditionalProfileDirs() []string {
|
||||||
|
return c.config.ProductVariables.PgoAdditionalProfileDirs
|
||||||
|
}
|
||||||
|
|
||||||
func (c *config) IntegerOverflowDisabledForPath(path string) bool {
|
func (c *config) IntegerOverflowDisabledForPath(path string) bool {
|
||||||
if c.ProductVariables.IntegerOverflowExcludePaths == nil {
|
if c.ProductVariables.IntegerOverflowExcludePaths == nil {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -205,6 +205,8 @@ type productVariables struct {
|
||||||
ExtraVndkVersions []string `json:",omitempty"`
|
ExtraVndkVersions []string `json:",omitempty"`
|
||||||
|
|
||||||
NamespacesToExport []string `json:",omitempty"`
|
NamespacesToExport []string `json:",omitempty"`
|
||||||
|
|
||||||
|
PgoAdditionalProfileDirs []string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func boolPtr(v bool) *bool {
|
func boolPtr(v bool) *bool {
|
||||||
|
|
13
cc/pgo.go
13
cc/pgo.go
|
@ -27,17 +27,24 @@ var (
|
||||||
// some functions
|
// some functions
|
||||||
profileUseOtherFlags = []string{"-Wno-backend-plugin"}
|
profileUseOtherFlags = []string{"-Wno-backend-plugin"}
|
||||||
|
|
||||||
pgoProfileProjects = []string{
|
globalPgoProfileProjects = []string{
|
||||||
"toolchain/pgo-profiles",
|
"toolchain/pgo-profiles",
|
||||||
"vendor/google_data/pgo-profiles",
|
"vendor/google_data/pgo-profiles",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const pgoProfileProjectsConfigKey = "PgoProfileProjects"
|
||||||
const profileInstrumentFlag = "-fprofile-generate=/data/local/tmp"
|
const profileInstrumentFlag = "-fprofile-generate=/data/local/tmp"
|
||||||
const profileSamplingFlag = "-gline-tables-only"
|
const profileSamplingFlag = "-gline-tables-only"
|
||||||
const profileUseInstrumentFormat = "-fprofile-use=%s"
|
const profileUseInstrumentFormat = "-fprofile-use=%s"
|
||||||
const profileUseSamplingFormat = "-fprofile-sample-use=%s"
|
const profileUseSamplingFormat = "-fprofile-sample-use=%s"
|
||||||
|
|
||||||
|
func getPgoProfileProjects(config android.DeviceConfig) []string {
|
||||||
|
return config.OnceStringSlice(pgoProfileProjectsConfigKey, func() []string {
|
||||||
|
return append(globalPgoProfileProjects, config.PgoAdditionalProfileDirs()...)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func recordMissingProfileFile(ctx ModuleContext, missing string) {
|
func recordMissingProfileFile(ctx ModuleContext, missing string) {
|
||||||
getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true)
|
getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true)
|
||||||
}
|
}
|
||||||
|
@ -92,8 +99,8 @@ func (props *PgoProperties) addProfileGatherFlags(ctx ModuleContext, flags Flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.OptionalPath {
|
func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.OptionalPath {
|
||||||
// Test if the profile_file is present in any of the pgoProfileProjects
|
// Test if the profile_file is present in any of the PGO profile projects
|
||||||
for _, profileProject := range pgoProfileProjects {
|
for _, profileProject := range getPgoProfileProjects(ctx.DeviceConfig()) {
|
||||||
path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file)
|
path := android.ExistentPathForSource(ctx, "", profileProject, *props.Pgo.Profile_file)
|
||||||
if path.Valid() {
|
if path.Valid() {
|
||||||
return path
|
return path
|
||||||
|
|
Loading…
Reference in New Issue