Use the same method to determine the time that the process

ended that fork() uses to determine the time that the process
started when calculating the elapsed time.  This prevents the
ac_etime field in the accounting record from getting set to -1
if the process exists for a VERY short period of time.
This commit is contained in:
Mike Pritchard 1995-07-23 23:02:20 +00:00
parent be49bd16c6
commit 57585a8e54
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9672

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
* $Id: kern_acct.c,v 1.5 1994/09/26 21:09:00 davidg Exp $
* $Id: kern_acct.c,v 1.6 1994/10/02 17:35:09 phk Exp $
*/
#include <sys/param.h>
@ -183,9 +183,7 @@ acct_process(p)
/* (3) The elapsed time the commmand ran (and its starting time) */
acct.ac_btime = p->p_stats->p_start.tv_sec;
s = splclock();
tmp = time;
splx(s);
microtime(&tmp);
timevalsub(&tmp, &p->p_stats->p_start);
acct.ac_etime = encode_comp_t(tmp.tv_sec, tmp.tv_usec);