From 7f477561f00ccae87a0a2ea2a9c0ab07a5a76503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Sat, 24 Jun 2006 17:47:34 +0000 Subject: [PATCH] Fixed start time. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2006-06-24 Benoît Dejean * proctime.c: (glibtop_get_proc_time_s): Fixed start time. Patch by hua.zhang@sun.com. Closes #345819. --- sysdeps/solaris/ChangeLog | 9 +++++++++ sysdeps/solaris/proctime.c | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sysdeps/solaris/ChangeLog b/sysdeps/solaris/ChangeLog index 35e5bbb7..dff4595c 100644 --- a/sysdeps/solaris/ChangeLog +++ b/sysdeps/solaris/ChangeLog @@ -1,3 +1,12 @@ +2006-06-24 Benoît Dejean + + * proctime.c: (glibtop_get_proc_time_s): + + Fixed start time. + + Patch by hua.zhang@sun.com. + Closes #345819. + 2006-06-24 Benoît Dejean * procmap.c: (glibtop_get_proc_map_s): diff --git a/sysdeps/solaris/proctime.c b/sysdeps/solaris/proctime.c index 0e85127b..beb6daa8 100644 --- a/sysdeps/solaris/proctime.c +++ b/sysdeps/solaris/proctime.c @@ -46,6 +46,7 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, pid_t pid) { struct prusage prusage; + GTimeVal time; memset (buf, 0, sizeof (glibtop_proc_time)); @@ -56,7 +57,9 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, if (glibtop_get_proc_data_usage_s (server, &prusage, pid)) return; - buf->start_time = prusage.pr_create.tv_sec; + g_get_current_time (&time); + /* prusage.pr_rtime.tv_sec is the during that the process existed */ + buf->start_time = time.tv_sec - prusage.pr_rtime.tv_sec; buf->rtime = prusage.pr_rtime.tv_sec * 1E+6 + prusage.pr_rtime.tv_nsec / 1E+3;