Browse Source

Set Limit for Cache Clean Process

AGP
Evgeny Gagua 2 years ago
parent
commit
f15940d361
  1. 9
      lib/App/common/hardwareManager.cpp
  2. 2
      lib/App/common/hardwareManager.h

9
lib/App/common/hardwareManager.cpp

@ -64,6 +64,8 @@ hardwareManager::hardwareManager( bool cold_start ){
m_nServerNodeID = 0;
m_nServerID = 0;
m_nSiteID = 0;
m_bCacheCleanCounter = 3;
memset( &m_sSYS_INFO, 0, sizeof(DBC_SYS_INFO) );
strncpy( m_sSYS_INFO.SW_INFO, _BUILD_STRING_, 128 );
@ -371,7 +373,11 @@ bool hardwareManager::validate( void ){
if ( !RetVal ) {
LOG_ERROR("Memory Consumption too BIG!");
};
};
};
if ( m_bCacheCleanCounter == 0 ) {
LOG_ERROR("System Cache Fas Too Big Too Many Times!");
RetVal = false;
};
return RetVal;
};
@ -1424,6 +1430,7 @@ bool hardwareManager::updateSysInfo( DBC_SYS_LOAD_INFO *ptr ){
*/
system( "echo 3 > /proc/sys/vm/drop_caches" );
if( m_bCacheCleanCounter ) m_bCacheCleanCounter--;
};
} else {
LOG_ERROR("Error while getting System Info!");

2
lib/App/common/hardwareManager.h

@ -39,6 +39,8 @@ class hardwareManager{
PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name );
void clearAllResources( void );
uint8_t m_bCacheCleanCounter;
public:
virtual ~hardwareManager();
static hardwareManager * getInstance( bool cold_start = true );

Loading…
Cancel
Save