From bd465cca8a35729e5f4a89432015bb5bd24ad790 Mon Sep 17 00:00:00 2001 From: Jeongik Cha Date: Mon, 6 Mar 2023 11:44:45 +0900 Subject: [PATCH] Use Sec as well as Usec in ProcResInfo Timeval has two fields: Sec and Usec, but in previous implementation, it only uses Usec, so Sec data is abandoned. Bug: 271526845 Test: check metric, and if seconds data is reserved. Change-Id: I911467f77b41995f6c833099648fe62fbc9909eb --- ui/metrics/event.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/metrics/event.go b/ui/metrics/event.go index b3a027ea0..cbdeb2789 100644 --- a/ui/metrics/event.go +++ b/ui/metrics/event.go @@ -135,8 +135,8 @@ func (t *EventTracer) AddProcResInfo(name string, state *os.ProcessState) { e := t.peek() e.procResInfo = append(e.procResInfo, &soong_metrics_proto.ProcessResourceInfo{ Name: proto.String(name), - UserTimeMicros: proto.Uint64(uint64(rusage.Utime.Usec)), - SystemTimeMicros: proto.Uint64(uint64(rusage.Stime.Usec)), + UserTimeMicros: proto.Uint64(uint64(state.UserTime().Microseconds())), + SystemTimeMicros: proto.Uint64(uint64(state.SystemTime().Microseconds())), MinorPageFaults: proto.Uint64(uint64(rusage.Minflt)), MajorPageFaults: proto.Uint64(uint64(rusage.Majflt)), // ru_inblock and ru_oublock are measured in blocks of 512 bytes.