1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)etime_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * Return the elapsed execution time for this process. 14 * 15 * calling sequence: 16 * real time(2) 17 * call etime (time) 18 * where: 19 * the 2 element array, time, will receive the user and system 20 * elapsed time since the start of execution. 21 * 22 * This routine can be called as function, and returns the sum of 23 * user and system times. The time array argument must always be given. 24 * 25 * The resolution for all timing is 1/60 second. 26 */ 27 28 #include <sys/types.h> 29 #include <sys/times.h> 30 31 struct tb { float usrtime; float systime; }; 32 33 float etime_(et)34etime_(et) struct tb *et; 35 { struct tms clock; 36 37 times(&clock); 38 et->usrtime = (float) clock.tms_utime / 60.0; 39 et->systime = (float) clock.tms_stime / 60.0; 40 return(et->usrtime + et->systime); 41 } 42