12407Sdlw /* 2*23009Skre * Copyright (c) 1980 Regents of the University of California. 3*23009Skre * All rights reserved. The Berkeley software License Agreement 4*23009Skre * specifies the terms and conditions for redistribution. 52407Sdlw * 6*23009Skre * @(#)etime_.c 5.1 06/07/85 7*23009Skre */ 8*23009Skre 9*23009Skre /* 102407Sdlw * Return the elapsed execution time for this process. 112407Sdlw * 122407Sdlw * calling sequence: 132407Sdlw * real time(2) 142407Sdlw * call etime (time) 152407Sdlw * where: 162407Sdlw * the 2 element array, time, will receive the user and system 172407Sdlw * elapsed time since the start of execution. 182407Sdlw * 192407Sdlw * This routine can be called as function, and returns the sum of 202407Sdlw * user and system times. The time array argument must always be given. 212407Sdlw * 222407Sdlw * The resolution for all timing is 1/60 second. 232407Sdlw */ 242407Sdlw 252407Sdlw #include <sys/types.h> 262407Sdlw #include <sys/times.h> 272407Sdlw 282407Sdlw struct tb { float usrtime; float systime; }; 292407Sdlw 302407Sdlw float 312407Sdlw etime_(et) struct tb *et; 322407Sdlw { struct tms clock; 332407Sdlw 342407Sdlw times(&clock); 352407Sdlw et->usrtime = (float) clock.tms_utime / 60.0; 362407Sdlw et->systime = (float) clock.tms_stime / 60.0; 372407Sdlw return(et->usrtime + et->systime); 382407Sdlw } 39