Better interface for sys_times.
This commit is contained in:
@@ -245,7 +245,7 @@ int for_trace;
|
||||
int parent_waiting, right_child, r;
|
||||
pid_t pidarg, procgrp;
|
||||
struct mproc *p_mp;
|
||||
clock_t t[5];
|
||||
clock_t user_time, sys_time;
|
||||
|
||||
proc_nr = (int) (rmp - mproc); /* get process slot number */
|
||||
proc_nr_e = rmp->mp_endpoint;
|
||||
@@ -257,12 +257,12 @@ int for_trace;
|
||||
if (rmp->mp_flags & ALARM_ON) set_alarm(proc_nr_e, (unsigned) 0);
|
||||
|
||||
/* Do accounting: fetch usage times and accumulate at parent. */
|
||||
if((r=sys_times(proc_nr_e, t)) != OK)
|
||||
if((r=sys_times(proc_nr_e, &user_time, &sys_time, NULL)) != OK)
|
||||
panic(__FILE__,"pm_exit: sys_times failed", r);
|
||||
|
||||
p_mp = &mproc[rmp->mp_parent]; /* process' parent */
|
||||
p_mp->mp_child_utime += t[0] + rmp->mp_child_utime; /* add user time */
|
||||
p_mp->mp_child_stime += t[1] + rmp->mp_child_stime; /* add system time */
|
||||
p_mp->mp_child_utime += user_time + rmp->mp_child_utime; /* add user time */
|
||||
p_mp->mp_child_stime += sys_time + rmp->mp_child_stime; /* add system time */
|
||||
|
||||
/* Tell the kernel the process is no longer runnable to prevent it from
|
||||
* being scheduled in between the following steps. Then tell FS that it
|
||||
|
||||
+4
-4
@@ -691,7 +691,7 @@ register struct mproc *rmp; /* whose core is to be dumped */
|
||||
pid_t procgrp;
|
||||
vir_bytes current_sp;
|
||||
struct mproc *p_mp;
|
||||
clock_t t[5];
|
||||
clock_t user_time, sys_time;
|
||||
|
||||
#if 0
|
||||
printf("dumpcore for %d / %s\n", rmp->mp_pid, rmp->mp_name);
|
||||
@@ -731,12 +731,12 @@ register struct mproc *rmp; /* whose core is to be dumped */
|
||||
if (rmp->mp_flags & ALARM_ON) set_alarm(proc_nr_e, (unsigned) 0);
|
||||
|
||||
/* Do accounting: fetch usage times and accumulate at parent. */
|
||||
if((r=sys_times(proc_nr_e, t)) != OK)
|
||||
if((r=sys_times(proc_nr_e, &user_time, &sys_time, NULL)) != OK)
|
||||
panic(__FILE__,"pm_exit: sys_times failed", r);
|
||||
|
||||
p_mp = &mproc[rmp->mp_parent]; /* process' parent */
|
||||
p_mp->mp_child_utime += t[0] + rmp->mp_child_utime; /* add user time */
|
||||
p_mp->mp_child_stime += t[1] + rmp->mp_child_stime; /* add system time */
|
||||
p_mp->mp_child_utime += user_time + rmp->mp_child_utime; /* add user time */
|
||||
p_mp->mp_child_stime += sys_time + rmp->mp_child_stime; /* add system time */
|
||||
|
||||
/* Tell the kernel the process is no longer runnable to prevent it from
|
||||
* being scheduled in between the following steps. Then tell FS that it
|
||||
|
||||
+5
-5
@@ -67,16 +67,16 @@ PUBLIC int do_times()
|
||||
{
|
||||
/* Perform the times(buffer) system call. */
|
||||
register struct mproc *rmp = mp;
|
||||
clock_t t[5];
|
||||
clock_t user_time, sys_time, uptime;
|
||||
int s;
|
||||
|
||||
if (OK != (s=sys_times(who_e, t)))
|
||||
if (OK != (s=sys_times(who_e, &user_time, &sys_time, &uptime)))
|
||||
panic(__FILE__,"do_times couldn't get times", s);
|
||||
rmp->mp_reply.reply_t1 = t[0]; /* user time */
|
||||
rmp->mp_reply.reply_t2 = t[1]; /* system time */
|
||||
rmp->mp_reply.reply_t1 = user_time; /* user time */
|
||||
rmp->mp_reply.reply_t2 = sys_time; /* system time */
|
||||
rmp->mp_reply.reply_t3 = rmp->mp_child_utime; /* child user time */
|
||||
rmp->mp_reply.reply_t4 = rmp->mp_child_stime; /* child system time */
|
||||
rmp->mp_reply.reply_t5 = t[4]; /* uptime since boot */
|
||||
rmp->mp_reply.reply_t5 = uptime; /* uptime since boot */
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user