Merge "Add enable_profile_use property"

am: 0e8afed83a

Change-Id: I39b7a8d6ad3d794ed8f20100fa964acb12c02937
This commit is contained in:
Pirama Arumuga Nainar 2017-10-17 03:07:22 +00:00 committed by android-build-merger
commit ba6593f5fa
1 changed files with 10 additions and 4 deletions

View File

@ -37,10 +37,11 @@ const profileUseSamplingFormat = "-fprofile-sample-use=%s"
type PgoProperties struct {
Pgo struct {
Instrumentation *bool
Sampling *bool
Profile_file *string `android:"arch_variant"`
Benchmarks []string
Instrumentation *bool
Sampling *bool
Profile_file *string `android:"arch_variant"`
Benchmarks []string
Enable_profile_use *bool `android:"arch_variant"`
} `android:"arch_variant"`
PgoPresent bool `blueprint:"mutated"`
@ -95,6 +96,11 @@ func (props *PgoProperties) profileUseFlags(ctx ModuleContext, file string) []st
}
func (props *PgoProperties) addProfileUseFlags(ctx ModuleContext, flags Flags) Flags {
// Skip -fprofile-use if 'enable_profile_use' property is set
if props.Pgo.Enable_profile_use != nil && *props.Pgo.Enable_profile_use == false {
return flags
}
// If the PGO profiles project is found, and this module has PGO
// enabled, add flags to use the profile
if profilesDir := getPgoProfilesDir(ctx); props.PgoPresent && profilesDir.Valid() {