fortran中如何提供计算程序运行时间?

时间:2024-09-09 23:06:44

如下:

Real time_begin , time_end1 , time_end2
Integer i , j
call CPU_TIME(time_begin)
write(*,*) time_begin
do j = ,
Do i = ,
End Do
call CPU_TIME(time_end1)
write(*,*) j , time_end1 , time_end1 - time_begin
end do
call CPU_TIME(time_end2)
write(*,*) 't' , time_end2 , time_end2 - time_beginend

输出为:

1.5600100E-02
           1   1.248008       1.232408
           2   2.496016       2.480416
           3   3.697224       3.681623
           4   4.914032       4.898431
           5   6.099639       6.084039
           6   7.316447       7.300847
           7   8.517654       8.502054
           8   9.734463       9.718863
           9   10.92007       10.90447
          10   12.13688       12.12128
          11   13.33809       13.32248
          12   14.53929       14.52369
          13   15.74050       15.72490
          14   16.97291       16.95731
          15   18.18972       18.17412
          16   19.39092       19.37532
          17   20.59213       20.57653
          18   21.77774       21.76214
          19   22.96335       22.94775
          20   24.19576       24.18015
          21   25.39696       25.38136
          22   26.59817       26.58257
          23   27.81498       27.79938
          24   29.01619       29.00059
          25   30.21739       30.20179
          26   31.43420       31.41860
          27   32.65101       32.63541
          28   33.83662       33.82102
          29   35.02222       35.00663
          30   36.22343       36.20783
t   36.22343       36.20783
请按任意键继续. . .