add proc_time.total field (sum of user+sys)

This commit is contained in:
Doug MacEachern 2004-08-21 00:25:07 +00:00
parent 606275fc36
commit 4736d77c87
10 changed files with 15 additions and 1 deletions

View File

@ -278,6 +278,11 @@ my %classes = (
desc => 'Process cpu kernel time',
plat => 'ADHLSW'
},
{
name => 'total', type => 'Long',
desc => 'Process cpu time (sum of User and Sys)',
plat => 'ADHLSW'
},
],
ProcState => [
{

View File

@ -26,6 +26,7 @@ public class TestInvoker extends SigarTestCase {
{ "sigar:Type=ProcMem,Arg=$$", "Vsize" },
{ "sigar:Type=ProcTime,Arg=$$", "Sys" },
{ "sigar:Type=ProcTime,Arg=$$", "User" },
{ "sigar:Type=ProcTime,Arg=$$", "Total" },
//test Utime/Stime backcompat.
{ "sigar:Type=ProcTime,Arg=$$", "Stime" },
{ "sigar:Type=ProcTime,Arg=$$", "Utime" },

View File

@ -210,7 +210,8 @@ typedef struct {
sigar_uint64_t
start_time,
user,
sys;
sys,
total;
} sigar_proc_time_t;
SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,

View File

@ -967,6 +967,7 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
proctime->start_time *= 1000; /* convert to ms */
proctime->user = pinfo->pi_utime;
proctime->sys = pinfo->pi_stime;
proctime->total = proctime->user + proctime->sys;
return SIGAR_OK;
}

View File

@ -422,6 +422,7 @@ static int get_proc_times(sigar_pid_t pid, sigar_proc_time_t *time)
time->user = utime.seconds;
time->sys = stime.seconds;
proctime->total = proctime->user + proctime->sys;
return SIGAR_OK;
}

View File

@ -297,6 +297,7 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
proctime->start_time *= 1000;
proctime->user = pinfo->pst_utime;
proctime->sys = pinfo->pst_stime;
proctime->total = proctime->user + proctime->sys;
return SIGAR_OK;
}

View File

@ -639,6 +639,7 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
proctime->user = pstat->utime;
proctime->sys = pstat->stime;
proctime->total = proctime->user + proctime->sys;
proctime->start_time = pstat->start_time;
return SIGAR_OK;

View File

@ -584,6 +584,7 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
proctime->user = PRTIME_2SIGAR(usage.pr_utime);
proctime->sys = PRTIME_2SIGAR(usage.pr_stime);
proctime->total = proctime->user + proctime->sys;
return SIGAR_OK;
}

View File

@ -121,6 +121,7 @@ int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
proctime->start_time = -1;
proctime->user = -1;
proctime->sys = -1;
proctime->total = proctime->user + proctime->sys;
return SIGAR_OK;
}

View File

@ -647,6 +647,7 @@ SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
proctime->user = FILETIME2SEC(user_time);
proctime->sys = FILETIME2SEC(system_time);
proctime->total = proctime->user + proctime->sys;
return SIGAR_OK;
}