xref: /minix/minix/lib/libsys/sys_times.c (revision 83133719)
1 #include "syslib.h"
2 
3 int sys_times(proc_ep, user_time, sys_time, uptime, boottime)
4 endpoint_t proc_ep;		/* proc_ep whose times are needed */
5 clock_t *user_time;		/* time spend in the process itself */
6 clock_t *sys_time;		/* time spend in system on behalf of the
7 				 * process
8 				 */
9 clock_t *uptime;		/* time the system is running */
10 time_t *boottime;		/* boot time */
11 {
12 /* Fetch the accounting info for a proc_ep. */
13   message m;
14   int r;
15 
16   m.m_lsys_krn_sys_times.endpt = proc_ep;
17   r = _kernel_call(SYS_TIMES, &m);
18   if (user_time) *user_time = m.m_krn_lsys_sys_times.user_time;
19   if (sys_time) *sys_time = m.m_krn_lsys_sys_times.system_time;
20   if (uptime) *uptime = m.m_krn_lsys_sys_times.boot_ticks;
21   if (boottime) *boottime = m.m_krn_lsys_sys_times.boot_time;
22   return(r);
23 }
24