]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce GetMemorySize(): float for the cache system for monitoring purpose
authorapo <apo@opencascade.com>
Mon, 27 Nov 2006 14:28:55 +0000 (14:28 +0000)
committerapo <apo@opencascade.com>
Mon, 27 Nov 2006 14:28:55 +0000 (14:28 +0000)
idl/VISU_Gen.idl
src/VISU_I/VISU_ColoredPrs3dCache_i.cc
src/VISU_I/VISU_ColoredPrs3dCache_i.hh

index d04202e88811f1f3e274407bf755656d5db81e98..1a9fde61f9ff8032acfa6ffec6113090a3774f67 100644 (file)
@@ -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);
index c93ac4b6de61d51b569c3daa8aad320bb71772f7..536523825cb4421c014abcf84f2dbc371b17b925 100644 (file)
@@ -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<unsigned int colored_prs3d_type_enum> 
 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: "<<aMemoryNeeded<<"; used: "<<aMemoryUsed<<"; limit: "<<aMemoryLimit<<endl;
       return aMemoryUsed + aMemoryNeeded < aMemoryLimit;
     }
index 1ba75dc5f5bda110b2abdd0d03b6c25bcc3137b5..ecb15ff64436041bcebf53849e197004af864b4d 100644 (file)
@@ -89,6 +89,10 @@ namespace VISU
     CORBA::Float
     GetLimitedMemory();
 
+    virtual
+    CORBA::Float
+    GetMemorySize();
+
     //----------------------------------------------------------------------------
     virtual 
     VISU::VISUType