Fixed start time.

2006-06-24  Benoît Dejean  <benoit@placenet.org>

	* proctime.c: (glibtop_get_proc_time_s):

	Fixed start time.

	Patch by hua.zhang@sun.com.
	Closes #345819.
This commit is contained in:
Benoît Dejean
2006-06-24 17:47:34 +00:00
committed by Benoît Dejean
parent c7e0a7ac59
commit 7f477561f0
2 changed files with 13 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
2006-06-24 Benoît Dejean <benoit@placenet.org>
* proctime.c: (glibtop_get_proc_time_s):
Fixed start time.
Patch by hua.zhang@sun.com.
Closes #345819.
2006-06-24 Benoît Dejean <benoit@placenet.org>
* procmap.c: (glibtop_get_proc_map_s):

View File

@@ -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;