Reads 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'.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | key(:) | |||
| character(len=*), | intent(in), | optional | :: | info | ||
| integer, | intent(in), | optional | :: | def(:) |
function my_status_int_vec(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(size(key)) ! --------------------------------------------------------------------------- character(len=labelLen) :: vstring(size(key)) integer :: i,n ! --------------------------------------------------------------------------- val = 0 if (present(def)) val = def n = size(key) vstring = my_status_string_vec(key, info=info) do i=1,n if (scan(vstring(i), set='0123456789') > 0) then read(vstring(i),*) val(i) end if end do end function my_status_int_vec