Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58fa5a3f authored by Jeongik Cha's avatar Jeongik Cha Committed by Gerrit Code Review
Browse files

Merge "Add critical path infomation into metrics"

parents 79727bd2 28c1fe5b
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ func main() {
		log.Cleanup()
		stat.Finish()
	})

	criticalPath := status.NewCriticalPath()
	buildCtx := build.Context{ContextImpl: &build.ContextImpl{
		Context:      ctx,
		Logger:       log,
@@ -188,6 +188,7 @@ func main() {
		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))
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ func (t *Test) Run(logsDir string) {
	stat.AddOutput(status.NewVerboseLog(log, filepath.Join(logsDir, "verbose.log")))
	stat.AddOutput(status.NewErrorLog(log, filepath.Join(logsDir, "error.log")))
	stat.AddOutput(status.NewProtoErrorLog(log, filepath.Join(logsDir, "build_error")))
	stat.AddOutput(status.NewCriticalPath(log))
	stat.AddOutput(status.NewCriticalPathLogger(log, nil))

	defer met.Dump(filepath.Join(logsDir, "soong_metrics"))

+2 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ type ContextImpl struct {

	Thread tracer.Thread
	Tracer tracer.Tracer

	CriticalPath *status.CriticalPath
}

// BeginTrace starts a new Duration Event.
+5 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import (
	"time"

	"android/soong/shared"

	"google.golang.org/protobuf/proto"

	soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
@@ -125,6 +126,10 @@ func (m *Metrics) SetTimeMetrics(perf soong_metrics_proto.PerfInfo) {
	}
}

func (m *Metrics) SetCriticalPathInfo(criticalPathInfo soong_metrics_proto.CriticalPathInfo) {
	m.metrics.CriticalPathInfo = &criticalPathInfo
}

// SetFatalOrPanicMessage stores a non-zero exit and the relevant message in the latest event if
// available or the metrics base.
func (m *Metrics) SetFatalOrPanicMessage(errMsg string) {
+352 −171

File changed.

Preview size limit exceeded, changes collapsed.

Loading