tem_trackmem_module Module

Module to track various relevant memory information during runtime.

The values tracked are inspired by the suggestions on the QT documentation.

Where it says:

The purpose of the Main Memory Test is to decide how often to run the Memory Monitor. The test involves reading certain values from /proc/meminfo and summing them to estimate the amount of main memory available. The values used are MemFree, Buffers, and Cached. When the sum of these values drops below a certain percentage of the main memory in the device (MemTotal), the timer that governs how often the Memory Monitor should run is reset with a short timeout interval so the Memory Monitor runs more often. Otherwise, the timer is reset with a long timeout interval so the Memory Monitor runs less often.

Note that the sum of the values of MemFree, Buffers, and Cached is not the amount of virtual memory that is actually available, i.e. it cannot be used to determine the memory state. In practice, the amount of memory available is much greater than this sum, because many of the memory pages consumed by a process are from code space, and a code space page can become free as soon as program execution leaves the page.

The page fault test involves monitoring the number of major page faults that occur in each timeout interval (long or short), normalizing them, and averaging them over a specified number of timeout intervals (test cycle). A major page fault is one that cannot be satisfied by a page already loaded in main memory. It requires loading the requested page from secondary memory. We expect that an abnormally high average number of major page faults per test cycle implies that too many pages of main memory are occupied by data pages of too many processes. These processes are competing for the few remaining code space pages available, and page thrashing is the result. Since Linux processes cannot be forced to relinquish data pages they no longer need, an abnormally high average number of major page faults per test cycle is a reliable sign that the system is running low on memory.

The page fault test is run in three steps. Step one computes the number of major page faults that occurred during the last timeout interval. The data for this computation is read from the per process virtual memory status files in /proc. The number of page faults is then stored in a circular list that represents the last n timeout intervals, i.e. one test cycle. Step two computes the average number of page faults over all the entries in the test cycle.


  • module~~tem_trackmem_module~~UsesGraph module~tem_trackmem_module tem_trackmem_module module~tem_aux_module tem_aux_module module~tem_trackmem_module->module~tem_aux_module module~env_module env_module module~tem_trackmem_module->module~env_module module~tem_logging_module tem_logging_module module~tem_trackmem_module->module~tem_logging_module module~aotus_module aotus_module module~tem_trackmem_module->module~aotus_module mpi mpi module~tem_trackmem_module->mpi module~tem_aux_module->module~env_module module~tem_aux_module->module~tem_logging_module module~tem_aux_module->module~aotus_module module~tem_aux_module->mpi module~tem_revision_module tem_revision_module module~tem_aux_module->module~tem_revision_module module~tem_comm_env_module tem_comm_env_module module~tem_aux_module->module~tem_comm_env_module module~flu_binding flu_binding module~tem_aux_module->module~flu_binding module~aot_table_module aot_table_module module~tem_aux_module->module~aot_table_module module~tem_tools_module tem_tools_module module~tem_aux_module->module~tem_tools_module module~tem_lua_requires_module tem_lua_requires_module module~tem_aux_module->module~tem_lua_requires_module module~env_module->module~aotus_module module~env_module->mpi module~env_module->module~flu_binding iso_fortran_env iso_fortran_env module~env_module->iso_fortran_env module~tem_logging_module->module~env_module module~tem_logging_module->module~aotus_module module~tem_logging_module->module~aot_table_module module~tem_comm_env_module->mpi module~tem_tools_module->module~env_module module~tem_lua_requires_module->module~env_module module~tem_lua_requires_module->module~aotus_module module~tem_lua_requires_module->module~flu_binding module~tem_lua_requires_module->module~aot_table_module iso_c_binding iso_c_binding module~tem_lua_requires_module->iso_c_binding



public subroutine tem_trackmem(memfile, iteration)

Write the current memory status into the memfile.

Read more…


character(len=*), intent(in) :: memfile
integer, intent(in) :: iteration

public subroutine tem_trackmem_load(me, conf)

Get a trackmem_file setting from the config script.


character(len=*), intent(out) :: me

The trackmem file

type(flu_state) :: conf

Handle to the Lua script containing the configuration.