Better interface for sys_times.
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
#include "syslib.h"
|
||||
|
||||
PUBLIC int sys_times(proc, ptr)
|
||||
PUBLIC int sys_times(proc, user_time, sys_time, uptime)
|
||||
int proc; /* proc whose times are needed */
|
||||
clock_t ptr[5]; /* pointer to time buffer */
|
||||
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 */
|
||||
{
|
||||
/* Fetch the accounting info for a proc. */
|
||||
message m;
|
||||
@@ -10,10 +14,8 @@ clock_t ptr[5]; /* pointer to time buffer */
|
||||
|
||||
m.T_ENDPT = proc;
|
||||
r = _taskcall(SYSTASK, SYS_TIMES, &m);
|
||||
ptr[0] = m.T_USER_TIME;
|
||||
ptr[1] = m.T_SYSTEM_TIME;
|
||||
ptr[2] = 0;
|
||||
ptr[3] = 0;
|
||||
ptr[4] = m.T_BOOT_TICKS;
|
||||
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;
|
||||
return(r);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user