1: /*
   2: char id_etime[] = "@(#)etime_.c	1.1";
   3:  *
   4:  * Return the elapsed execution time for this process.
   5:  *
   6:  * calling sequence:
   7:  * 	real time(2)
   8:  * 	call etime (time)
   9:  * where:
  10:  * 	the 2 element array, time, will receive the user and system
  11:  * 	elapsed time since the start of execution.
  12:  *
  13:  *	This routine can be called as function, and returns the sum of
  14:  *	user and system times. The time array argument must always be given.
  15:  *
  16:  *	The resolution for all timing is 1/60 second.
  17:  */
  18: 
  19: #include <sys/types.h>
  20: #include <sys/times.h>
  21: 
  22: struct tb { float usrtime; float systime; };
  23: 
  24: float
  25: etime_(et) struct tb *et;
  26: {   struct tms clock;
  27: 
  28:     times(&clock);
  29:     et->usrtime = (float) clock.tms_utime / 60.0;
  30:     et->systime = (float) clock.tms_stime / 60.0;
  31:     return(et->usrtime + et->systime);
  32: }

Defined functions

etime_ defined in line 24; never used

Defined struct's

tb defined in line 22; used 2 times
  • in line 25(2)
Last modified: 1981-02-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 582
Valid CSS Valid XHTML 1.0 Strict