| 1 |
! (C) Copyright 2013 ECMWF. |
| 2 |
! |
| 3 |
! This software is licensed under the terms of the Apache Licence Version 2.0 |
| 4 |
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 5 |
! In applying this licence, ECMWF does not waive the privileges and immunities |
| 6 |
! granted to it by virtue of its status as an intergovernmental organisation nor |
| 7 |
! does it submit to any jurisdiction. |
| 8 |
|
| 9 |
#include "atlas/atlas_f.h" |
| 10 |
|
| 11 |
module atlas_Trace_module |
| 12 |
|
| 13 |
use fckit_shared_object_module, only : fckit_shared_object |
| 14 |
|
| 15 |
implicit none |
| 16 |
|
| 17 |
private :: fckit_shared_object |
| 18 |
|
| 19 |
public :: atlas_Trace |
| 20 |
|
| 21 |
|
| 22 |
private |
| 23 |
|
| 24 |
!----------------------------- |
| 25 |
! atlas_Trace ! |
| 26 |
!----------------------------- |
| 27 |
|
| 28 |
type, extends(fckit_shared_object) :: atlas_Trace |
| 29 |
contains |
| 30 |
! Public methods |
| 31 |
|
| 32 |
procedure, public :: running |
| 33 |
procedure, public :: start |
| 34 |
procedure, public :: stop |
| 35 |
procedure, public :: pause |
| 36 |
procedure, public :: resume |
| 37 |
procedure, public :: elapsed |
| 38 |
|
| 39 |
#if FCKIT_FINAL_NOT_INHERITING |
| 40 |
final :: atlas_Trace__final_auto |
| 41 |
#endif |
| 42 |
end type |
| 43 |
|
| 44 |
interface atlas_Trace |
| 45 |
module procedure atlas_Trace__loc |
| 46 |
module procedure atlas_Trace__labels_1 |
| 47 |
module procedure atlas_Trace__labels_2 |
| 48 |
module procedure atlas_Trace__labels_3 |
| 49 |
module procedure atlas_Trace__labels_4 |
| 50 |
module procedure atlas_Trace__labels_5 |
| 51 |
end interface |
| 52 |
|
| 53 |
!======================================================== |
| 54 |
contains |
| 55 |
!======================================================== |
| 56 |
|
| 57 |
function atlas_Trace__loc(file,line,title) result(this) |
| 58 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 59 |
use atlas_Trace_c_binding |
| 60 |
use fckit_c_interop_module |
| 61 |
type(atlas_Trace) :: this |
| 62 |
character(len=*) , intent(in) :: file |
| 63 |
integer , intent(in) :: line |
| 64 |
character(len=*) , intent(in) :: title |
| 65 |
call this%reset_c_ptr( new_atlas_Trace( c_str(file), line, c_str(title) ), fckit_c_deleter(delete_atlas_Trace) ) |
| 66 |
call this%return() |
| 67 |
end function |
| 68 |
|
| 69 |
function atlas_Trace__labels_1(file,line,title,label) result(this) |
| 70 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 71 |
use atlas_Trace_c_binding |
| 72 |
use fckit_c_interop_module |
| 73 |
type(atlas_Trace) :: this |
| 74 |
character(len=*) , intent(in) :: file |
| 75 |
integer , intent(in) :: line |
| 76 |
character(len=*) , intent(in) :: title |
| 77 |
character(len=*) , intent(in) :: label |
| 78 |
call this%reset_c_ptr( new_atlas_Trace_labels_1( c_str(file), line, c_str(title), c_str(label) ), & |
| 79 |
& fckit_c_deleter(delete_atlas_Trace) ) |
| 80 |
call this%return() |
| 81 |
end function |
| 82 |
function atlas_Trace__labels_2(file,line,title,label1,label2) result(this) |
| 83 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 84 |
use atlas_Trace_c_binding |
| 85 |
use fckit_c_interop_module |
| 86 |
type(atlas_Trace) :: this |
| 87 |
character(len=*) , intent(in) :: file |
| 88 |
integer , intent(in) :: line |
| 89 |
character(len=*) , intent(in) :: title |
| 90 |
character(len=*) , intent(in) :: label1 |
| 91 |
character(len=*) , intent(in) :: label2 |
| 92 |
call this%reset_c_ptr( new_atlas_Trace_labels_2( c_str(file), line, c_str(title), c_str(label1), c_str(label2) ), & |
| 93 |
& fckit_c_deleter(delete_atlas_Trace) ) |
| 94 |
call this%return() |
| 95 |
end function |
| 96 |
function atlas_Trace__labels_3(file,line,title,label1,label2,label3) result(this) |
| 97 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 98 |
use atlas_Trace_c_binding |
| 99 |
use fckit_c_interop_module |
| 100 |
type(atlas_Trace) :: this |
| 101 |
character(len=*) , intent(in) :: file |
| 102 |
integer , intent(in) :: line |
| 103 |
character(len=*) , intent(in) :: title |
| 104 |
character(len=*) , intent(in) :: label1 |
| 105 |
character(len=*) , intent(in) :: label2 |
| 106 |
character(len=*) , intent(in) :: label3 |
| 107 |
call this%reset_c_ptr( new_atlas_Trace_labels_3( c_str(file), line, c_str(title), c_str(label1), c_str(label2), & |
| 108 |
& c_str(label3) ), fckit_c_deleter(delete_atlas_Trace) ) |
| 109 |
call this%return() |
| 110 |
end function |
| 111 |
function atlas_Trace__labels_4(file,line,title,label1,label2,label3,label4) result(this) |
| 112 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 113 |
use atlas_Trace_c_binding |
| 114 |
use fckit_c_interop_module |
| 115 |
type(atlas_Trace) :: this |
| 116 |
character(len=*) , intent(in) :: file |
| 117 |
integer , intent(in) :: line |
| 118 |
character(len=*) , intent(in) :: title |
| 119 |
character(len=*) , intent(in) :: label1 |
| 120 |
character(len=*) , intent(in) :: label2 |
| 121 |
character(len=*) , intent(in) :: label3 |
| 122 |
character(len=*) , intent(in) :: label4 |
| 123 |
call this%reset_c_ptr( new_atlas_Trace_labels_4( c_str(file), line, c_str(title), c_str(label1), c_str(label2), & |
| 124 |
& c_str(label3), c_str(label4) ), fckit_c_deleter(delete_atlas_Trace) ) |
| 125 |
call this%return() |
| 126 |
end function |
| 127 |
function atlas_Trace__labels_5(file,line,title,label1,label2,label3,label4,label5) result(this) |
| 128 |
use, intrinsic :: iso_c_binding, only : c_ptr |
| 129 |
use atlas_Trace_c_binding |
| 130 |
use fckit_c_interop_module |
| 131 |
type(atlas_Trace) :: this |
| 132 |
character(len=*) , intent(in) :: file |
| 133 |
integer , intent(in) :: line |
| 134 |
character(len=*) , intent(in) :: title |
| 135 |
character(len=*) , intent(in) :: label1 |
| 136 |
character(len=*) , intent(in) :: label2 |
| 137 |
character(len=*) , intent(in) :: label3 |
| 138 |
character(len=*) , intent(in) :: label4 |
| 139 |
character(len=*) , intent(in) :: label5 |
| 140 |
call this%reset_c_ptr( new_atlas_Trace_labels_5( c_str(file), line, c_str(title), c_str(label1), c_str(label2), & |
| 141 |
& c_str(label3), c_str(label4), c_str(label5) ), fckit_c_deleter(delete_atlas_Trace) ) |
| 142 |
call this%return() |
| 143 |
end function |
| 144 |
!------------------------------------------------------------------------------- |
| 145 |
|
| 146 |
function running( this ) |
| 147 |
use atlas_Trace_c_binding |
| 148 |
logical :: running |
| 149 |
class(atlas_Trace) :: this |
| 150 |
if( atlas_Trace__running( this%CPTR_PGIBUG_B ) == 0 ) then |
| 151 |
running = .False. |
| 152 |
else |
| 153 |
running = .True. |
| 154 |
endif |
| 155 |
end function |
| 156 |
|
| 157 |
!------------------------------------------------------------------------------- |
| 158 |
|
| 159 |
function elapsed( this ) |
| 160 |
use, intrinsic :: iso_c_binding, only : c_double |
| 161 |
use atlas_Trace_c_binding |
| 162 |
real(c_double) :: elapsed |
| 163 |
class(atlas_Trace) :: this |
| 164 |
elapsed = atlas_Trace__elapsed( this%CPTR_PGIBUG_B ) |
| 165 |
end function |
| 166 |
|
| 167 |
!------------------------------------------------------------------------------- |
| 168 |
|
| 169 |
subroutine start( this ) |
| 170 |
use atlas_Trace_c_binding |
| 171 |
class(atlas_Trace) :: this |
| 172 |
call atlas_Trace__start( this%CPTR_PGIBUG_B ) |
| 173 |
end subroutine |
| 174 |
|
| 175 |
!------------------------------------------------------------------------------- |
| 176 |
|
| 177 |
subroutine stop( this ) |
| 178 |
use atlas_Trace_c_binding |
| 179 |
class(atlas_Trace) :: this |
| 180 |
call atlas_Trace__stop( this%CPTR_PGIBUG_B ) |
| 181 |
end subroutine |
| 182 |
|
| 183 |
!------------------------------------------------------------------------------- |
| 184 |
|
| 185 |
subroutine pause( this ) |
| 186 |
use atlas_Trace_c_binding |
| 187 |
class(atlas_Trace) :: this |
| 188 |
call atlas_Trace__pause( this%CPTR_PGIBUG_B ) |
| 189 |
end subroutine |
| 190 |
|
| 191 |
!------------------------------------------------------------------------------- |
| 192 |
|
| 193 |
subroutine resume( this ) |
| 194 |
use atlas_Trace_c_binding |
| 195 |
class(atlas_Trace) :: this |
| 196 |
call atlas_Trace__resume( this%CPTR_PGIBUG_B ) |
| 197 |
end subroutine |
| 198 |
|
| 199 |
!------------------------------------------------------------------------------- |
| 200 |
|
| 201 |
#if FCKIT_FINAL_NOT_INHERITING |
| 202 |
ATLAS_FINAL subroutine atlas_Trace__final_auto(this) |
| 203 |
type(atlas_Trace), intent(inout) :: this |
| 204 |
#if FCKIT_FINAL_DEBUGGING |
| 205 |
write(0,*) "atlas_Trace__final_auto" |
| 206 |
#endif |
| 207 |
#if FCKIT_FINAL_NOT_PROPAGATING |
| 208 |
call this%final() |
| 209 |
#endif |
| 210 |
FCKIT_SUPPRESS_UNUSED( this ) |
| 211 |
end subroutine |
| 212 |
#endif |
| 213 |
|
| 214 |
end module atlas_Trace_module |
| 215 |
|