From ae75a95451e7f9706acc16c33ead0590089b5150 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Thu, 2 Jan 2025 20:26:16 +0200 Subject: [PATCH] jaiea --- Projects/la_mojo/build | 6 +++--- Projects/watchDogDaemon/kernel.cpp | 1 + Projects/watchDogDaemon/kernel.h | 2 +- lib/App/common/hardwareManager.cpp | 24 +++++++++++++++++++++--- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Projects/la_mojo/build b/Projects/la_mojo/build index e30c9046..0d3905e9 100755 --- a/Projects/la_mojo/build +++ b/Projects/la_mojo/build @@ -1,11 +1,11 @@ #! /bin/sh -#make clean -e "CFG=Debug" -#make -e "CFG=Debug" -j6 +make clean -e "CFG=Debug" +make -e "CFG=Debug" -j6 #make clean -e "CFG=Debug86" -make -e "CFG=Debug86" -j4 +#make -e "CFG=Debug86" -j4 #make clean -e "CFG=Release86" #make -e "CFG=Release86" -j4 diff --git a/Projects/watchDogDaemon/kernel.cpp b/Projects/watchDogDaemon/kernel.cpp index b209a5ce..16d4328b 100644 --- a/Projects/watchDogDaemon/kernel.cpp +++ b/Projects/watchDogDaemon/kernel.cpp @@ -351,6 +351,7 @@ void SP_KERNEL::m_fThreadProc( void ){ shutdown( ClientSocket, 2 ); close( ClientSocket ); } else { + LOG("New Handler Created"); m_vWPV.push_back( tPRC ); }; } else { diff --git a/Projects/watchDogDaemon/kernel.h b/Projects/watchDogDaemon/kernel.h index 0f22a4d3..075f58f2 100644 --- a/Projects/watchDogDaemon/kernel.h +++ b/Projects/watchDogDaemon/kernel.h @@ -7,7 +7,7 @@ class SP_KERNEL; -#define SW_DEFAULT_TIMEOUT 60000 // 60 seconds +#define SW_DEFAULT_TIMEOUT 180000 // 180 seconds #define SW_TIMEOUT_PERCISION 100 // 0.1 second #define INVALID_SOCKET -1 diff --git a/lib/App/common/hardwareManager.cpp b/lib/App/common/hardwareManager.cpp index c1423d75..5a21ccfc 100644 --- a/lib/App/common/hardwareManager.cpp +++ b/lib/App/common/hardwareManager.cpp @@ -361,7 +361,7 @@ bool hardwareManager::validate( void ){ //Mem Validator if( m_nMemoryLimitHeapSize ) { size_t memStat = getCurrentRSS(); -#ifdef DEBUG +#ifdef DEBUG_EXTRA char MEM_MSG[128]; sprintf( MEM_MSG, "MEM: %" PRIu64 " TARG: %" PRIu64, memStat, m_nMemoryLimitHeapSize ); LOG( MEM_MSG ); @@ -1401,12 +1401,30 @@ bool hardwareManager::updateSysInfo( DBC_SYS_LOAD_INFO *ptr ){ ptr->cpu1 = SI.loads[0] * f_load; ptr->cpu5 = SI.loads[1] * f_load; ptr->cpu15 = SI.loads[2] * f_load; - ptr->T_MEM = SI.totalram; - ptr->C_MEM = SI.totalram - SI.freeram; + ptr->T_MEM = SI.totalram * SI.mem_unit; + ptr->C_MEM = ( SI.totalram - SI.freeram ) * SI.mem_unit; ptr->mem = 100.0f * (float)ptr->C_MEM / (float)ptr->T_MEM; +#ifdef DEBUG_EXTRA char tB[128]; sprintf( tB, "Total Mem: %" PRIu64 " Free: %" PRIu64 " Perc: %.2f", SI.totalram, SI.freeram, ptr->mem ); LOG( tB ); +#endif + if ( ptr->mem > 80.0f ) { + LOG_ERROR( "Try to free some caches!" ); + /* + + To free pagecache: + # echo 1 > /proc/sys/vm/drop_caches + + To free dentries and inodes: + # echo 2 > /proc/sys/vm/drop_caches + + To free pagecache, dentries and inodes: + # echo 3 > /proc/sys/vm/drop_caches + + */ + system( "echo 3 > /proc/sys/vm/drop_caches" ); + }; } else { LOG_ERROR("Error while getting System Info!"); };