[Fortran] 纯文本查看 复制代码
program main
Use DFPort
Use Kernel32
integer , parameter :: QP = Selected_real_kind( 18 )
integer::a , b , f,iss
real(kind=QP)::time_begin,time_end
CALL CPU_TIME ( time_begin )
iss = QueryPerformanceFrequency( Loc(f) )
iss = QueryPerformanceCounter( Loc(a) )
......
......!computing
.....
iss = QueryPerformanceCounter( Loc(b) )
CALL CPU_TIME ( time_end )
write(*,*)'Time of operation was ',(b-a)*1.0e-8_QP/(f*1.0e-8_QP), ' seconds' ,time_end-time_begin
end
[Fortran] 纯文本查看 复制代码
INTEGER :: clock_rate, clock_max, clocks, clock_1, clock_2
REAL :: sec_elapsed
...
CALL SYSTEM_CLOCK(COUNT_RATE=clock_rate, COUNT_MAX=clock_max)
...
!-------
CALL SYSTEM_CLOCK(COUNT=clock_1)
...
CALL SYSTEM_CLOCK(COUNT=clock_2)
clocks = clock_2 - clock_1
IF( clocks < 0 ) clocks = clocks + clock_max
sec_elapsed = REAL(clocks)/REAL(clock_rate)