From: apo Date: Mon, 27 Nov 2006 14:28:55 +0000 (+0000) Subject: To introduce GetMemorySize(): float for the cache system for monitoring purpose X-Git-Tag: WP1_2_3_05-12-2006_cache_system~47 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9c9ab061e52b3d4b0172cf4d9938b33340a3182a;p=modules%2Fvisu.git To introduce GetMemorySize(): float for the cache system for monitoring purpose --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index d04202e8..1a9fde61 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -650,6 +650,11 @@ module VISU { /*! Gets a memory size for limited mode (Mb). */ float GetLimitedMemory(); + /*! + * Gets an expended memory size for the cache system (Mb). + */ + float GetMemorySize(); + /*! Creates %ColoredPrs3dHolder.*/ ColoredPrs3dHolder CreateHolder(in VISUType theType, in ColoredPrs3dHolder::BasicInput theInput); diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index c93ac4b6..53652382 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -93,6 +93,27 @@ VISU::ColoredPrs3dCache_i } +//---------------------------------------------------------------------------- +CORBA::Float +VISU::ColoredPrs3dCache_i +::GetMemorySize() +{ + CORBA::Float aMemoryUsed = 0.0; + TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin(); + TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end(); + for(; aHolderIter != aHolderIterEnd; aHolderIter++){ + const TLastVisitedPrsList& aPrsList = aHolderIter->second; + TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin(); + TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end(); + for(; aPrsIter != aPrsIterEnd; aPrsIter++){ + if(VISU::ColoredPrs3d_i* aPrs3d = *aPrsIter) + aMemoryUsed += aPrs3d->GetMemorySize(); + } + } + return aMemoryUsed; +} + + //---------------------------------------------------------------------------- template size_t @@ -157,21 +178,9 @@ VISU::ColoredPrs3dCache_i } if(aMemory > 0){ if(GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED){ - float aMemoryUsed = 0; - TColoredPrs3dHolderMap::const_iterator aHolderIter = myHolderMap.begin(); - TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = myHolderMap.end(); - for(; aHolderIter != aHolderIterEnd; aHolderIter++){ - const TLastVisitedPrsList& aPrsList = aHolderIter->second; - TLastVisitedPrsList::const_iterator aPrsIter = aPrsList.begin(); - TLastVisitedPrsList::const_iterator aPrsIterEnd = aPrsList.end(); - for(; aPrsIter != aPrsIterEnd; aPrsIter++){ - if(VISU::ColoredPrs3d_i* aPrs3d = *aPrsIter) - aMemoryUsed += aPrs3d->GetMemorySize(); - } - } - float aMemoryNeeded = (float)(aMemory / (1024.0 * 1024.0)); // convert to Mb - float aMemoryLimit = GetLimitedMemory(); - + CORBA::Float aMemoryUsed = GetMemorySize(); + CORBA::Float aMemoryLimit = GetLimitedMemory(); + CORBA::Float aMemoryNeeded = CORBA::Float(aMemory/(1024.0*1024.0)); // convert to Mb //cout<<"Memory needed: "<