2005-04-21 16:53:53 +02:00
|
|
|
#include "syslib.h"
|
|
|
|
|
2012-03-25 20:25:53 +02:00
|
|
|
int sys_times(proc_ep, user_time, sys_time, uptime, boottime)
|
2009-09-22 23:42:02 +02:00
|
|
|
endpoint_t proc_ep; /* proc_ep whose times are needed */
|
2007-08-16 15:16:26 +02:00
|
|
|
clock_t *user_time; /* time spend in the process itself */
|
|
|
|
clock_t *sys_time; /* time spend in system on behalf of the
|
|
|
|
* process
|
|
|
|
*/
|
|
|
|
clock_t *uptime; /* time the system is running */
|
2009-12-11 01:08:19 +01:00
|
|
|
time_t *boottime; /* boot time */
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
2009-09-22 23:42:02 +02:00
|
|
|
/* Fetch the accounting info for a proc_ep. */
|
2005-04-21 16:53:53 +02:00
|
|
|
message m;
|
|
|
|
int r;
|
|
|
|
|
2014-05-22 11:32:14 +02:00
|
|
|
m.m_lsys_krn_sys_times.endpt = proc_ep;
|
2010-02-09 16:20:09 +01:00
|
|
|
r = _kernel_call(SYS_TIMES, &m);
|
2014-05-22 11:32:14 +02:00
|
|
|
if (user_time) *user_time = m.m_krn_lsys_sys_times.user_time;
|
|
|
|
if (sys_time) *sys_time = m.m_krn_lsys_sys_times.system_time;
|
|
|
|
if (uptime) *uptime = m.m_krn_lsys_sys_times.boot_ticks;
|
|
|
|
if (boottime) *boottime = m.m_krn_lsys_sys_times.boot_time;
|
2005-04-21 16:53:53 +02:00
|
|
|
return(r);
|
|
|
|
}
|