From 89fc0da6f8948865fd73fbea98b33d7f52c1d9df Mon Sep 17 00:00:00 2001 From: Zhuravlev Kirill Date: Tue, 30 Mar 2021 16:21:27 +0300 Subject: [PATCH] Added timers Signed-off-by: Zhuravlev Kirill --- src/BOPAlgo/BOPAlgo_BuilderSolid.cxx | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx b/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx index fac47dd9e1..f95f3dd877 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx +++ b/src/BOPAlgo/BOPAlgo_BuilderSolid.cxx @@ -41,6 +41,9 @@ #include #include #include + +#include + #include #include #include @@ -60,6 +63,9 @@ #include #include #include +//----------------------------------------------------------- +#include +//----------------------------------------------------------- // 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; } -- 2.39.5