module fd4_globaldef_mod
module fd4_mpi_mod
Types:
public type fd4_stat
Variables:
integer, private, parameter :: FD4_STATNAME_LEN = 20
integer, private, parameter :: FD4_STAT_INITIAL_SIZE = 29
integer, public, parameter :: FD4_STAT_STDOUT = 6
Subroutines and functions:
public subroutine fd4_stat_add (stat, name, idx, opt_dump_only_if_set)
public subroutine fd4_stat_reset (stat)
public subroutine fd4_stat_free (stat)
public subroutine fd4_stat_countup (stat, idx, value)
public subroutine fd4_stat_dump (stat, mpi, opt_root, opt_out)
User interface: Use fd4_domain_dump_stats to dump the current values to stdout.
Use fd4_stat_add to create a new statistics. All ranks must call this function in the same order, so that the index returned by fd4_stat_add is equal in all ranks.
To set a value, just access it directly:
type(fd4_stat) :: stat call fd4_stat_add(stat, 'Bytes transferred', bytes_idx) stat%values(bytes_idx) = size_bytes
Author: Matthias Lieber
See also: module fd4_domain_mod
public type fd4_stat
integer (kind=i8k), pointer, dimension (:) :: values => null ()
character (len=FD4_STATNAME_LEN), pointer, dimension (:) :: names => null ()
logical, pointer, dimension (:) :: dumpifset => null ()
integer (kind=i_k) :: nstat = 0
integer (kind=i_k), dimension (2) :: sfcbnd = (/ HUGE (0_i_k), -1 /)
end type fd4_stat
Components:| values | values of the statistics |
| names | names of the statistics |
| dumpifset | dump the counter only when sum>0? |
| sfcbnd | min and max SFC index of all partitions |
public subroutine fd4_stat_add (stat, name, idx, opt_dump_only_if_set)
type (fd4_stat), intent(inout) :: stat
character (len=*), intent(in) :: name
integer (kind=i_k), intent(out) :: idx
logical, optional, intent(in) :: opt_dump_only_if_set
end subroutine fd4_stat_add
Parameters:| stat | the statistics object |
| name | name of the new statistic |
| idx | added index |
| opt_dump_only_if_set | dump the counter only when sum>0 |
The index idx in the arrays values and names of the fd4_stat is returned. If the name already exists, the corresponding index is returned.
Returns negative idx on error.
public subroutine fd4_stat_reset (stat)
type (fd4_stat), intent(inout) :: stat
end subroutine fd4_stat_reset
Reset all values to zero.
public subroutine fd4_stat_free (stat)
type (fd4_stat), intent(inout) :: stat
end subroutine fd4_stat_free
Free memory of an fd4_stat.
public subroutine fd4_stat_countup (stat, idx, value)
type (fd4_stat), intent(inout) :: stat
integer (kind=i_k), intent(in) :: idx
integer (kind=i8k), intent(in) :: value
end subroutine fd4_stat_countup
Parameters:| stat | the statistics object |
| idx | index of the statistic |
| value | value to add |
public subroutine fd4_stat_dump (stat, mpi, opt_root, opt_out)
type (fd4_stat), intent(in) :: stat
type (fd4_mpi), intent(inout) :: mpi
integer, optional, intent(in) :: opt_root
integer, optional, intent(in) :: opt_out
end subroutine fd4_stat_dump
Parameters:| stat | the statistics object |
| mpi | MPI context |
| opt_root | root MPI process that prints statistics |
| opt_out | unit for output (use FD4_STAT_STDOUT for stdout) |