Collect useful resource information of each executed process in soong_ui.
Collect the resource information of each executed process in soong_ui
for metrics analysis.
Bug: b/169453825
Test: m nothing; "lunch 1" && m
Change-Id: I8c7fe019111921c4c59174d133b85439ec825885
diff --git a/ui/build/exec.go b/ui/build/exec.go
index 053bbae..8f92269 100644
--- a/ui/build/exec.go
+++ b/ui/build/exec.go
@@ -66,8 +66,11 @@
}
func (c *Cmd) report() {
- if c.Cmd.ProcessState != nil {
- rusage := c.Cmd.ProcessState.SysUsage().(*syscall.Rusage)
+ if state := c.Cmd.ProcessState; state != nil {
+ if c.ctx.Metrics != nil {
+ c.ctx.Metrics.EventTracer.AddProcResInfo(c.name, state)
+ }
+ rusage := state.SysUsage().(*syscall.Rusage)
c.ctx.Verbosef("%q finished with exit code %d (%s real, %s user, %s system, %dMB maxrss)",
c.name, c.Cmd.ProcessState.ExitCode(),
time.Since(c.started).Round(time.Millisecond),