From 9c9ab061e52b3d4b0172cf4d9938b33340a3182a Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 27 Nov 2006 14:28:55 +0000 Subject: [PATCH] To introduce GetMemorySize(): float for the cache system for monitoring purpose --- idl/VISU_Gen.idl | 5 ++++ src/VISU_I/VISU_ColoredPrs3dCache_i.cc | 39 ++++++++++++++++---------- src/VISU_I/VISU_ColoredPrs3dCache_i.hh | 4 +++ 3 files changed, 33 insertions(+), 15 deletions(-) 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: "<