1*47944Sbostic /*- 2*47944Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*47944Sbostic * All rights reserved. 42407Sdlw * 5*47944Sbostic * %sccs.include.proprietary.c% 623009Skre */ 723009Skre 8*47944Sbostic #ifndef lint 9*47944Sbostic static char sccsid[] = "@(#)etime_.c 5.2 (Berkeley) 04/12/91"; 10*47944Sbostic #endif /* not lint */ 11*47944Sbostic 1223009Skre /* 132407Sdlw * Return the elapsed execution time for this process. 142407Sdlw * 152407Sdlw * calling sequence: 162407Sdlw * real time(2) 172407Sdlw * call etime (time) 182407Sdlw * where: 192407Sdlw * the 2 element array, time, will receive the user and system 202407Sdlw * elapsed time since the start of execution. 212407Sdlw * 222407Sdlw * This routine can be called as function, and returns the sum of 232407Sdlw * user and system times. The time array argument must always be given. 242407Sdlw * 252407Sdlw * The resolution for all timing is 1/60 second. 262407Sdlw */ 272407Sdlw 282407Sdlw #include <sys/types.h> 292407Sdlw #include <sys/times.h> 302407Sdlw 312407Sdlw struct tb { float usrtime; float systime; }; 322407Sdlw 332407Sdlw float etime_(et)342407Sdlwetime_(et) struct tb *et; 352407Sdlw { struct tms clock; 362407Sdlw 372407Sdlw times(&clock); 382407Sdlw et->usrtime = (float) clock.tms_utime / 60.0; 392407Sdlw et->systime = (float) clock.tms_stime / 60.0; 402407Sdlw return(et->usrtime + et->systime); 412407Sdlw } 42