Salome HOME
[EDF29138] : measure CPU/Mem even in OutOfProcess mode
[modules/kernel.git] / src / Container / SALOME_ComponentPy.py
index 635f7e87e4d9e671133ff416404dcebaa2d51097..f7e01ae9d4ed729745d9fd842c353d1edecceac4 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -255,7 +255,7 @@ class SALOME_ComponentPy_Gen_i (Engines__POA.EngineComponent):
     def CpuUsed_impl(self):
         if ( self._ThreadId | self._Executed ) :
             if self._ThreadId == get_ident() :
-                cpu = time.clock()
+                cpu = time.process_time()
                 self._ThreadCpuUsed = cpu - self._StartUsed
                 MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) )
                 return self._ThreadCpuUsed
@@ -302,7 +302,7 @@ class SALOME_ComponentPy_i(SALOME_ComponentPy_Gen_i):
             self._naming_service = SALOME_NamingServicePy_i(self._orb)
         else:
             self._naming_service = SALOME_Embedded_NamingService_ClientPy(emb_ns)
-        Component_path = self._containerName + "/" + self._instanceName
+        Component_path = contID.name + "/" + self._instanceName#self._containerName
         MESSAGE(  'SALOME_ComponentPy_i Register' + str( Component_path ) )
         self._naming_service.Register(self._compo_o, Component_path)
         # Add componentinstance to registry