-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
37 fortran interface null terminated strings #41
Changes from 4 commits
7309f9d
0bfbd47
469d08e
7b0825d
32d5d1e
a950d22
055261d
2198360
71115d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,38 +5,49 @@ | |
! under which the code may be used. | ||
!------------------------------------------------------------------------------- | ||
|
||
!> @file profiler_mod.F90 | ||
!> @brief Provides Fortran profiler bindings. | ||
|
||
module profiler_mod | ||
use, intrinsic :: iso_c_binding, only: c_char, c_long, c_double | ||
use, intrinsic :: iso_c_binding, only: c_char, c_long, c_double, c_null_char | ||
implicit none | ||
private | ||
|
||
!------------------------------------------------------------------------------ | ||
!----------------------------------------------------------------------------- | ||
! Public parameters | ||
!------------------------------------------------------------------------------ | ||
!----------------------------------------------------------------------------- | ||
|
||
!> The integer kind for region hashes. | ||
integer, public, parameter :: pik = c_long | ||
|
||
!> The real kind for region timings. | ||
integer, public, parameter :: prk = c_double | ||
bencopl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
!------------------------------------------------------------------------------ | ||
! Public interfaces | ||
!------------------------------------------------------------------------------ | ||
!----------------------------------------------------------------------------- | ||
! Public interfaces / subroutines | ||
!----------------------------------------------------------------------------- | ||
|
||
public :: profiler_start | ||
public :: profiler_stop | ||
public :: profiler_write | ||
public :: profiler_get_thread0_walltime | ||
|
||
!----------------------------------------------------------------------------- | ||
! Interfaces | ||
!----------------------------------------------------------------------------- | ||
|
||
interface | ||
|
||
subroutine profiler_start(hash_out, name) bind(C, name='c_profiler_start') | ||
import :: c_char, c_long | ||
character(kind=c_char, len=1), intent(in) :: name | ||
integer(kind=c_long), intent(out) :: hash_out | ||
end subroutine profiler_start | ||
subroutine interface_profiler_start(hash_out, region_name) & | ||
bind(C, name='c_profiler_start') | ||
import :: c_char, pik | ||
character(kind=c_char, len=1), intent(in) :: region_name | ||
bencopl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
integer(kind=pik), intent(out) :: hash_out | ||
end subroutine interface_profiler_start | ||
|
||
subroutine profiler_stop(hash_in) bind(C, name='c_profiler_stop') | ||
import :: c_long | ||
integer(kind=c_long), intent(in) :: hash_in | ||
import :: pik | ||
integer(kind=pik), intent(in) :: hash_in | ||
end subroutine profiler_stop | ||
|
||
subroutine profiler_write() bind(C, name='c_profiler_write') | ||
|
@@ -45,12 +56,36 @@ end subroutine profiler_write | |
|
||
function profiler_get_thread0_walltime(hash_in) result(walltime) & | ||
bind(C, name='c_get_thread0_walltime') | ||
import :: c_double, c_long | ||
integer(kind=c_long), intent(in) :: hash_in | ||
real(kind=c_double) :: walltime | ||
import :: pik, prk | ||
integer(kind=pik), intent(in) :: hash_in | ||
real(kind=prk) :: walltime | ||
end function profiler_get_thread0_walltime | ||
|
||
end interface | ||
|
||
!----------------------------------------------------------------------------- | ||
! Contained functions / subroutines | ||
!----------------------------------------------------------------------------- | ||
contains | ||
|
||
!> @brief Start a profiled region, taking care to add a C null character to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The @brief here should be for the user, describing that the subroutine is adding a null character doesn't seem right for the API documentation. A normal comment inside the subroutine would probably be better i think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll move it into a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me. |
||
!> the end of the region name. | ||
!> @param [out] hash_out The unique hash for this region. | ||
!> @param [in] region_name The region name. | ||
subroutine profiler_start(hash_out, region_name) | ||
implicit none | ||
|
||
!Arguments | ||
character(len=*), intent(in) :: region_name | ||
integer(kind=pik), intent(out) :: hash_out | ||
|
||
!Local variables | ||
character(len=len_trim(region_name)+1) :: local_region_name | ||
|
||
local_region_name = trim(region_name) // c_null_char | ||
call interface_profiler_start(hash_out, local_region_name) | ||
|
||
end subroutine profiler_start | ||
|
||
end module profiler_mod | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you're now defining the specific file extensions Doxygen no longer picks up the .md file used for the front page, adding *.md to this list should fix this though it will add the directory to the list of files shown in the Doxygen pages even if here isn't anything there.