Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_timer.F90
Go to the documentation of this file.
1 !**************************************************************
2 ! Copyright INRIA
3 ! Authors :
4 ! CALVI project team
5 !
6 ! This code SeLaLib (for Semi-Lagrangian-Library)
7 ! is a parallel library for simulating the plasma turbulence
8 ! in a tokamak.
9 !
10 ! This software is governed by the CeCILL-B license
11 ! under French law and abiding by the rules of distribution
12 ! of free software. You can use, modify and redistribute
13 ! the software under the terms of the CeCILL-B license as
14 ! circulated by CEA, CNRS and INRIA at the following URL
15 ! "http://www.cecill.info".
16 !**************************************************************
17 
30 
41 
42 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
43 #include "sll_working_precision.h"
44 
45  implicit none
46 
47  public :: &
52 
53  private
54 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
55 
58  integer, parameter :: itimer = selected_int_kind(18)
59 
62  integer(kind=itimer) :: clock_ticks
63  integer(kind=itimer) :: clock_ticks_max
64  integer(kind=itimer) :: clock_ticks_per_sec
65  end type sll_t_time_mark
66 
67 contains
68 
71  subroutine sll_s_set_time_mark(timer_obj)
72  type(sll_t_time_mark), intent(out) :: timer_obj
73  call system_clock(count=timer_obj%clock_ticks, &
74  count_rate=timer_obj%clock_ticks_per_sec, &
75  count_max=timer_obj%clock_ticks_max)
76  end subroutine sll_s_set_time_mark
77 
82  function sll_f_time_elapsed_between(t0, t1)
83  type(sll_t_time_mark), intent(in) :: t0, t1
84 
85  real(kind=f64) :: sll_f_time_elapsed_between
86  integer(kind=itimer) :: clock_ticks
87 
88  clock_ticks = t1%clock_ticks - t0%clock_ticks
89 !!$ if (t1%clock_ticks < t0%clock_ticks) then
90 !!$ clock_ticks = clock_ticks + t0%clock_ticks_max
91 !!$ end if
93  real(clock_ticks, kind=f64)/real(t0%clock_ticks_per_sec, kind=f64)
94  end function sll_f_time_elapsed_between
95 
100  type(sll_t_time_mark), intent(in) :: t0
101 
102  real(kind=f64) :: sll_f_time_elapsed_since
103  integer(kind=itimer) :: t1
104  integer(kind=itimer) :: clock_ticks
105 
106  call system_clock(count=t1)
107  clock_ticks = t1 - t0%clock_ticks
108 !!$ if (t1%clock_ticks < t0%clock_ticks) then
109 !!$ clock_ticks = clock_ticks + t0%clock_ticks_max
110 !!$ end if
112  real(clock_ticks, kind=f64)/real(t0%clock_ticks_per_sec, kind=f64)
113  end function sll_f_time_elapsed_since
114 
115 end module sll_m_timer
We can now use the functions.
Definition: sll_m_timer.F90:40
subroutine, public sll_s_set_time_mark(timer_obj)
reads time parameters from system and stores in its argument. param timer_obj an object of type sll_t...
Definition: sll_m_timer.F90:72
real(kind=f64) function, public sll_f_time_elapsed_since(t0)
Computes the time elapsed since a particular time mark was set.
integer, parameter itimer
Kind parameter defined here determines clock resolution (e.g. see 'system_clock' intrinsic subroutine...
Definition: sll_m_timer.F90:58
real(kind=f64) function, public sll_f_time_elapsed_between(t0, t1)
Computes the time elapsed between two time marks.
Definition: sll_m_timer.F90:83
type use for clock reading
Definition: sll_m_timer.F90:61
    Report Typos and Errors