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

#include <sleipnir/util/solve_profiler.hpp>

Public Member Functions

 SolveProfiler ()=default
 
 SolveProfiler (std::string_view name)
 
void start ()
 
void stop ()
 
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
 

Public Attributes

std::string name
 Name of measurement to show in diagnostics.
 

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() [1/2]

slp::SolveProfiler::SolveProfiler ( )
default

Constructs a SolveProfiler.

◆ SolveProfiler() [2/2]

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 milliseconds as a double.

Returns
The average solve duration in milliseconds as a double.

◆ current_duration()

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

Returns the most recent solve duration in milliseconds as a double.

Returns
The most recent solve duration in milliseconds as a double.

◆ 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 milliseconds as a double.

Returns
The sum of all solve durations in milliseconds as a double.

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