[pgo] Sampling PGO does not require benchmark property
Test: build with Sampling PGO Bug: 79161490 Change-Id: I70bb8dc2e4492d6a3713ca16fcb3f1216615f8ac
This commit is contained in:
parent
0bcda81dd5
commit
84803c50a6
1 changed files with 7 additions and 5 deletions
12
cc/pgo.go
12
cc/pgo.go
|
@ -199,8 +199,8 @@ func (props *PgoProperties) isPGO(ctx BaseModuleContext) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// If at least one property exists, validate that all properties exist
|
// profileKindPresent and filePresent are mandatory properties.
|
||||||
if !profileKindPresent || !filePresent || !benchmarksPresent {
|
if !profileKindPresent || !filePresent {
|
||||||
var missing []string
|
var missing []string
|
||||||
if !profileKindPresent {
|
if !profileKindPresent {
|
||||||
missing = append(missing, "profile kind (either \"instrumentation\" or \"sampling\" property)")
|
missing = append(missing, "profile kind (either \"instrumentation\" or \"sampling\" property)")
|
||||||
|
@ -208,13 +208,15 @@ func (props *PgoProperties) isPGO(ctx BaseModuleContext) bool {
|
||||||
if !filePresent {
|
if !filePresent {
|
||||||
missing = append(missing, "profile_file property")
|
missing = append(missing, "profile_file property")
|
||||||
}
|
}
|
||||||
if !benchmarksPresent {
|
|
||||||
missing = append(missing, "non-empty benchmarks property")
|
|
||||||
}
|
|
||||||
missingProps := strings.Join(missing, ", ")
|
missingProps := strings.Join(missing, ", ")
|
||||||
ctx.ModuleErrorf("PGO specification is missing properties: " + missingProps)
|
ctx.ModuleErrorf("PGO specification is missing properties: " + missingProps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Benchmark property is mandatory for instrumentation PGO.
|
||||||
|
if isInstrumentation && !benchmarksPresent {
|
||||||
|
ctx.ModuleErrorf("Instrumentation PGO specification is missing benchmark property")
|
||||||
|
}
|
||||||
|
|
||||||
if isSampling && isInstrumentation {
|
if isSampling && isInstrumentation {
|
||||||
ctx.PropertyErrorf("pgo", "Exactly one of \"instrumentation\" and \"sampling\" properties must be set")
|
ctx.PropertyErrorf("pgo", "Exactly one of \"instrumentation\" and \"sampling\" properties must be set")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue