Oh, I should have said yesterday, one way
to time a procedure is to call it from a non-optimized
caller. That is, write the following:
CALL SYSTEM_CLOCK(CLOCK=c1)
DO k=1,1000...
erf_x=Erf(x)
END DO
CALL SYSTEM_CLOCK(CLOCK=c2)
counts=c2-c1
You compile this with the least optimization possible.
Of course, the ERF function itself is compiled with
whatever optimization you're testing. To find out the
overhead of the non-optimized caller, replace ERF with
a do_nothing function (which just returns). The
excess that the ERF version takes is the actual time
of the procedure without counting the loop overhead,
call/return overhead, etc.. After all, you're trying to
benchmark the ERF function, not the caller.
Of course, if your compiler does significant optimizations
even at the least optimizing level you've got problems.
--
J. Giles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|