wpallen@watale.UUCP (Warren P. Allen @ U of Waterloo X 2522) (11/10/85)
Does anyone out there in f77 land know if there's a built-in f77 command to time segments of code? ie. can I 'turn a clock on' then 'look' at the clock later and calculate the difference in cpu seconds? ...or is there another way of doing this? ps. I already know of the 'time' command for unix, but that works only for entire programs... thanx in advance
mather@uicsl.UUCP (11/11/85)
Look at dtime(3F) and etime(3F). Briefly: real function etime(t) real t(2) returns elapsed (sys,user) time of the process since beginning. real function dtime(t) real t(2) returns delta time since last call (or beginning if first call) Both functions return the sum of sys+user times with granuality of 1/60 sec. the real array contains the system time t(1) and the user time t(2) separated. Because process timing is very rough, take the results with a grain of salt. The results are load dependant and so can be confusing. This is because the times are calculated by sampling the program counter (I was told) peiodically and seeing where it is and whose program it's in. Also look into profiling with the f77 -p switch. You can get interesting statistics about functions/subroutines, etc. ---- b.c.mather Software Surgeon uiucdcs!uicsl!mather
woods@hao.UUCP (Greg Woods) (11/13/85)
> Does anyone out there in f77 land know if there's a built-in > f77 command to time segments of code? This really depends on what kind of system you are running on. On our system (4.2BSD on a VAX 11/750), there is no CPU time function in the F77 library, but since FORTRAN and C can call each other, it's fairly trivial to write a C routine to return CPU time used. --Greg
jerry@ucbopal.BERKELEY.EDU (Jerry Berkman) (11/13/85)
In article <1851@hao.UUCP> woods@hao.UUCP (Greg Woods) writes: >> Does anyone out there in f77 land know if there's a built-in >> f77 command to time segments of code? > > This really depends on what kind of system you are running on. On our >system (4.2BSD on a VAX 11/750), there is no CPU time function in >the F77 library, but since FORTRAN and C can call each other, it's >fairly trivial to write a C routine to return CPU time used. > >--Greg See etime(3f) in the Programmer's manual for 4.2 BSD or ULTRIX systems. - Jerry Berkman Computing Services, (415) 642-4804 U. C. Berkeley jerry@opal.Berkeley.EDU