主题:CPU_TIME分辨不出时间长度
program main
implicit none
real::
integer::
call cpu_time(time_begin)
....
...
call cputime(time_end)
write(*,*)'Time of operation was ',time_end-time_begin, ' seconds'
write(*,*)time_end,time_begin
end
每次跳出来的time_end和time_begin都是一样的,time_end-time_begin结果是0
后来在本论坛找到一个帖子
http://bbs.pfan.cn/post-317397.html
Program M
Use DFPort
Use Kernel32
Real T1,T2
Real*8 T1RTC,T2RTC
Integer*8 a , b , f
iss = QueryPerformanceFrequency( Loc(f) )
Do i = 1 , 30
iss = QueryPerformanceCounter( Loc(a) )
T1RTC = RTC( )
Call CPU_TIME( T1 )
Do j = 1 , 500000*i
s = s + 100
End Do
Call CPU_TIME( T2 )
T2RTC = RTC()
iss = QueryPerformanceCounter( Loc(b) )
write(*,*) T2 - T1 , T2RTC - T1RTC , (b-a)*1.0_8/f*1.0_8
End Do
End
这里面不懂的有几点
1.0_8 这个表示啥?
先是初始化变量f然后(b-a)*1.0_8/f*1.0_8
这是啥意思?