mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-31 23:47:49 +05:00
CCAR: add TIMING macros and optimizations in SOCC_Viewer, GEOMDisplayer, GEOMClient
This commit is contained in:
parent
4e75f03828
commit
fda5de2068
@ -60,6 +60,14 @@ using namespace std;
|
||||
|
||||
#define HST_CLIENT_LEN 256
|
||||
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@ -120,6 +128,17 @@ GEOM_Client::GEOM_Client(Engines::Container_ptr client)
|
||||
//=======================================================================
|
||||
Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S )
|
||||
{
|
||||
//CCAR
|
||||
#if 1
|
||||
if(_myIndexes.count(IOR)==0)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
Standard_Integer i =_myIndexes[IOR];
|
||||
S = myShapes.Value(i);
|
||||
return i;
|
||||
}
|
||||
#else
|
||||
for ( Standard_Integer i = 1; i<= myIORs.Length(); i++ ) {
|
||||
if (myIORs.Value(i).IsEqual(IOR)) {
|
||||
S = myShapes.Value(i);
|
||||
@ -127,6 +146,7 @@ Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_S
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -152,6 +172,7 @@ void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape&
|
||||
{
|
||||
myIORs.Append(IOR);
|
||||
myShapes.Append(S);
|
||||
_myIndexes[IOR]=_myIndexes.size()+1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -168,6 +189,7 @@ void GEOM_Client::RemoveShapeFromBuffer( const TCollection_AsciiString& IOR)
|
||||
if( anIndex != 0 ) {
|
||||
myIORs.Remove(anIndex) ;
|
||||
myShapes.Remove(anIndex) ;
|
||||
_myIndexes.erase(IOR);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
@ -183,6 +205,7 @@ void GEOM_Client::ClearClientBuffer()
|
||||
return ;
|
||||
myIORs.Clear() ;
|
||||
myShapes.Clear() ;
|
||||
_myIndexes.clear();
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -202,6 +225,7 @@ unsigned int GEOM_Client::BufferLength()
|
||||
//=======================================================================
|
||||
TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape )
|
||||
{
|
||||
START_TIMING
|
||||
TopoDS_Shape S;
|
||||
TCollection_AsciiString IOR = geom->GetStringFromIOR(aShape);
|
||||
Standard_Integer anIndex = Find(IOR, S);
|
||||
@ -212,6 +236,7 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p
|
||||
if (aShape->IsMainShape()) {
|
||||
S = Load(geom, aShape);
|
||||
Bind(IOR, S);
|
||||
END_TIMING(200)
|
||||
return S;
|
||||
}
|
||||
|
||||
@ -241,5 +266,6 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p
|
||||
S = aCompound;
|
||||
}
|
||||
Bind(IOR, S);
|
||||
END_TIMING(200)
|
||||
return S;
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ class TopoDS_Shape;
|
||||
#define GEOMCLIENT_EXPORT
|
||||
#endif
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <map>
|
||||
//=====================================================================
|
||||
// GEOM_Client : class definition
|
||||
//=====================================================================
|
||||
@ -116,6 +118,7 @@ private:
|
||||
//
|
||||
TColStd_SequenceOfAsciiString myIORs ;
|
||||
TopTools_SequenceOfShape myShapes ;
|
||||
std::map< TCollection_AsciiString , int > _myIndexes;
|
||||
long pid_client;
|
||||
};
|
||||
|
||||
|
@ -97,6 +97,18 @@
|
||||
|
||||
#include "GEOMImpl_Types.hxx"
|
||||
|
||||
#include "OCCViewer_ViewModel.h"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
//================================================================
|
||||
@ -305,11 +317,13 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
|
||||
const bool updateViewer,
|
||||
SALOME_View* theViewFrame )
|
||||
{
|
||||
//START_TIMING
|
||||
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
|
||||
if ( vf )
|
||||
{
|
||||
SALOME_Prs* prs = buildPresentation( theIO->getEntry(), vf );
|
||||
|
||||
//END_TIMING(1)
|
||||
if ( prs )
|
||||
{
|
||||
vf->BeforeDisplay( this );
|
||||
@ -785,6 +799,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
||||
//=================================================================
|
||||
void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
{
|
||||
START_TIMING
|
||||
SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
|
||||
if ( !vtkPrs || myShape.IsNull() )
|
||||
return;
|
||||
@ -880,6 +895,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
aProp->Delete();
|
||||
|
||||
theActors->Delete();
|
||||
END_TIMING(50)
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
@ -954,7 +970,12 @@ SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
|
||||
|
||||
if ( myViewFrame )
|
||||
{
|
||||
//CCAR
|
||||
#if 1
|
||||
prs = LightApp_Displayer::buildPresentation( QString(), theViewFrame );
|
||||
#else
|
||||
prs = LightApp_Displayer::buildPresentation( entry, theViewFrame );
|
||||
#endif
|
||||
if ( prs )
|
||||
{
|
||||
Handle( SALOME_InteractiveObject ) theIO = new SALOME_InteractiveObject();
|
||||
|
@ -73,6 +73,15 @@
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
|
||||
#include <vtkRenderer.h>
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -124,6 +133,7 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
|
||||
{}
|
||||
virtual void Execute()
|
||||
{
|
||||
START_TIMING
|
||||
SUIT_Application* app = SUIT_Session::session()->activeApplication();
|
||||
if (!app) return;
|
||||
|
||||
@ -216,6 +226,7 @@ void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
|
||||
}
|
||||
}
|
||||
}
|
||||
END_TIMING(200)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -39,6 +39,15 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
@ -65,6 +74,7 @@ GEOMImpl_CylinderDriver::GEOMImpl_CylinderDriver()
|
||||
//=======================================================================
|
||||
Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
|
||||
{
|
||||
START_TIMING
|
||||
if (Label().IsNull()) return 0;
|
||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||
|
||||
@ -120,6 +130,7 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
|
||||
aFunction->SetValue(aShape);
|
||||
|
||||
log.SetTouched(Label());
|
||||
END_TIMING(200)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -63,6 +63,15 @@
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
@ -251,6 +260,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
|
||||
Handle(GEOM_Object) theVec,
|
||||
double theR, double theH)
|
||||
{
|
||||
START_TIMING
|
||||
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (thePnt.IsNull() || theVec.IsNull()) return NULL;
|
||||
@ -299,6 +310,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
|
||||
<< thePnt << ", " << theVec << ", " << theR << ", " << theH << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
END_TIMING(200)
|
||||
return aCylinder;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,15 @@
|
||||
#include <OSD.hxx>
|
||||
|
||||
#include "SALOMEDS_Tool.hxx"
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
//============================================================================
|
||||
// function : GEOM_Gen_i()
|
||||
@ -527,6 +536,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy,
|
||||
const char* theName,
|
||||
GEOM::GEOM_Object_ptr theFather)
|
||||
{
|
||||
START_TIMING
|
||||
SALOMEDS::SObject_var aResultSO;
|
||||
if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
|
||||
|
||||
@ -558,6 +568,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(aResultSO);
|
||||
aStudyBuilder->Addreference(aSubSO, aSO);
|
||||
}
|
||||
END_TIMING(200)
|
||||
|
||||
return aResultSO._retn();
|
||||
}
|
||||
|
@ -27,6 +27,15 @@
|
||||
|
||||
#include "GEOM_Engine.hxx"
|
||||
#include "GEOM_Object.hxx"
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
@ -111,6 +120,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
|
||||
CORBA::Double theH)
|
||||
{
|
||||
START_TIMING
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
@ -121,6 +131,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
END_TIMING(200)
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
@ -134,6 +145,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
|
||||
CORBA::Double theR, CORBA::Double theH)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
//START_TIMING
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
@ -153,6 +165,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
//END_TIMING(200)
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,15 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
#include <sys/time.h>
|
||||
static long tt0;
|
||||
static long tcount=0;
|
||||
static long cumul;
|
||||
#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000;
|
||||
#define END_TIMING(NUMBER) \
|
||||
tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \
|
||||
if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; }
|
||||
|
||||
|
||||
using namespace std;
|
||||
// SALOME
|
||||
@ -254,7 +263,9 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap
|
||||
|
||||
for (ex.Init(myShape, TopAbs_FACE); ex.More(); ex.Next()) {
|
||||
|
||||
START_TIMING
|
||||
GEOM_Actor* FaceActor = GEOM_Actor::New();
|
||||
END_TIMING(450)
|
||||
FaceActor->SetShadingProperty(FaceProp);
|
||||
FaceActor->SetWireframeProperty(IsoProp);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user