22#ifndef SLEIPNIR_DISABLE_DIAGNOSTICS
23 m_current_solve_start_time = std::chrono::steady_clock::now();
30#ifndef SLEIPNIR_DISABLE_DIAGNOSTICS
31 m_current_solve_stop_time = std::chrono::steady_clock::now();
32 m_current_solve_duration =
33 m_current_solve_stop_time - m_current_solve_start_time;
34 m_total_solve_duration += m_current_solve_duration;
37 m_average_solve_duration =
38 (m_num_solves - 1.0) / m_num_solves * m_average_solve_duration +
39 1.0 / m_num_solves * m_current_solve_duration;
46 std::string_view
name()
const {
return m_name; }
57 return m_current_solve_duration;
64 return m_average_solve_duration;
71 return m_total_solve_duration;
78 std::chrono::steady_clock::time_point m_current_solve_start_time;
79 std::chrono::steady_clock::time_point m_current_solve_stop_time;
80 std::chrono::duration<double> m_current_solve_duration{0.0};
81 std::chrono::duration<double> m_total_solve_duration{0.0};
84 std::chrono::duration<double> m_average_solve_duration{0.0};
const std::chrono::duration< double > & average_duration() const
Returns the average solve duration in seconds.
Definition solve_profiler.hpp:63
const std::chrono::duration< double > & current_duration() const
Returns the most recent solve duration in seconds.
Definition solve_profiler.hpp:56
SolveProfiler(std::string_view name)
Constructs a SolveProfiler.
Definition solve_profiler.hpp:18
const std::chrono::duration< double > & total_duration() const
Returns the sum of all solve durations in seconds.
Definition solve_profiler.hpp:70
std::string_view name() const
Returns name of measurement to show in diagnostics.
Definition solve_profiler.hpp:46
void start()
Tell the profiler to start measuring solve time.
Definition solve_profiler.hpp:21
int num_solves() const
Returns the number of solves.
Definition solve_profiler.hpp:51
void stop()
Tell the profiler to stop measuring solve time, increment the number of averages, and incorporate the...
Definition solve_profiler.hpp:29
Definition expression_graph.hpp:11