[WIP][RAM monitoring] vtksys check RAM usage #1171
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
From the previous PR on branch med3.2: #1043
This PR is a draft one.
This is a Work In Progress about RAM monitoring
Testing medInria3.2.x and MUSICardio3 i saw some recurrent problem: some toolboxes/processes use so much RAM that a 16Go RAM computer is not enough.
This is a major problem because it happens a lot, and users have no clue about what just happened.
I talked about that to @Florent2305 and we did some researches about solutions. It appears that @paulineMig worked also on this subject because she had the same crashes in the application.
Recap of the researches
SIGKILLwhich is impossible to reach from inside the application to avoid a crash or to display an error message before crashing.Idea of the monitoring of RAM
With vtksys we can do for instance:
vtksys::SystemInformation sys_info; sys_info.RunOSCheck(); sys_info.RunCPUCheck(); sys_info.RunMemoryCheck(); std::cout<<"### GetVendorString "<<sys_info.GetVendorString()<<std::endl; std::cout<<"### GetVendorID "<<sys_info.GetVendorID()<<std::endl; std::cout<<"### GetProcessorCacheSize "<<sys_info.GetProcessorCacheSize()<<std::endl; std::cout<<"### GetLogicalProcessorsPerPhysical "<<sys_info.GetLogicalProcessorsPerPhysical()<<std::endl; // std::cout<<"### GetHostname "<<sys_info.GetHostname()<<std::endl; std::cout<<"### GetOSDescription "<<sys_info.GetOSDescription()<<std::endl; std::cout<<"### GetCPUDescription "<<sys_info.GetCPUDescription()<<std::endl; std::cout<<"### GetOSPlatform "<<sys_info.GetOSPlatform()<<std::endl; std::cout<<"### Is64Bits "<<sys_info.Is64Bits()<<std::endl; // Retrieve memory information in MiB. std::cout<<"### GetTotalVirtualMemory "<<sys_info.GetTotalVirtualMemory()<<std::endl; std::cout<<"### GetAvailableVirtualMemory "<<sys_info.GetAvailableVirtualMemory()<<std::endl; std::cout<<"### GetTotalPhysicalMemory "<<sys_info.GetTotalPhysicalMemory()<<std::endl; std::cout<<"### GetAvailablePhysicalMemory "<<sys_info.GetAvailablePhysicalMemory()<<std::endl; // Retrieve amount of physical memory installed on the system in KiB units. std::cout<<"### GetHostMemoryTotal "<<sys_info.GetHostMemoryTotal()<<std::endl; // Get total system RAM in units of KiB available colectivley to all // processes in a process group. An example of a process group // are the processes comprising an mpi program which is running in // parallel. The amount of memory reported may differ from the host // total if a host wide resource limit is applied. Such reource limits // are reported to us via an application specified environment variable. std::cout<<"### GetHostMemoryAvailable "<<sys_info.GetHostMemoryAvailable()<<std::endl; // Get total system RAM in units of KiB available to this process. // This may differ from the host available if a per-process resource // limit is applied. per-process memory limits are applied on unix // system via rlimit API. Resource limits that are not imposed via // rlimit API may be reported to us via an application specified // environment variable. std::cout<<"### GetProcMemoryAvailable "<<sys_info.GetProcMemoryAvailable()<<std::endl; // Get the system RAM used by all processes on the host, in units of KiB. std::cout<<"### GetHostMemoryUsed "<<sys_info.GetHostMemoryUsed()<<std::endl; // Get system RAM used by this process id in units of KiB. std::cout<<"### GetProcMemoryUsed "<<sys_info.GetProcMemoryUsed()<<std::endl; // Return the load average of the machine or -0.0 if it cannot be determined. std::cout<<"### GetLoadAverage "<<sys_info.GetLoadAverage()<<std::endl;with
and get these results:
I developed a prototype of a memory monitoring of
medRunnableProcess/medJobItemLprocesses. It works well, but for now there are 2 problems:We can discuss about this topic here.