Sleipnir C++ API
Loading...
Searching...
No Matches
slp::SolveProfiler Class Reference

#include <sleipnir/util/solve_profiler.hpp>

Public Member Functions

 SolveProfiler (std::string_view name)
 
void start ()
 
void stop ()
 
std::string_view name () const
 
int num_solves () const
 
const std::chrono::duration< double > & current_duration () const
 
const std::chrono::duration< double > & average_duration () const
 
const std::chrono::duration< double > & total_duration () const
 

Detailed Description

Records the number of profiler measurements (start/stop pairs) and the average duration between each start and stop call.

Constructor & Destructor Documentation

◆ SolveProfiler()

slp::SolveProfiler::SolveProfiler ( std::string_view  name)
inlineexplicit

Constructs a SolveProfiler.

Parameters
nameName of measurement to show in diagnostics.

Member Function Documentation

◆ average_duration()

const std::chrono::duration< double > & slp::SolveProfiler::average_duration ( ) const
inline

Returns the average solve duration in seconds.

Returns
The average solve duration in seconds.

◆ current_duration()

const std::chrono::duration< double > & slp::SolveProfiler::current_duration ( ) const
inline

Returns the most recent solve duration in seconds.

Returns
The most recent solve duration in seconds.

◆ name()

std::string_view slp::SolveProfiler::name ( ) const
inline

Returns name of measurement to show in diagnostics.

Returns
Name of measurement to show in diagnostics.

◆ num_solves()

int slp::SolveProfiler::num_solves ( ) const
inline

Returns the number of solves.

Returns
The number of solves.

◆ start()

void slp::SolveProfiler::start ( )
inline

Tell the profiler to start measuring solve time.

◆ stop()

void slp::SolveProfiler::stop ( )
inline

Tell the profiler to stop measuring solve time, increment the number of averages, and incorporate the latest measurement into the average.

◆ total_duration()

const std::chrono::duration< double > & slp::SolveProfiler::total_duration ( ) const
inline

Returns the sum of all solve durations in seconds.

Returns
The sum of all solve durations in seconds.

The documentation for this class was generated from the following file: