From 2e940caf9738933979e9342f4e7f7268cecbc9c7 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 4 Sep 2004 18:37:17 +0000 Subject: [PATCH] PR: 9519 workaround solaris 10 issue in proc_time --- src/os/solaris/solaris_sigar.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/os/solaris/solaris_sigar.c b/src/os/solaris/solaris_sigar.c index 592c7830..db960021 100644 --- a/src/os/solaris/solaris_sigar.c +++ b/src/os/solaris/solaris_sigar.c @@ -581,7 +581,22 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid, proctime->start_time = usage.pr_create.tv_sec + sigar->boot_time; proctime->start_time *= 1000; - + + if (usage.pr_utime.tv_sec < 0) { + /* XXX wtf? seen on solaris 10, only for the self process */ + pstatus_t pstatus; + + status = sigar_get_proc_status(sigar, &pstatus, pid); + if (status != SIGAR_OK) { + return status; + } + + usage.pr_utime.tv_sec = pstatus.pr_utime.tv_sec; + usage.pr_utime.tv_nsec = pstatus.pr_utime.tv_nsec; + usage.pr_stime.tv_sec = pstatus.pr_stime.tv_sec; + usage.pr_stime.tv_nsec = pstatus.pr_stime.tv_nsec; + } + proctime->user = PRTIME_2SIGAR(usage.pr_utime); proctime->sys = PRTIME_2SIGAR(usage.pr_stime); proctime->total = proctime->user + proctime->sys;