zrhans

time_execution.f90

Jun 10th, 2015
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program fucoes
  2. implicit none
  3.  
  4. real :: start, finish, x
  5. integer :: i, j, a = 0, b = 1.0
  6.  
  7. !Returns a REAL value representing the elapsed CPU time in seconds.
  8. !This is useful for testing segments of code to determine execution !time.
  9. !https://gcc.gnu.org/onlinedocs/gcc-4.7.4/gfortran/CPU_005fTIME.html#CPU_005fTIME
  10.              
  11. print*,'----'
  12. do i = 1, 10
  13.     call cpu_time(start)
  14.     do j = 1, 1000000
  15.         a = a + b
  16.     enddo
  17.     call cpu_time(finish)
  18.     print '("Custou = ",e18.3," seconds.")',finish-start
  19. enddo
  20. print*,'----'
  21. stop 'Programa finalizado.'
  22. end
Advertisement
Add Comment
Please, Sign In to add comment