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:
committed by
Benoît Dejean
parent
c7e0a7ac59
commit
7f477561f0
@@ -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>
|
2006-06-24 Benoît Dejean <benoit@placenet.org>
|
||||||
|
|
||||||
* procmap.c: (glibtop_get_proc_map_s):
|
* procmap.c: (glibtop_get_proc_map_s):
|
||||||
|
@@ -46,6 +46,7 @@ glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
|
|||||||
pid_t pid)
|
pid_t pid)
|
||||||
{
|
{
|
||||||
struct prusage prusage;
|
struct prusage prusage;
|
||||||
|
GTimeVal time;
|
||||||
|
|
||||||
memset (buf, 0, sizeof (glibtop_proc_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))
|
if (glibtop_get_proc_data_usage_s (server, &prusage, pid))
|
||||||
return;
|
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 +
|
buf->rtime = prusage.pr_rtime.tv_sec * 1E+6 +
|
||||||
prusage.pr_rtime.tv_nsec / 1E+3;
|
prusage.pr_rtime.tv_nsec / 1E+3;
|
||||||
|
Reference in New Issue
Block a user