]> OCCT Git - occt-copy.git/commitdiff
Added timers
authorZhuravlev Kirill <kirill.zhuravlev.ext@opencascade.com>
Tue, 30 Mar 2021 13:21:27 +0000 (16:21 +0300)
committerZhuravlev Kirill <kirill.zhuravlev.ext@opencascade.com>
Tue, 30 Mar 2021 13:24:16 +0000 (16:24 +0300)
Signed-off-by: Zhuravlev Kirill <kirill.zhuravlev.ext@opencascade.com>
src/BOPAlgo/BOPAlgo_BuilderSolid.cxx

index fac47dd9e1d239d973e406745cee67b58727bb2c..f95f3dd877d8ffadabba1163a66e23cf0311ef9e 100644 (file)
@@ -41,6 +41,9 @@
 #include <NCollection_DataMap.hxx>
 #include <NCollection_List.hxx>
 #include <NCollection_Vector.hxx>
+
+#include <Message_ProgressIndicator.hxx>
+
 #include <TColStd_MapIntegerHasher.hxx>
 #include <TopAbs.hxx>
 #include <TopExp.hxx>
@@ -60,6 +63,9 @@
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_MapOfOrientedShape.hxx>
 #include <TopTools_MapOfShape.hxx>
+//-----------------------------------------------------------
+#include <OSD_Timer.hxx>
+//-----------------------------------------------------------
 
 //
 static
@@ -108,6 +114,13 @@ BOPAlgo_BuilderSolid::~BOPAlgo_BuilderSolid()
 //=======================================================================
 void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange)
 {
+  //Timer construction
+  //---------------------------------------------------------------------
+  OSD_Timer DurationTimer;
+  //---------------------------------------------------------------------
+
+  DurationTimer.Start();
+
   GetReport()->Clear();
   //
   if (myShapes.IsEmpty())
@@ -119,23 +132,40 @@ void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange)
 
   myBoxes.Clear();
 
+  DurationTimer.Stop();
+  std::cout << "Prelim. duration: " << DurationTimer.ElapsedTime() << std::endl;
+
   TopoDS_Compound aC;
   BRep_Builder aBB;
   TopTools_ListIteratorOfListOfShape aIt;
   //
+  DurationTimer.Restart();
   aBB.MakeCompound(aC);
+  DurationTimer.Stop();
+  std::cout << "MakeCompound duration: " << DurationTimer.ElapsedTime() << std::endl;
+
+  DurationTimer.Restart();
   aIt.Initialize(myShapes);
+  DurationTimer.Stop();
+  std::cout << "Initialize duration: " << DurationTimer.ElapsedTime() << std::endl;
+
+  DurationTimer.Restart();
   for(; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aF=aIt.Value();
     aBB.Add(aC, aF);
   }
+  DurationTimer.Stop();
+  std::cout << "ItLoop duration: " << DurationTimer.ElapsedTime() << std::endl;
   //
   if (!theRange.More())
   {
     return;
   }
   //
+  DurationTimer.Restart();
   PerformShapesToAvoid();
+  DurationTimer.Stop();
+  std::cout << "PerformShapesToAvoid duration: " << DurationTimer.ElapsedTime() << std::endl;
   if (HasErrors()) {
     return;
   }
@@ -145,7 +175,10 @@ void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange)
     return;
   }
   //
+  DurationTimer.Restart();
   PerformLoops();
+  DurationTimer.Stop();
+  std::cout << "PerformLoops duration: " << DurationTimer.ElapsedTime() << std::endl;
   if (HasErrors()) {
     return;
   }
@@ -155,7 +188,10 @@ void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange)
     return;
   }
   //
+  DurationTimer.Restart();
   PerformAreas();
+  DurationTimer.Stop();
+  std::cout << "PerformAreas duration: " << DurationTimer.ElapsedTime() << std::endl;
   if (HasErrors()) {
     return;
   }
@@ -165,7 +201,10 @@ void BOPAlgo_BuilderSolid::Perform(const Message_ProgressRange& theRange)
     return;
   }
   //
+  DurationTimer.Restart();
   PerformInternalShapes();
+  DurationTimer.Stop();
+  std::cout << "PerformInternalShapes duration: " << DurationTimer.ElapsedTime() << std::endl;
   if (HasErrors()) {
     return;
   }