WAVEWATCH III  beta 0.0.1
mallocinfo_m Module Reference

Data Types

interface  mallinfo
 
type  mallinfo_t
 This structure type is used to return information about the dynamic memory allocator. More...
 

Functions/Subroutines

subroutine getmallocinfo (malinfo)
 
subroutine printmallinfo (ihdnl, malinfo)
 
integer(8) function getvmsize ()
 
integer(8) function getvmrss ()
 

Function/Subroutine Documentation

◆ getmallocinfo()

subroutine mallocinfo_m::getmallocinfo ( type(mallinfo_t), intent(out)  malinfo)

Definition at line 107 of file w3meminfo.F90.

107  !/
108  !/ +-----------------------------------+
109  !/ | WAVEWATCH III NOAA/NCEP |
110  !/ | |
111  !/ | Aron Roland (BGS IT&E GmbH) |
112  !/ | THomas Huxhorn (BGS IT&E GmbH |
113  !/ | |
114  !/ | FORTRAN 90 |
115  !/ | Last update : 01-June-2018 |
116  !/ +-----------------------------------+
117  !/
118  !/ 01-June-2018 : Origination. ( version 6.04 )
119  !/
120  ! 1. Purpose : Init pdlib part
121  ! 2. Method :
122  ! 3. Parameters :
123  !
124  ! Parameter list
125  ! ----------------------------------------------------------------
126  ! ----------------------------------------------------------------
127  !
128  ! 4. Subroutines used :
129  !
130  ! Name Type Module Description
131  ! ----------------------------------------------------------------
132  ! STRACE Subr. W3SERVMD Subroutine tracing.
133  ! ----------------------------------------------------------------
134  !
135  ! 5. Called by :
136  !
137  ! Name Type Module Description
138  ! ----------------------------------------------------------------
139  ! ----------------------------------------------------------------
140  !
141  ! 6. Error messages :
142  ! 7. Remarks
143  ! 8. Structure :
144  ! 9. Switches :
145  !
146  ! !/S Enable subroutine tracing.
147  !
148  ! 10. Source code :
149  !
150  !/ ------------------------------------------------------------------- /
151 #ifdef W3_S
152  USE w3servmd, ONLY: strace
153 #endif
154  !
155  implicit none
156  !/
157  !/ ------------------------------------------------------------------- /
158  !/ Parameter list
159  !/
160  !/ ------------------------------------------------------------------- /
161  !/ Local PARAMETERs
162  !/
163 #ifdef W3_S
164  INTEGER, SAVE :: IENT = 0
165 #endif
166  !/
167  !/ ------------------------------------------------------------------- /
168  !/
169 #ifdef W3_S
170  CALL strace (ient, 'W3XXXX')
171 #endif
172  type(MallInfo_t), intent(out) :: malinfo
173  malinfo = mallinfo()

References w3servmd::strace().

Referenced by w3servmd::print_memcheck().

◆ getvmrss()

integer(8) function mallocinfo_m::getvmrss

Definition at line 361 of file w3meminfo.F90.

361  !/
362  !/ +-----------------------------------+
363  !/ | WAVEWATCH III NOAA/NCEP |
364  !/ | |
365  !/ | Aron Roland (BGS IT&E GmbH) |
366  !/ | Mathieu Dutour-Sikiric (IRB) |
367  !/ | |
368  !/ | FORTRAN 90 |
369  !/ | Last update : 01-June-2018 |
370  !/ +-----------------------------------+
371  !/
372  !/ 01-June-2018 : Origination. ( version 6.04 )
373  !/
374  ! 1. Purpose : Init pdlib part
375  ! 2. Method :
376  ! 3. Parameters :
377  !
378  ! Parameter list
379  ! ----------------------------------------------------------------
380  ! ----------------------------------------------------------------
381  !
382  ! 4. Subroutines used :
383  !
384  ! Name Type Module Description
385  ! ----------------------------------------------------------------
386  ! STRACE Subr. W3SERVMD Subroutine tracing.
387  ! ----------------------------------------------------------------
388  !
389  ! 5. Called by :
390  !
391  ! Name Type Module Description
392  ! ----------------------------------------------------------------
393  ! ----------------------------------------------------------------
394  !
395  ! 6. Error messages :
396  ! 7. Remarks
397  ! 8. Structure :
398  ! 9. Switches :
399  !
400  ! !/S Enable subroutine tracing.
401  !
402  ! 10. Source code :
403  !
404  !/ ------------------------------------------------------------------- /
405 #ifdef W3_S
406  USE w3servmd, ONLY: strace
407 #endif
408  !
409  !/
410  !/ ------------------------------------------------------------------- /
411  !/ Parameter list
412  !/
413  !/ ------------------------------------------------------------------- /
414  !/ Local PARAMETERs
415  !/
416 #ifdef W3_S
417  INTEGER, SAVE :: IENT = 0
418 #endif
419  !/
420  !/ ------------------------------------------------------------------- /
421  !/
422 #ifdef W3_S
423  CALL strace (ient, 'W3XXXX')
424 #endif
425  integer(8) :: vmRSS
426  character(len=80) :: stat_key, stat_value
427  !
428  vmrss = 0
429  open(unit=1000, file="/proc/self/status", status='old', err=99)
430  do while (.true.)
431  read(unit=1000, fmt=*, err=88) stat_key, stat_value
432  if (stat_key == 'VmRSS:') then
433  read(stat_value, *) vmrss
434  exit
435  end if
436  end do
437 88 close(unit=1000)
438  if (vmrss == 0) goto 99
439  return
440  !
441 99 print *, 'ERROR: procfs not mounted or not compatible'
442  vmrss = -1

References file(), and w3servmd::strace().

Referenced by printmallinfo().

◆ getvmsize()

integer(8) function mallocinfo_m::getvmsize

Definition at line 276 of file w3meminfo.F90.

276  !/
277  !/ +-----------------------------------+
278  !/ | WAVEWATCH III NOAA/NCEP |
279  !/ | |
280  !/ | Aron Roland (BGS IT&E GmbH) |
281  !/ | Mathieu Dutour-Sikiric (IRB) |
282  !/ | |
283  !/ | FORTRAN 90 |
284  !/ | Last update : 01-June-2018 |
285  !/ +-----------------------------------+
286  !/
287  !/ 01-June-2018 : Origination. ( version 6.04 )
288  !/
289  ! 1. Purpose : Init pdlib part
290  ! 2. Method :
291  ! 3. Parameters :
292  !
293  ! Parameter list
294  ! ----------------------------------------------------------------
295  ! ----------------------------------------------------------------
296  !
297  ! 4. Subroutines used :
298  !
299  ! Name Type Module Description
300  ! ----------------------------------------------------------------
301  ! STRACE Subr. W3SERVMD Subroutine tracing.
302  ! ----------------------------------------------------------------
303  !
304  ! 5. Called by :
305  !
306  ! Name Type Module Description
307  ! ----------------------------------------------------------------
308  ! ----------------------------------------------------------------
309  !
310  ! 6. Error messages :
311  ! 7. Remarks
312  ! 8. Structure :
313  ! 9. Switches :
314  !
315  ! !/S Enable subroutine tracing.
316  !
317  ! 10. Source code :
318  !
319  !/ ------------------------------------------------------------------- /
320 #ifdef W3_S
321  USE w3servmd, ONLY: strace
322 #endif
323  !
324  !/
325  !/ ------------------------------------------------------------------- /
326  !/ Parameter list
327  !/
328  !/ ------------------------------------------------------------------- /
329  !/ Local PARAMETERs
330  !/
331 #ifdef W3_S
332  INTEGER, SAVE :: IENT = 0
333 #endif
334  !/
335  !/ ------------------------------------------------------------------- /
336  !/
337 #ifdef W3_S
338  CALL strace (ient, 'W3XXXX')
339 #endif
340  integer(8) :: vmsize
341  character(len=80) :: stat_key, stat_value
342  !
343  vmsize = 0
344  open(unit=1000, file="/proc/self/status", status='old', err=99)
345  do while (.true.)
346  read(unit=1000, fmt=*, err=88) stat_key, stat_value
347  if (stat_key == 'VmSize:') then
348  read(stat_value, *) vmsize
349  exit
350  end if
351  end do
352 88 close(unit=1000)
353  if (vmsize == 0) goto 99
354  return
355  !
356 99 print *, 'ERROR: procfs not mounted or not compatible'
357  vmsize = -1

References file(), and w3servmd::strace().

Referenced by printmallinfo().

◆ printmallinfo()

subroutine mallocinfo_m::printmallinfo ( integer, intent(in)  ihdnl,
type(mallinfo_t), intent(in)  malinfo 
)

Definition at line 177 of file w3meminfo.F90.

177  !/
178  !/ +-----------------------------------+
179  !/ | WAVEWATCH III NOAA/NCEP |
180  !/ | |
181  !/ | Aron Roland (BGS IT&E GmbH) |
182  !/ | Mathieu Dutour-Sikiric (IRB) |
183  !/ | |
184  !/ | FORTRAN 90 |
185  !/ | Last update : 01-June-2018 |
186  !/ +-----------------------------------+
187  !/
188  !/ 01-June-2018 : Origination. ( version 6.04 )
189  !/
190  ! 1. Purpose : Init pdlib part
191  ! 2. Method :
192  ! 3. Parameters :
193  !
194  ! Parameter list
195  ! ----------------------------------------------------------------
196  ! ----------------------------------------------------------------
197  !
198  ! 4. Subroutines used :
199  !
200  ! Name Type Module Description
201  ! ----------------------------------------------------------------
202  ! STRACE Subr. W3SERVMD Subroutine tracing.
203  ! ----------------------------------------------------------------
204  !
205  ! 5. Called by :
206  !
207  ! Name Type Module Description
208  ! ----------------------------------------------------------------
209  ! ----------------------------------------------------------------
210  !
211  ! 6. Error messages :
212  ! 7. Remarks
213  ! 8. Structure :
214  ! 9. Switches :
215  !
216  ! !/S Enable subroutine tracing.
217  !
218  ! 10. Source code :
219  !
220  !/ ------------------------------------------------------------------- /
221 #ifdef W3_S
222  USE w3servmd, ONLY: strace
223 #endif
224  !
225  !/
226  !/ ------------------------------------------------------------------- /
227  !/ Parameter list
228  !/
229  !/ ------------------------------------------------------------------- /
230  !/ Local PARAMETERs
231  !/
232 #ifdef W3_S
233  INTEGER, SAVE :: IENT = 0
234 #endif
235  !/
236  !/ ------------------------------------------------------------------- /
237  !/
238 #ifdef W3_S
239  CALL strace (ient, 'W3XXXX')
240 #endif
241  real :: ib2m
242  integer(8) :: vmsize, vmRSS
243  integer, intent(in) :: ihdnl
244  type(MallInfo_t), intent(in) :: malinfo
245 
246 
247  if (ihdnl .lt. 1) stop 'ihndl not set'
248  ib2m=1./real(1024**2)
249  vmsize = getvmsize()
250  vmrss = getvmrss()
251  !write(*,'(A72,2F20.10)') "Total size of memory allocated with sbrk by malloc in mbyte. ", malinfo%arena*ib2m
252  !write(*,'(A72,2F20.10)') "Total size of memory allocated with mmap, in mbytes. ", malinfo%hblkhd*ib2m
253  !write(*,'(A72,2F20.10)') "Total size of memory occupied by chunks handed out by malloc.", malinfo%uordblks*ib2m
254  !write(*,'(A72,I10)') "Total number of chunks allocated with mmap. ", malinfo%hblks
255  !write(*,'(A72,I10)') "Number of chunks not in use. ", malinfo%ordblks
256  !write(*,'(A72,2F20.10)') "Total size of memory occupied by free (not in use) chunks. ", malinfo%fordblks*ib2m
257  !write(*,'(A72,2F20.10)') "Size of the top-most releasable chunk borders end of the heap", malinfo%keepcost*ib2m
258  write(ihdnl,'(A72,2F20.10)') "VM size in proc ", vmsize/1024.
259  write(ihdnl,'(A72,2F20.10)') "RSS size in prof ", vmrss/1024.
260  call flush(ihdnl)

References getvmrss(), getvmsize(), and w3servmd::strace().

Referenced by w3servmd::print_memcheck().

w3servmd
Definition: w3servmd.F90:3
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3servmd::strace
subroutine strace(IENT, SNAME)
Definition: w3servmd.F90:148