implement proc_time
This commit is contained in:
parent
00805a58cf
commit
1c8c66dd0c
|
@ -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,
|
int sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid,
|
||||||
sigar_proc_time_t *proctime)
|
sigar_proc_time_t *proctime)
|
||||||
{
|
{
|
||||||
proctime->start_time = -1;
|
struct user s_user;
|
||||||
proctime->user = -1;
|
int status;
|
||||||
proctime->sys = -1;
|
|
||||||
|
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->total = proctime->user + proctime->sys;
|
||||||
|
proctime->start_time = s_user.u_start.tv_sec;
|
||||||
|
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue