Add critical path infomation into metrics
To improve build efficiency, the metrics for critical path and parallelism ratio is necessary. That information has been included in soong.log, so added it into metrics as well. Bug: 271526845 Test: build and check if metrics pb has critical path info Change-Id: I14e1a78c13d400b792d3b05df18604da48759ade
This commit is contained in:
@@ -180,14 +180,15 @@ func main() {
|
||||
log.Cleanup()
|
||||
stat.Finish()
|
||||
})
|
||||
|
||||
criticalPath := status.NewCriticalPath()
|
||||
buildCtx := build.Context{ContextImpl: &build.ContextImpl{
|
||||
Context: ctx,
|
||||
Logger: log,
|
||||
Metrics: met,
|
||||
Tracer: trace,
|
||||
Writer: output,
|
||||
Status: stat,
|
||||
Context: ctx,
|
||||
Logger: log,
|
||||
Metrics: met,
|
||||
Tracer: trace,
|
||||
Writer: output,
|
||||
Status: stat,
|
||||
CriticalPath: criticalPath,
|
||||
}}
|
||||
|
||||
config := c.config(buildCtx, args...)
|
||||
@@ -224,6 +225,8 @@ func main() {
|
||||
defer build.UploadMetrics(buildCtx, config, c.simpleOutput, buildStarted, bazelProfileFile, bazelMetricsFile, metricsFiles...)
|
||||
}
|
||||
defer met.Dump(soongMetricsFile)
|
||||
// Should run before Metric.Dump
|
||||
defer criticalPath.WriteToMetrics(met)
|
||||
|
||||
c.run(buildCtx, config, args)
|
||||
|
||||
@@ -254,7 +257,7 @@ func logAndSymlinkSetup(buildCtx build.Context, config build.Config) {
|
||||
stat.AddOutput(status.NewVerboseLog(log, filepath.Join(logsDir, logsPrefix+"verbose.log")))
|
||||
stat.AddOutput(status.NewErrorLog(log, filepath.Join(logsDir, logsPrefix+"error.log")))
|
||||
stat.AddOutput(status.NewProtoErrorLog(log, buildErrorFile))
|
||||
stat.AddOutput(status.NewCriticalPath(log))
|
||||
stat.AddOutput(status.NewCriticalPathLogger(log, buildCtx.CriticalPath))
|
||||
stat.AddOutput(status.NewBuildProgressLog(log, filepath.Join(logsDir, logsPrefix+"build_progress.pb")))
|
||||
|
||||
buildCtx.Verbosef("Detected %.3v GB total RAM", float32(config.TotalRAM())/(1024*1024*1024))
|
||||
|
Reference in New Issue
Block a user