save_memory_status Subroutine

public subroutine save_memory_status(file_name, tag)

Save the current CPU-memory status into a file. File is accessed in append position.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file_name

File name.

character(len=*), intent(in), optional :: tag

Tag of current status.


Calls

proc~~save_memory_status~~CallsGraph proc~save_memory_status save_memory_status proc~get_memory_info get_memory_info proc~save_memory_status->proc~get_memory_info interface~cton cton proc~get_memory_info->interface~cton proc~ctoi_i1p ctoi_I1P interface~cton->proc~ctoi_i1p proc~ctoi_i2p ctoi_I2P interface~cton->proc~ctoi_i2p proc~ctoi_i4p ctoi_I4P interface~cton->proc~ctoi_i4p proc~ctoi_i8p ctoi_I8P interface~cton->proc~ctoi_i8p proc~ctor_r4p ctor_R4P interface~cton->proc~ctor_r4p proc~ctor_r8p ctor_R8P interface~cton->proc~ctor_r8p

Source Code

   subroutine save_memory_status(file_name, tag)
   !< Save the current CPU-memory status into a file.
   !< File is accessed in append position.
   character(*), intent(in)           :: file_name           !< File name.
   character(*), intent(in), optional :: tag                 !< Tag of current status.
   character(:), allocatable          :: tag_                !< Tag of current status, local var.
   integer(I8P)                       :: mem_free, mem_total !< Process memory.
   integer(I4P)                       :: file_unit           !< File unit.

   tag_ = '' ; if (present(tag)) tag_ = trim(tag)
   call get_memory_info(mem_free, mem_total)
   open(newunit=file_unit, file=trim(file_name), position="append")
   write(file_unit,*) tag_, mem_free, mem_total
   close(file_unit)
   endsubroutine save_memory_status