Skip to content
Snippets Groups Projects
Commit 3d6b7310 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

accumulated and max values in profiling

parent 52ea91c5
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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:
......
......@@ -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());
}
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment