Store missing profile files into a Make variable
Bug: http://b/72642679 Store missing profile files and the modules that refer to them in the SOONG_MODULES_MISSING_PGO_PROFILE_FILE variable passed to Make. The contents of this variable will be written to $DIST_DIR/pgo_profile_file_missing.txt as part of the 'dist' target. Test: 'm dist' and verify creation of pgo_profile_file_missing.txt. Change-Id: I237cd0398be418be2b7db6fa65ece5ef347ecbc1
This commit is contained in:
@@ -226,7 +226,7 @@ func warningsAreAllowed(subdir string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addToModuleList(ctx ModuleContext, list string, module string) {
|
func addToModuleList(ctx ModuleContext, list string, module string) {
|
||||||
getWallWerrorMap(ctx.Config(), list).Store(module, true)
|
getNamedMapForConfig(ctx.Config(), list).Store(module, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a Flags struct that collects the compile flags from global values,
|
// Create a Flags struct that collects the compile flags from global values,
|
||||||
|
@@ -25,22 +25,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
modulesAddedWall = "ModulesAddedWall"
|
modulesAddedWall = "ModulesAddedWall"
|
||||||
modulesUsingWnoError = "ModulesUsingWnoError"
|
modulesUsingWnoError = "ModulesUsingWnoError"
|
||||||
|
modulesMissingProfileFile = "ModulesMissingProfileFile"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
|
android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getWallWerrorMap(config android.Config, name string) *sync.Map {
|
func getNamedMapForConfig(config android.Config, name string) *sync.Map {
|
||||||
return config.Once(name, func() interface{} {
|
return config.Once(name, func() interface{} {
|
||||||
return &sync.Map{}
|
return &sync.Map{}
|
||||||
}).(*sync.Map)
|
}).(*sync.Map)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeStringOfKeys(ctx android.MakeVarsContext, setName string) string {
|
func makeStringOfKeys(ctx android.MakeVarsContext, setName string) string {
|
||||||
set := getWallWerrorMap(ctx.Config(), setName)
|
set := getNamedMapForConfig(ctx.Config(), setName)
|
||||||
keys := []string{}
|
keys := []string{}
|
||||||
set.Range(func(key interface{}, value interface{}) bool {
|
set.Range(func(key interface{}, value interface{}) bool {
|
||||||
keys = append(keys, key.(string))
|
keys = append(keys, key.(string))
|
||||||
@@ -102,6 +103,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||||||
ctx.Strict("ANDROID_WARNING_ALLOWED_PROJECTS", makeStringOfWarningAllowedProjects())
|
ctx.Strict("ANDROID_WARNING_ALLOWED_PROJECTS", makeStringOfWarningAllowedProjects())
|
||||||
ctx.Strict("SOONG_MODULES_ADDED_WALL", makeStringOfKeys(ctx, modulesAddedWall))
|
ctx.Strict("SOONG_MODULES_ADDED_WALL", makeStringOfKeys(ctx, modulesAddedWall))
|
||||||
ctx.Strict("SOONG_MODULES_USING_WNO_ERROR", makeStringOfKeys(ctx, modulesUsingWnoError))
|
ctx.Strict("SOONG_MODULES_USING_WNO_ERROR", makeStringOfKeys(ctx, modulesUsingWnoError))
|
||||||
|
ctx.Strict("SOONG_MODULES_MISSING_PGO_PROFILE_FILE", makeStringOfKeys(ctx, modulesMissingProfileFile))
|
||||||
|
|
||||||
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(asanCflags, " "))
|
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(asanCflags, " "))
|
||||||
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", strings.Join(asanLdflags, " "))
|
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", strings.Join(asanLdflags, " "))
|
||||||
|
@@ -38,6 +38,10 @@ 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 recordMissingProfileFile(ctx ModuleContext, missing string) {
|
||||||
|
getNamedMapForConfig(ctx.Config(), modulesMissingProfileFile).Store(missing, true)
|
||||||
|
}
|
||||||
|
|
||||||
type PgoProperties struct {
|
type PgoProperties struct {
|
||||||
Pgo struct {
|
Pgo struct {
|
||||||
Instrumentation *bool
|
Instrumentation *bool
|
||||||
@@ -96,6 +100,10 @@ func (props *PgoProperties) getPgoProfileFile(ctx ModuleContext) android.Optiona
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Record that this module's profile file is absent
|
||||||
|
missing := *props.Pgo.Profile_file + ":" + ctx.ModuleDir() + "/Android.bp:" + ctx.ModuleName()
|
||||||
|
recordMissingProfileFile(ctx, missing)
|
||||||
|
|
||||||
return android.OptionalPathForPath(nil)
|
return android.OptionalPathForPath(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user