From: prascle Date: Tue, 27 Sep 2005 07:47:53 +0000 (+0000) Subject: PR: automatic start of trace collector, different classes of trace. (todo: automatic... X-Git-Tag: V302_lcrm_20051002~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d2930cf6aea7d33e3cf5de1d445b1a8c0bd366d7;p=modules%2Fkernel.git PR: automatic start of trace collector, different classes of trace. (todo: automatic destruction of trace buffer pool and collector) --- diff --git a/bin/runSalome.py b/bin/runSalome.py index e8c4626c7..96070b5b3 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -133,7 +133,7 @@ def set_env(args, modules_list, modules_root_dir): os.environ["SALOME_trace"]="local" if args['file']: - os.environ["SALOME_trace"]=args['file'][0] + os.environ["SALOME_trace"]="file:"+args['file'][0] if args['logger']: os.environ["SALOME_trace"]="with_logger" locdir=os.environ['PWD'] diff --git a/src/Container/Makefile.in b/src/Container/Makefile.in index 9a355a682..e2a978733 100644 --- a/src/Container/Makefile.in +++ b/src/Container/Makefile.in @@ -63,10 +63,10 @@ BIN_SERVER_IDL = SALOME_Component.idl SALOME_ContainerManager.idl CPPFLAGS+= $(PYTHON_INCLUDES) $(MPI_INCLUDE) $(OCC_INCLUDES) $(QT_MT_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSALOMETraceCollector -lSalomeResourcesManager +LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace -lSalomeResourcesManager LIBS += @LDEXPDYNFLAGS@ $(PYTHON_LIBS) $(MPI_LIBS) -LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector +LDFLAGSFORBIN= $(LDFLAGS) LIBSFORBIN= $(LIBS) @CONCLUDE@ diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 8c8249158..840bb2a3a 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -69,7 +69,7 @@ int main(int argc, char* argv[]) ASSERT(SINGLETON_::IsAlreadyExisting()); CORBA::ORB_var orb = init(0 , 0 ) ; - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); INFOS_COMPILATION; BEGIN_OF(argv[0]); @@ -151,7 +151,7 @@ int main(int argc, char* argv[]) #endif END_OF(argv[0]); - delete myThreadTrace; + // delete myThreadTrace; return 0 ; } diff --git a/src/Container/SALOME_ContainerManagerServer.cxx b/src/Container/SALOME_ContainerManagerServer.cxx index 5968657a8..630c4a6d4 100644 --- a/src/Container/SALOME_ContainerManagerServer.cxx +++ b/src/Container/SALOME_ContainerManagerServer.cxx @@ -9,7 +9,7 @@ int main(int argc, char* argv[]) CORBA::Object_var obj; CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ; - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); INFOS_COMPILATION; BEGIN_OF(argv[0]); try{ @@ -40,6 +40,6 @@ int main(int argc, char* argv[]) MESSAGE("Caught unknown exception."); } END_OF(argv[0]); - delete myThreadTrace; + // delete myThreadTrace; } diff --git a/src/DataTypeCatalog/Makefile.in b/src/DataTypeCatalog/Makefile.in index ee33b9223..ba0ce38e7 100644 --- a/src/DataTypeCatalog/Makefile.in +++ b/src/DataTypeCatalog/Makefile.in @@ -54,6 +54,6 @@ BIN_SERVER_IDL = SALOME_DataTypeCatalog.idl SALOME_Exception.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= -LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector -LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector +LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace +LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx index 0f288ed9e..72712de82 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx @@ -38,7 +38,7 @@ int main(int argc,char **argv) { // initialize the ORB CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { CosNaming::NamingContext_var _rootContext, catalogContext; @@ -163,6 +163,6 @@ int main(int argc,char **argv) INFOS("Caught CORBA::Exception.") } - delete myThreadTrace; + // delete myThreadTrace; return 0; } diff --git a/src/LifeCycleCORBA/Makefile.in b/src/LifeCycleCORBA/Makefile.in index 786299949..942c31ba8 100644 --- a/src/LifeCycleCORBA/Makefile.in +++ b/src/LifeCycleCORBA/Makefile.in @@ -54,7 +54,7 @@ BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \ CPPFLAGS += $(PYTHON_INCLUDES) $(QT_MT_INCLUDES) LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager -LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMETraceCollector +LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification LIBS += $(PYTHON_LIBS) @CONCLUDE@ diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 46fa00409..ad1225bbf 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -73,7 +73,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) char *xargv = ""; char **argv = &xargv; CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); if (!ns) { _NS = new SALOME_NamingService(orb); diff --git a/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx b/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx index 1d097ece8..050cd194d 100644 --- a/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/TestLifeCycleCORBA.cxx @@ -53,7 +53,7 @@ int main (int argc, char * argv[]) { // Initializing omniORB CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); // Obtain a reference to the root POA CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") ; diff --git a/src/MPIContainer/Makefile.in b/src/MPIContainer/Makefile.in index af110328f..6aa39f7ce 100644 --- a/src/MPIContainer/Makefile.in +++ b/src/MPIContainer/Makefile.in @@ -59,7 +59,7 @@ ifeq (@WITHMPI@,yes) LIBS += $(PYTHON_LIBS) $(MPI_LIBS) CXXFLAGS+=${MPI_INCLUDES} CXX_DEPEND_FLAG+=${MPI_INCLUDES} - LDFLAGSFORBIN= $(LDFLAGS) -lSALOMETraceCollector + LDFLAGSFORBIN= $(LDFLAGS) LIBSFORBIN= $(LIBS) endif diff --git a/src/MPIContainer/SALOME_MPIContainer.cxx b/src/MPIContainer/SALOME_MPIContainer.cxx index 1d74a218b..bf2322190 100644 --- a/src/MPIContainer/SALOME_MPIContainer.cxx +++ b/src/MPIContainer/SALOME_MPIContainer.cxx @@ -19,7 +19,7 @@ int main(int argc, char* argv[]) // Initialise the ORB. ORB_INIT &init = *SINGLETON_::Instance() ; CORBA::ORB_var &orb = init( argc , argv ) ; - SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); BEGIN_OF("[" << numproc << "] " << argv[0]) try { @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) delete myContainer; END_OF("[" << numproc << "] " << argv[0]); - delete myThreadTrace; + // delete myThreadTrace; MPI_Finalize(); diff --git a/src/ModuleCatalog/Makefile.in b/src/ModuleCatalog/Makefile.in index 0fd517465..e14a10a3d 100644 --- a/src/ModuleCatalog/Makefile.in +++ b/src/ModuleCatalog/Makefile.in @@ -61,8 +61,8 @@ BIN_SRC = BIN_SERVER_IDL = SALOME_ModuleCatalog.idl SALOME_Exception.idl CPPFLAGS+= $(QT_MT_INCLUDES) -LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lSALOMELocalTrace -lSALOMETraceCollector -lOpUtil -LDFLAGSFORBIN+= -lSalomeNS -lSALOMELocalTrace -lSALOMETraceCollector -lOpUtil +LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lSALOMELocalTrace -lOpUtil +LDFLAGSFORBIN+= -lSalomeNS -lSALOMELocalTrace -lOpUtil @CONCLUDE@ diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index fe32cd71d..274de28a1 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -41,7 +41,7 @@ int main(int argc,char **argv) { // initialize the ORB CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { CosNaming::NamingContext_var _rootContext, catalogContext; @@ -174,6 +174,6 @@ int main(int argc,char **argv) INFOS("Caught CORBA::Exception.") } - delete myThreadTrace; + // delete myThreadTrace; return 0; } diff --git a/src/Registry/Makefile.in b/src/Registry/Makefile.in index 05c7defa5..d4a9b79fa 100644 --- a/src/Registry/Makefile.in +++ b/src/Registry/Makefile.in @@ -53,7 +53,7 @@ BIN = SALOME_Registry_Server BIN_SRC = BIN_SERVER_IDL = SALOME_Registry.idl -LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector +LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace LDFLAGSFORBIN= $(LDFLAGS) diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index 7105c5134..0131bb901 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -54,7 +54,7 @@ int main( int argc , char **argv ) { ORB_INIT &init = *SINGLETON_::Instance() ; CORBA::ORB_var &orb = init( argc , argv ) ; - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); BEGIN_OF( argv[0] ) INFOS_COMPILATION SCRUTE(argc) @@ -219,6 +219,6 @@ int main( int argc , char **argv ) } END_OF( argv[0] ) ; - delete myThreadTrace; + // delete myThreadTrace; return 0 ; } diff --git a/src/ResourcesManager/Makefile.in b/src/ResourcesManager/Makefile.in index 750e933a6..e3aca30fa 100755 --- a/src/ResourcesManager/Makefile.in +++ b/src/ResourcesManager/Makefile.in @@ -59,7 +59,7 @@ BIN_SERVER_IDL = SALOME_ContainerManager.idl CPPFLAGS+= $(QT_MT_INCLUDES) -I$(srcdir)/../Container CXXFLAGS+= -LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector +LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/RessourcesCatalog/Makefile.in b/src/RessourcesCatalog/Makefile.in index 0122db2a2..80fab1dd1 100644 --- a/src/RessourcesCatalog/Makefile.in +++ b/src/RessourcesCatalog/Makefile.in @@ -54,8 +54,8 @@ BIN_SERVER_IDL = SALOME_RessourcesCatalog.idl SALOME_Exception.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= -LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector -LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector +LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace +LDFLAGSFORBIN+= -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx index a9612ec6c..ea3be6a32 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx @@ -38,7 +38,7 @@ int main(int argc,char **argv) { // initialize the ORB CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { CosNaming::NamingContext_var _rootContext, catalogContext; @@ -157,6 +157,6 @@ int main(int argc,char **argv) INFOS("Caught CORBA::Exception.") } - delete myThreadTrace; + // delete myThreadTrace; return 0; } diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index 91e2e56b9..a280894ae 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -132,7 +132,7 @@ LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOME # LDXMUFLAGS= -L/usr/X11R6/lib -lXmu LDFLAGS+=$(LDXMUFLAGS) -LDFLAGSFORBIN= $(LDFLAGS) -lTKLCAF -lTKMath -lRegistry -lSalomeNotification -lSALOMETraceCollector -lSalomeContainer -lSalomeResourcesManager +LDFLAGSFORBIN= $(LDFLAGS) -lTKLCAF -lTKMath -lRegistry -lSalomeNotification -lSalomeContainer -lSalomeResourcesManager @CONCLUDE@ diff --git a/src/SALOMELocalTrace/BaseTraceCollector.cxx b/src/SALOMELocalTrace/BaseTraceCollector.cxx new file mode 100644 index 000000000..8c385bff8 --- /dev/null +++ b/src/SALOMELocalTrace/BaseTraceCollector.cxx @@ -0,0 +1,77 @@ +// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BaseTraceCollector.cxx +// Author : Paul RASCLE (EDF) +// Module : KERNEL +// $Header$ + +#include +#include +#include +#include + +using namespace std; + +#include "BaseTraceCollector.hxx" +#include "LocalTraceBufferPool.hxx" + +// Class attributes initialisation, for class method BaseTraceCollector::run + +BaseTraceCollector* BaseTraceCollector::_singleton = 0; +pthread_mutex_t BaseTraceCollector::_singletonMutex; +int BaseTraceCollector::_threadToClose = 0; +pthread_t* BaseTraceCollector::_threadId = 0; // used to control single run + +// ============================================================================ +/*! + * Destructor: wait until printing thread ends (BaseTraceCollector::run) + */ +// ============================================================================ + +BaseTraceCollector:: ~BaseTraceCollector() +{ + LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance(); + _threadToClose = 1; + cerr << "BaseTraceCollector:: ~BaseTraceCollector()" << endl << flush; + myTraceBuffer->insert(NORMAL_MESS,"end of trace"); //needed to wake up thread + if (_threadId) + { + int ret = pthread_join(*_threadId, NULL); + if (ret) cerr << "error close BaseTraceCollector : "<< ret << endl; + else cerr << "BaseTraceCollector destruction OK" << endl; + _threadId = 0; + } +} + +// ============================================================================ +/*! + * Constructor: no need of LocalTraceBufferPool object initialization here, + * thread safe singleton used in LocalTraceBufferPool::instance() + */ +// ============================================================================ + +BaseTraceCollector::BaseTraceCollector() +{ + _threadId=0; +} + + diff --git a/src/SALOMELocalTrace/BaseTraceCollector.hxx b/src/SALOMELocalTrace/BaseTraceCollector.hxx new file mode 100644 index 000000000..8f97e28c3 --- /dev/null +++ b/src/SALOMELocalTrace/BaseTraceCollector.hxx @@ -0,0 +1,64 @@ +// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BaseTraceCollector.hxx +// Author : Paul RASCLE (EDF) +// Module : KERNEL +// $Header$ + +#ifndef _BASETRACECOLLECTOR_HXX_ +#define _BASETRACECOLLECTOR_HXX_ + +#include + + +#if defined SALOMELOCALTRACE_EXPORTS +#if defined WIN32 +#define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) +#else +#define SALOMELOCALTRACE_EXPORT +#endif +#else +#if defined WNT +#define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) +#else +#define SALOMELOCALTRACE_EXPORT +#endif +#endif + +//! See derived Classes in SALOMELocalTrace for usage without CORBA, +//! see derived Classes in SALOMETraceCollector for usage with CORBA. + +class SALOMELOCALTRACE_EXPORT BaseTraceCollector +{ + public: + ~BaseTraceCollector(); + + protected: + BaseTraceCollector(); + + static int _threadToClose; + static BaseTraceCollector* _singleton; + static pthread_mutex_t _singletonMutex; + static pthread_t* _threadId; +}; + +#endif diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx new file mode 100644 index 000000000..8eb28861b --- /dev/null +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -0,0 +1,203 @@ +// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : FileTraceCollector.cxx +// Author : Paul RASCLE (EDF) +// Module : KERNEL +// $Header$ + +#include +#include +#include +#include + +using namespace std; + +#include "FileTraceCollector.hxx" + +// Class attributes initialisation, for class method FileTraceCollector::run + +std::string FileTraceCollector::_fileName = ""; + +// ============================================================================ +/*! + * This class is for use without CORBA, outside SALOME. + * SALOME uses SALOMETraceCollector, to allow trace collection via CORBA. + * + * guarantees a unique object instance of the class (singleton thread safe) + * a separate thread for loop to print traces is launched. + * \param typeTrace 0=standard out, 1=file(/tmp/tracetest.log) + * If typeTrace=0, checks environment for "SALOME_trace". Test values in + * the following order: + * - "local" standard out + * - anything else is kept as a file name + */ +// ============================================================================ + +BaseTraceCollector* FileTraceCollector::instance(const char *fileName) +{ + if (_singleton == 0) // no need of lock when singleton already exists + { + int ret; + ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone + if (_singleton == 0) // another thread may have got + { // the lock after the first test + _singleton = new FileTraceCollector(); + + _fileName = fileName; + cout << " _fileName: " << _fileName << endl; + + pthread_t traceThread; + int bid; + int re2 = pthread_create(&traceThread, NULL, + FileTraceCollector::run, (void *)bid); + } + ret = pthread_mutex_unlock(&_singletonMutex); // release lock + } + return _singleton; +} + +// ============================================================================ +/*! + * In a separate thread, loop to print traces. + * Mutex garantees intialisation on instance method is done and only one run + * allowed (double check ...) + * Loop until there is no more buffer to print, + * and no ask for end from destructor. + * Get a buffer. If type = ABORT then exit application with message. + */ +// ============================================================================ + +void* FileTraceCollector::run(void *bid) +{ + int isOKtoRun = 0; + int ret = pthread_mutex_lock(&_singletonMutex); // acquire lock to be alone + + if (! _threadId) // only one run + { + isOKtoRun = 1; + if(_threadId == 0) + { + _threadId = new pthread_t; + } + *_threadId = pthread_self(); + } + else cout << "----- Comment est-ce possible de passer la ? -------" <toCollect() ) + { + int fullBuf = myTraceBuffer->retrieve(myTrace); + if (myTrace.traceType == ABORT_MESS) + { +#ifndef WNT + traceFile << "INTERRUPTION from thread " << myTrace.threadId + << " : " << myTrace.trace; +#else + traceFile << "INTERRUPTION from thread " + << (void*)(&myTrace.threadId) + << " : " << myTrace.trace; +#endif + traceFile.close(); + cout << flush ; +#ifndef WNT + cerr << "INTERRUPTION from thread " << myTrace.threadId + << " : " << myTrace.trace; +#else + cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId) + << " : " << myTrace.trace; +#endif + cerr << flush ; + exit(1); + } + else + { +#ifndef WNT + traceFile << "th. " << myTrace.threadId + << " " << myTrace.trace; +#else + traceFile << "th. " << (void*)(&myTrace.threadId) + << " " << myTrace.trace; +#endif + } + } + traceFile.close(); + } + pthread_exit(NULL); + return NULL; +} + +// ============================================================================ +/*! + * Destructor: wait until printing thread ends (FileTraceCollector::run) + */ +// ============================================================================ + +FileTraceCollector:: ~FileTraceCollector() +{ + cerr << "FileTraceCollector:: ~FileTraceCollector()" << endl << flush; +} + +// ============================================================================ +/*! + * Constructor: no need of LocalTraceBufferPool object initialization here, + * thread safe singleton used in LocalTraceBufferPool::instance() + */ +// ============================================================================ + +FileTraceCollector::FileTraceCollector() +{ + _threadId=0; +} + + diff --git a/src/SALOMELocalTrace/FileTraceCollector.hxx b/src/SALOMELocalTrace/FileTraceCollector.hxx new file mode 100644 index 000000000..e25a3a182 --- /dev/null +++ b/src/SALOMELocalTrace/FileTraceCollector.hxx @@ -0,0 +1,50 @@ +// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : FileTraceCollector.hxx +// Author : Paul RASCLE (EDF) +// Module : KERNEL +// $Header$ + +#ifndef _FILETRACECOLLECTOR_HXX_ +#define _FILETRACECOLLECTOR_HXX_ + +#include +#include "LocalTraceBufferPool.hxx" +#include "BaseTraceCollector.hxx" + +//! See also other derived Classes in SALOMELocalTrace for usage without CORBA, +//! see also derived Classes in SALOMETraceCollector for usage with CORBA. + +class SALOMELOCALTRACE_EXPORT FileTraceCollector : public BaseTraceCollector +{ + public: + static BaseTraceCollector* instance(const char *fileName); + static void *run(void *bid); + ~FileTraceCollector(); + + protected: + FileTraceCollector(); + + static std::string _fileName; +}; + +#endif diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index 0f4962c34..8a136ceef 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -26,26 +26,65 @@ #include #include +#include + +#ifndef WNT +#include +#else +#endif #include "LocalTraceBufferPool.hxx" +#include "BaseTraceCollector.hxx" +#include "LocalTraceCollector.hxx" +#include "FileTraceCollector.hxx" +//#include "Utils_DESTRUCTEUR_GENERIQUE.hxx" #include "utilities.h" +//! specialisation template... + +// void DESTRUCTEUR_DE_::operator()(void) +// { +// if(_PtrObjet) +// { +// std::cerr << "deleting _PtrObjet LocalTraceBufferPool" << std::endl; +// LocalTraceBufferPool* aPtr = +// static_cast(_PtrObjet); +// delete aPtr; +// } +// _PtrObjet = NULL ; +// } + using namespace std; // In case of truncated message, end of trace contains "...\n\0" + #define TRUNCATED_MESSAGE "...\n" #define MAXMESS_LENGTH MAX_TRACE_LENGTH-5 +// Class static attributes initialisation + LocalTraceBufferPool* LocalTraceBufferPool::_singleton = 0; #ifndef WNT pthread_mutex_t LocalTraceBufferPool::_singletonMutex; #else -pthread_mutex_t LocalTraceBufferPool::_singletonMutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t LocalTraceBufferPool::_singletonMutex = + PTHREAD_MUTEX_INITIALIZER; #endif +BaseTraceCollector *LocalTraceBufferPool::_myThreadTrace = 0; // ============================================================================ /*! - * guarantees a unique object instance of the class (singleton thread safe) + * Guarantees a unique object instance of the class (singleton thread safe). + * When the LocalTraceBufferPool instance is created, the trace collector is + * also created (singleton). Type of trace collector to create depends on + * environment variable "SALOME_trace": + * - "local" implies standard err trace, LocalTraceCollector is launched. + * - "file" implies trace in /tmp/tracetest.log + * - "file:pathname" implies trace in file pathname + * - anything else like "other" : try to load dynamically a library named + * otherTraceCollector, and invoque C method instance() to start a singleton + * instance of the trace collector. Example: with_loggerTraceCollector, for + * CORBA Log. */ // ============================================================================ @@ -58,6 +97,63 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() if (_singleton == 0) // another thread may have got { // the lock after the first test _singleton = new LocalTraceBufferPool(); + +// DESTRUCTEUR_DE_ *ptrDestroy = +// new DESTRUCTEUR_DE_ (*_singleton); + + // --- start a trace Collector + + char* traceKind = getenv("SALOME_trace"); + assert(traceKind); + cout<<"SALOME_trace="< strlen("file")) + fileName = &traceKind[strlen("file")+1]; + else + fileName = "/tmp/tracetest.log"; + + _myThreadTrace = FileTraceCollector::instance(fileName); + } + else // --- try a dynamic library + { + void* handle; +#ifndef WNT + string impl_name = string ("lib") + traceKind + + string("TraceCollector.so"); + handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ; +#else + string impl_name = string ("lib") + traceKind + string(".dll"); + handle = dlopen( impl_name.c_str() , 0 ) ; +#endif + if ( handle ) + { + typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void); + FACTORY_FUNCTION TraceCollectorFactory = + (FACTORY_FUNCTION) dlsym(handle, "SingletonInstance"); + char *error ; + if ( (error = dlerror() ) != NULL) + { + cerr << "Can't resolve symbol: SingletonInstance" < #include +#include "BaseTraceCollector.hxx" #define ABORT_MESS 1 // for traceType field in struct LocalTrace_TraceInfo #define NORMAL_MESS 0 -#if defined SALOMELOCALTRACE_EXPORTS -#if defined WIN32 -#define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) -#else -#define SALOMELOCALTRACE_EXPORT -#endif -#else -#if defined WNT -#define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) -#else -#define SALOMELOCALTRACE_EXPORT -#endif -#endif - - - struct SALOMELOCALTRACE_EXPORT LocalTrace_TraceInfo { char trace[MAX_TRACE_LENGTH]; @@ -82,6 +67,7 @@ class SALOMELOCALTRACE_EXPORT LocalTraceBufferPool unsigned long _insertPos; unsigned long _retrievePos; pthread_t _threadId; + static BaseTraceCollector *_myThreadTrace; }; #endif diff --git a/src/SALOMELocalTrace/LocalTraceCollector.cxx b/src/SALOMELocalTrace/LocalTraceCollector.cxx index 5ff0874d3..f415e4924 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.cxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.cxx @@ -33,15 +33,6 @@ using namespace std; #include "LocalTraceCollector.hxx" -// Class attributes initialisation, for class method LocalTraceCollector::run - -LocalTraceCollector* LocalTraceCollector::_singleton = 0; -pthread_mutex_t LocalTraceCollector::_singletonMutex; -int LocalTraceCollector::_threadToClose = 0; -pthread_t* LocalTraceCollector::_threadId = 0; // used to control single run -int LocalTraceCollector::_toFile = 0; -std::string LocalTraceCollector::_fileName = ""; - // ============================================================================ /*! * This class is for use without CORBA, outside SALOME. @@ -57,7 +48,7 @@ std::string LocalTraceCollector::_fileName = ""; */ // ============================================================================ -LocalTraceCollector* LocalTraceCollector::instance(int typeTrace) +BaseTraceCollector* LocalTraceCollector::instance() { if (_singleton == 0) // no need of lock when singleton already exists { @@ -67,28 +58,6 @@ LocalTraceCollector* LocalTraceCollector::instance(int typeTrace) { // the lock after the first test _singleton = new LocalTraceCollector(); - _fileName = "/tmp/tracetest.log"; - _toFile=0; - - if (typeTrace) // caller sets a value different from default=0 - _toFile = typeTrace; - else // check environment - { - char* traceKind = getenv("SALOME_trace"); - //cout<<"SALOME_trace="<toCollect() ) { int fullBuf = myTraceBuffer->retrieve(myTrace); if (myTrace.traceType == ABORT_MESS) { - switch (_toFile) - { - case 1 : // --- trace to file + cout << flush ; #ifndef WNT - traceFile << "INTERRUPTION from thread " << myTrace.threadId - << " : " << myTrace.trace; + cerr << "INTERRUPTION from thread " << myTrace.threadId + << " : " << myTrace.trace; #else - traceFile << "INTERRUPTION from thread " << (void*)(&myTrace.threadId) - << " : " << myTrace.trace; + cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId) + << " : " << myTrace.trace; #endif - traceFile.close(); - // no break here ! - case 0 : // --- trace to standard output - default : // --- on standard output, too - cout << flush ; -#ifndef WNT - cerr << "INTERRUPTION from thread " << myTrace.threadId - << " : " << myTrace.trace; -#else - cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId) - << " : " << myTrace.trace; -#endif - cerr << flush ; - exit(1); - break; - } + cerr << flush ; + exit(1); } else { - switch (_toFile) - { - case 1 : // --- trace to file -#ifndef WNT - traceFile << "th. " << myTrace.threadId - << " " << myTrace.trace; -#else - traceFile << "th. " << (void*)(&myTrace.threadId) - << " " << myTrace.trace; -#endif - break; - case 0 : // --- trace to standard output - default : // --- on standard output, too + cout << flush ; #ifndef WNT - cout << "th. " << myTrace.threadId << " " << myTrace.trace; + cerr << "th. " << myTrace.threadId << " " << myTrace.trace; #else - cout << "th. " << (void*)(&myTrace.threadId) << " " << myTrace.trace; + cerr << "th. " << (void*)(&myTrace.threadId) + << " " << myTrace.trace; #endif - break; - } + cerr << flush ; } } - - if (_toFile==1) traceFile.close(); } pthread_exit(NULL); return NULL; @@ -234,16 +151,7 @@ void* LocalTraceCollector::run(void *bid) LocalTraceCollector:: ~LocalTraceCollector() { - LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance(); - _threadToClose = 1; - myTraceBuffer->insert(NORMAL_MESS,"end of trace "); //needed to wake up thread - if (_threadId) - { - int ret = pthread_join(*_threadId, NULL); - if (ret) cout << "error close LocalTraceCollector : "<< ret << endl; - else cout << "LocalTraceCollector destruction OK" << endl; - } - delete myTraceBuffer; + cerr << "LocalTraceCollector:: ~LocalTraceCollector()" << endl << flush; } // ============================================================================ diff --git a/src/SALOMELocalTrace/LocalTraceCollector.hxx b/src/SALOMELocalTrace/LocalTraceCollector.hxx index 5551b41fa..610e40f03 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.hxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.hxx @@ -29,25 +29,20 @@ #include #include "LocalTraceBufferPool.hxx" +#include "BaseTraceCollector.hxx" -//! See SALOMETraceCollector instead of LocalTraceCollector for SALOME usage +//! See also other derived Classes in SALOMELocalTrace for usage without CORBA, +//! see also derived Classes in SALOMETraceCollector for usage with CORBA. -class SALOMELOCALTRACE_EXPORT LocalTraceCollector +class SALOMELOCALTRACE_EXPORT LocalTraceCollector : public BaseTraceCollector { public: - static LocalTraceCollector* instance(int typeTrace=0); + static BaseTraceCollector* instance(); static void *run(void *bid); ~LocalTraceCollector(); protected: LocalTraceCollector(); - - static int _threadToClose; - static int _toFile; - static LocalTraceCollector* _singleton; - static pthread_mutex_t _singletonMutex; - static pthread_t* _threadId; - static std::string _fileName; }; #endif diff --git a/src/SALOMELocalTrace/Makefile.in b/src/SALOMELocalTrace/Makefile.in index 7894a23c0..57d5623cf 100644 --- a/src/SALOMELocalTrace/Makefile.in +++ b/src/SALOMELocalTrace/Makefile.in @@ -37,14 +37,16 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # header files EXPORT_HEADERS= utilities.h \ LocalTraceBufferPool.hxx \ - LocalTraceCollector.hxx + BaseTraceCollector.hxx EXPORT_PYSCRIPTS = # Libraries targets LIB = libSALOMELocalTrace.la -LIB_SRC = LocalTraceCollector.cxx \ +LIB_SRC = BaseTraceCollector.cxx \ + LocalTraceCollector.cxx \ + FileTraceCollector.cxx \ LocalTraceBufferPool.cxx LIBS= @LIBS@ diff --git a/src/SALOMETraceCollector/Makefile.in b/src/SALOMETraceCollector/Makefile.in index 3df7820fd..a05ab828c 100644 --- a/src/SALOMETraceCollector/Makefile.in +++ b/src/SALOMETraceCollector/Makefile.in @@ -42,11 +42,11 @@ EXPORT_PYSCRIPTS = # Libraries targets -LIB = libSALOMETraceCollector.la +LIB = libwith_loggerTraceCollector.la LIB_SRC = SALOMETraceCollector.cxx \ TraceCollector_WaitForServerReadiness.cxx LIB_CLIENT_IDL = Logger.idl -LDFLAGS+= +LDFLAGS+= -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.cxx b/src/SALOMETraceCollector/SALOMETraceCollector.cxx index 8a7eb8905..6c96bfd7e 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.cxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.cxx @@ -58,8 +58,7 @@ CORBA::ORB_ptr SALOMETraceCollector::_orb = 0; */ // ============================================================================ -LocalTraceCollector* SALOMETraceCollector::instance(CORBA::ORB_ptr theOrb, - int typeTrace) +BaseTraceCollector* SALOMETraceCollector::instance() { if (_singleton == 0) // no need of lock when singleton already exists { @@ -68,28 +67,10 @@ LocalTraceCollector* SALOMETraceCollector::instance(CORBA::ORB_ptr theOrb, if (_singleton == 0) // another thread may have got { // the lock after the first test _singleton = new SALOMETraceCollector(); - - _fileName = "/tmp/tracetest.log"; - _toFile=0; - _orb = theOrb; - if (typeTrace) // caller sets a value different from default=0 - _toFile = typeTrace; - else // check environment - { - char* traceKind = getenv("SALOME_trace"); - //cout<<"SALOME_trace="<putMessage(LogMsg); - //cout << " Logger server found" << endl; - } - break; - case 0 : ; // --- trace to standard output - default : // --- on standard output, too - break; + cerr << "Logger server not found ! Abort" << endl; + cerr << flush ; + exit(1); + } + else + { + CORBA::String_var LogMsg = + CORBA::string_dup("\n---Init logger trace---\n"); + m_pInterfaceLogger->putMessage(LogMsg); + cout << " Logger server found" << endl; } - // Loop until there is no more buffer to print, - // and no ask for end from destructor. + // --- Loop until there is no more buffer to print, + // and no ask for end from destructor. while ((!_threadToClose) || myTraceBuffer->toCollect() ) { int fullBuf = myTraceBuffer->retrieve(myTrace); if (myTrace.traceType == ABORT_MESS) { - switch (_toFile) - { - case 2 : // --- trace collection via CORBA - { - stringstream abortMessage(""); -#ifndef WNT - abortMessage << "INTERRUPTION from thread " - << myTrace.threadId << " : " << myTrace.trace; -#else - abortMessage << "INTERRUPTION from thread " - << (void*)&myTrace.threadId << " : " << myTrace.trace; -#endif - CORBA::String_var LogMsg = - CORBA::string_dup(abortMessage.str().c_str()); - m_pInterfaceLogger->putMessage(LogMsg); - exit(1); - } - break; - case 1 : // --- trace to file -#ifndef WNT - traceFile << "INTERRUPTION from thread " << myTrace.threadId -#else - traceFile << "INTERRUPTION from thread " << (void*)&myTrace.threadId -#endif - << " : " << myTrace.trace; - traceFile.close(); - // no break here ! - case 0 : // --- trace to standard output - default : // --- on standard output, too - cout << flush ; + stringstream abortMessage(""); #ifndef WNT - cerr << "INTERRUPTION from thread " << myTrace.threadId + abortMessage << "INTERRUPTION from thread " + << myTrace.threadId << " : " << myTrace.trace; #else - cerr << "INTERRUPTION from thread " << (void*)&myTrace.threadId + abortMessage << "INTERRUPTION from thread " + << (void*)&myTrace.threadId + << " : " << myTrace.trace; #endif - << " : " << myTrace.trace; - cerr << flush ; - exit(1); - break; - } + CORBA::String_var LogMsg = + CORBA::string_dup(abortMessage.str().c_str()); + m_pInterfaceLogger->putMessage(LogMsg); + exit(1); } else { - switch (_toFile) - { - case 2 : // --- trace collection via CORBA - { - stringstream aMessage(""); + stringstream aMessage(""); #ifndef WNT - aMessage << "th. " << myTrace.threadId + aMessage << "th. " << myTrace.threadId #else - aMessage << "th. " << (void*)&myTrace.threadId + aMessage << "th. " << (void*)&myTrace.threadId #endif - << " " << myTrace.trace; - CORBA::String_var LogMsg = - CORBA::string_dup(aMessage.str().c_str()); - m_pInterfaceLogger->putMessage(LogMsg); - } - break; - case 1 : // --- trace to file -#ifndef WNT - traceFile << "th. " << myTrace.threadId -#else - traceFile << "th. " << (void*)&myTrace.threadId -#endif - << " " << myTrace.trace; - break; - case 0 : // --- trace to standard output - default : // --- on standard output, too -#ifndef WNT - cout << "th. " << myTrace.threadId << " " << myTrace.trace; -#else - cout << "th. " << &myTrace.threadId << " " << myTrace.trace; -#endif - break; - } + << " " << myTrace.trace; + CORBA::String_var LogMsg = + CORBA::string_dup(aMessage.str().c_str()); + m_pInterfaceLogger->putMessage(LogMsg); } } - - if (_toFile==1) traceFile.close(); } pthread_exit(NULL); return NULL; @@ -283,16 +190,6 @@ void* SALOMETraceCollector::run(void *bid) SALOMETraceCollector:: ~SALOMETraceCollector() { - LocalTraceBufferPool* myTraceBuffer = LocalTraceBufferPool::instance(); - _threadToClose = 1; - myTraceBuffer->insert(NORMAL_MESS,"end of trace "); //needed to wake up thread - if (_threadId) - { - int ret = pthread_join(*_threadId, NULL); - if (ret) cout << "error close SALOMETraceCollector : "<< ret << endl; - else cout << "SALOMETraceCollector destruction OK" << endl; - } - delete myTraceBuffer; } // ============================================================================ @@ -307,4 +204,17 @@ SALOMETraceCollector::SALOMETraceCollector() _threadId=0; } +// ============================================================================ +/*! + * + */ +// ============================================================================ +extern "C" +{ + BaseTraceCollector *SingletonInstance(void) + { + BaseTraceCollector *instance = SALOMETraceCollector::instance(); + return instance; + } +} diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.hxx b/src/SALOMETraceCollector/SALOMETraceCollector.hxx index f439ac492..35139f6b6 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.hxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.hxx @@ -29,7 +29,7 @@ #include #include -#include "LocalTraceCollector.hxx" +#include "BaseTraceCollector.hxx" #include "LocalTraceBufferPool.hxx" //! See LocalTraceCollector instead of SALOMETraceCollector, @@ -49,10 +49,11 @@ #endif #endif -class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector: LocalTraceCollector +class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector: + public BaseTraceCollector { public: - static LocalTraceCollector* instance(CORBA::ORB_ptr theOrb, int typeTrace=0); + static BaseTraceCollector* instance(); static void *run(void *bid); ~SALOMETraceCollector(); diff --git a/src/TestContainer/Makefile.in b/src/TestContainer/Makefile.in index 39c69251b..e74d30692 100644 --- a/src/TestContainer/Makefile.in +++ b/src/TestContainer/Makefile.in @@ -46,7 +46,7 @@ BIN = TestContainer TestLogger BIN_SRC = LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSalomeResourcesManager -LDFLAGSFORBIN+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSALOMETraceCollector -lSalomeResourcesManager +LDFLAGSFORBIN+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace -lSalomeResourcesManager @CONCLUDE@ diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index fea1b4f21..de2de52a0 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -82,7 +82,7 @@ int main (int argc, char * argv[]) // Initializing omniORB ORB_INIT &init = *SINGLETON_::Instance() ; CORBA::ORB_var &orb = init( argc , argv ) ; - LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); try { @@ -194,7 +194,7 @@ int main (int argc, char * argv[]) INFOS("Caught unknown exception.") } - delete myThreadTrace; + // delete myThreadTrace; return 0; } diff --git a/src/TestMPIContainer/TestMPIContainer.cxx b/src/TestMPIContainer/TestMPIContainer.cxx index f17d5a630..6ee329eae 100644 --- a/src/TestMPIContainer/TestMPIContainer.cxx +++ b/src/TestMPIContainer/TestMPIContainer.cxx @@ -29,7 +29,7 @@ int main (int argc, char * argv[]) // Initializing omniORB ORB_INIT &init = *SINGLETON_::Instance() ; CORBA::ORB_var &orb = init( argc , argv ) ; - SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + // SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); BEGIN_OF(argv[0]) try{ @@ -133,6 +133,6 @@ int main (int argc, char * argv[]) } END_OF(argv[0]); - delete myThreadTrace; + // delete myThreadTrace; return 0 ; } diff --git a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.cxx b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.cxx index 3296da6d2..d9448bc82 100644 --- a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.cxx +++ b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.cxx @@ -50,13 +50,13 @@ std::list *DESTRUCTEUR_GENERIQUE_::Destructeurs=0 ; /*! \class ATEXIT_ * - * M‰canisme pour faire ex‰cuter une seule fois DESTRUCTEUR_GENERIQUE_::Nettoyage - * € la fin du traitement : creation d'un singleton statique de l'objet + * Mecanisme pour faire executer une seule fois DESTRUCTEUR_GENERIQUE_::Nettoyage + * a la fin du traitement : creation d'un singleton statique de l'objet * tres specialise ATEXIT_. * - * La cr‰ation d'un objet de type ATEXIT_ entraŽne l'inscription de la fonction - * Nettoyage() par atexit(). Il suffit donc de cr‰er un singleton statique du type ATEXIT_ - * pour effectuer cet enregistrement une seule fois ind‰pendament de l'utilisateur. + * La creation d'un objet de type ATEXIT_ entraine l'inscription de la fonction + * Nettoyage() par atexit(). Il suffit donc de creer un singleton statique du type ATEXIT_ + * pour effectuer cet enregistrement une seule fois independament de l'utilisateur. */ //CCRT @@ -67,10 +67,10 @@ class ATEXIT_ { public : /*! - * Allocation dynamique de Destructeurs, une liste chaŽn‰e de DESTRUCTEUR_GENERIQUE_* et enregistrement + * Allocation dynamique de Destructeurs, une liste chainee de DESTRUCTEUR_GENERIQUE_* et enregistrement * de la fonction Nettoyage() par atexit(). * - * La liste chaŽn‰e Destructeurs est d‰truite dans la fonction Nettoyage. + * La liste chainee Destructeurs est detruite dans la fonction Nettoyage. */ //CCRT ATEXIT_( void ) ATEXIT_( bool Make_ATEXIT ) @@ -81,9 +81,9 @@ public : ASSERT (DESTRUCTEUR_GENERIQUE_::Destructeurs==0); if(MYDEBUG) MESSAGE("Construction ATEXIT"); // message necessaire pour utiliser logger dans Nettoyage (cf.BUG KERNEL4561) DESTRUCTEUR_GENERIQUE_::Destructeurs = - new std::list ; // Destructeurs allou‰ dynamiquement (cf. ci-dessous) , - // il est utilis‰ puis d‰truit par la fonction Nettoyage - int cr = atexit( Nettoyage ); // ex‰cute Nettoyage lors de exit, aprˆs la destruction des donn‰es statiques ! + new std::list ; // Destructeur alloue dynamiquement (cf. ci-dessous) , + // il est utilise puis detruit par la fonction Nettoyage + int cr = atexit( Nettoyage ); // execute Nettoyage lors de exit, aprs la destruction des donnees statiques ! ASSERT(cr==0) ; ATEXIT_Done = true ; } @@ -102,10 +102,10 @@ static ATEXIT_ nettoyage = ATEXIT_( false ); /* singleton statique */ /*! - * traitement effectu‰ : - * -# ex‰cution de tous les objets de type DESTRUCTEUR_DE_ stock‰s dans la liste Destructeurs (ce qui d‰truit les + * traitement effectue : + * -# execution de tous les objets de type DESTRUCTEUR_DE_ stockes dans la liste Destructeurs (ce qui detruit les * singletons correspondant) ; - * -# puis destruction de tous les objets de type DESTRUCTEUR_DE_ stock‰s dans la liste Destructeurs; + * -# puis destruction de tous les objets de type DESTRUCTEUR_DE_ stockes dans la liste Destructeurs; * -# destruction de la liste Destructeurs. */