my_status_int Function

public function my_status_int(key, info, def) result(val)

Read out the first integer in the line matched by the specified key in the text provided by print_self_status. The key should include all text in front of the integer. For example the peak memory consumption up to now could be extracted with: peakval = my_status_int('VmPeak:') If the key is not found 0 or the optionally defined value in def will be returned.

info can be used to change the input that should be read, it defaults to '/proc/self/status'.

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: key
character(len=*), intent(in), optional :: info
integer, intent(in), optional :: def

Return Value integer


Calls

proc~~my_status_int~~CallsGraph proc~my_status_int my_status_int proc~my_status_string my_status_string proc~my_status_int->proc~my_status_string proc~print_self_status print_self_status proc~my_status_string->proc~print_self_status proc~newunit newunit proc~my_status_string->proc~newunit proc~print_self_status->proc~newunit

Called by

proc~~my_status_int~~CalledByGraph proc~my_status_int my_status_int proc~tem_global_vmhwm tem_global_vmhwm proc~tem_global_vmhwm->proc~my_status_int proc~tem_trackmem tem_trackmem proc~tem_trackmem->proc~my_status_int

Contents

Source Code


Source Code

  function my_status_int(key, info, def) result(val)
    ! ---------------------------------------------------------------------------
    character(len=*), intent(in) :: key !< Case sensitive!
    character(len=*), intent(in), optional :: info
    integer, intent(in), optional :: def !< Result for non-existing keys
    integer :: val
    ! ---------------------------------------------------------------------------
    character(len=labelLen) :: vstring
    ! ---------------------------------------------------------------------------

    val = 0
    if (present(def)) val = def

    vstring = my_status_string(key, info=info)

    if (scan(vstring, set='0123456789') > 0) then
      read(vstring,*) val
    end if

  end function my_status_int