From 1c8c66dd0c12188740fc8ead831cd7d12f66a7c3 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 23 Sep 2004 01:07:51 +0000 Subject: [PATCH] implement proc_time --- src/os/osf1/osf1_sigar.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/os/osf1/osf1_sigar.c b/src/os/osf1/osf1_sigar.c index babb0168..22dedcd9 100644 --- a/src/os/osf1/osf1_sigar.c +++ b/src/os/osf1/osf1_sigar.c @@ -244,10 +244,19 @@ int sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid, int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid, sigar_proc_time_t *proctime) { - proctime->start_time = -1; - proctime->user = -1; - proctime->sys = -1; + struct user s_user; + int status; + + status = table(TBL_UAREA, pid, &s_user, 1, sizeof(s_user)); + + if (status != 1) { + return errno; + } + + proctime->user = s_user.u_ru.ru_utime.tv_sec; + proctime->sys = s_user.u_ru.ru_stime.tv_sec; proctime->total = proctime->user + proctime->sys; + proctime->start_time = s_user.u_start.tv_sec; return SIGAR_OK; }