diff --git a/include/core/processor/processor_base.h b/include/core/processor/processor_base.h index 852a52e45af7d045d8482be09be7c3193809b70b..a617c66bb0e296b39776d100a1734f18d2480daa 100644 --- a/include/core/processor/processor_base.h +++ b/include/core/processor/processor_base.h @@ -269,8 +269,10 @@ class ProcessorBase : public NodeBase, public std::enable_shared_from_this<Proce // PROFILING unsigned int n_capture_callback_; unsigned int n_kf_callback_; - std::chrono::microseconds duration_capture_; - std::chrono::microseconds duration_kf_; + std::chrono::microseconds acc_duration_capture_; + std::chrono::microseconds acc_duration_kf_; + std::chrono::microseconds max_duration_capture_; + std::chrono::microseconds max_duration_kf_; std::chrono::time_point<std::chrono::high_resolution_clock> start_capture_; std::chrono::time_point<std::chrono::high_resolution_clock> start_kf_; void startCaptureProfiling(); @@ -404,7 +406,10 @@ inline void ProcessorBase::startCaptureProfiling() inline void ProcessorBase::stopCaptureProfiling() { - duration_capture_ += std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_capture_); + auto duration_capture = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_capture_); + + max_duration_capture_ = std::max(max_duration_capture_, duration_capture); + acc_duration_capture_ += duration_capture; } inline void ProcessorBase::startKFProfiling() @@ -414,7 +419,10 @@ inline void ProcessorBase::startKFProfiling() inline void ProcessorBase::stopKFProfiling() { - duration_kf_ += std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_kf_); + auto duration_kf = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_kf_); + + max_duration_kf_ = std::max(max_duration_kf_, duration_kf); + acc_duration_kf_ += duration_kf; } inline bool ProcessorBase::isVotingActive() const diff --git a/include/core/solver/solver_manager.h b/include/core/solver/solver_manager.h index c2dce560c5a701f2d5131c34c31fa489da96a4f2..d5d4619d8a2dc4660ba1c31f92a051fcddb7a2fb 100644 --- a/include/core/solver/solver_manager.h +++ b/include/core/solver/solver_manager.h @@ -72,8 +72,10 @@ class SolverManager // PROFILING unsigned int n_solve_; - std::chrono::microseconds duration_manager_; - std::chrono::microseconds duration_solver_; + std::chrono::microseconds acc_duration_manager_; + std::chrono::microseconds acc_duration_solver_; + std::chrono::microseconds max_duration_manager_; + std::chrono::microseconds max_duration_solver_; protected: diff --git a/src/processor/processor_base.cpp b/src/processor/processor_base.cpp index a4ff214e113e41c67725bae938988ff3d10d857b..f9aef63f9dfe5065c9b2b81f82337306f69262ff 100644 --- a/src/processor/processor_base.cpp +++ b/src/processor/processor_base.cpp @@ -15,8 +15,10 @@ ProcessorBase::ProcessorBase(const std::string& _type, int _dim, ParamsProcessor sensor_ptr_(), n_capture_callback_(0), n_kf_callback_(0), - duration_capture_(0), - duration_kf_(0) + acc_duration_capture_(0), + acc_duration_kf_(0), + max_duration_capture_(0), + max_duration_kf_(0) { // WOLF_DEBUG("constructed +p" , id()); } diff --git a/src/solver/solver_manager.cpp b/src/solver/solver_manager.cpp index 8a9e15d6e81b88905ffdd3fb81b0635013ebf426..b99176419bddb3f289f179c6e87ffab17d1df548 100644 --- a/src/solver/solver_manager.cpp +++ b/src/solver/solver_manager.cpp @@ -13,8 +13,10 @@ SolverManager::SolverManager(const ProblemPtr& _problem) : SolverManager::SolverManager(const ProblemPtr& _problem, const ParamsSolverPtr& _params) : n_solve_(0), - duration_manager_(0), - duration_solver_(0), + acc_duration_manager_(0), + acc_duration_solver_(0), + max_duration_manager_(0), + max_duration_solver_(0), wolf_problem_(_problem), params_(_params) { @@ -135,16 +137,18 @@ std::string SolverManager::solve() std::string SolverManager::solve(const ReportVerbosity report_level) { - auto start = std::chrono::high_resolution_clock::now(); + auto start_manager = std::chrono::high_resolution_clock::now(); n_solve_++; // update problem update(); // call derived solver - auto start_derived = std::chrono::high_resolution_clock::now(); + auto start_solver = std::chrono::high_resolution_clock::now(); std::string report = solveDerived(report_level); - duration_solver_ += std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_derived); + auto duration_solver = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_solver); + acc_duration_solver_ += duration_solver; + max_duration_solver_ = std::max(max_duration_solver_,duration_solver); // update StateBlocks with optimized state value. /// @todo whatif someone has changed the state notification during opti ?? @@ -159,7 +163,9 @@ std::string SolverManager::solve(const ReportVerbosity report_level) stateblock_statevector.first->setState(stateblock_statevector.second, false); // false = do not raise the flag state_updated_ } - duration_manager_ += std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start); + auto duration_manager = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start_manager); + acc_duration_manager_ += duration_manager; + max_duration_manager_ = std::max(max_duration_manager_,duration_manager); return report; }