minix/lib/syslib/sys_times.c

22 lines
593 B
C
Raw Normal View History

2005-04-21 16:53:53 +02:00
#include "syslib.h"
2007-08-16 15:16:26 +02:00
PUBLIC int sys_times(proc, user_time, sys_time, uptime)
2005-04-21 16:53:53 +02:00
int proc; /* proc 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 */
2005-04-21 16:53:53 +02:00
{
/* Fetch the accounting info for a proc. */
message m;
int r;
m.T_ENDPT = proc;
2005-04-21 16:53:53 +02:00
r = _taskcall(SYSTASK, SYS_TIMES, &m);
2007-08-16 15:16:26 +02:00
if (user_time) *user_time = m.T_USER_TIME;
if (sys_time) *sys_time = m.T_SYSTEM_TIME;
if (uptime) *uptime = m.T_BOOT_TICKS;
2005-04-21 16:53:53 +02:00
return(r);
}