Sleipnir C++ API
Loading...
Searching...
No Matches
slp::ScopedProfiler< Profiler > Class Template Reference

#include <sleipnir/util/scoped_profiler.hpp>

Public Member Functions

 ScopedProfiler (Profiler &profiler) noexcept
 
 ~ScopedProfiler ()
 
 ScopedProfiler (ScopedProfiler &&rhs) noexcept
 
 ScopedProfiler (const ScopedProfiler &)=delete
 
ScopedProfileroperator= (const ScopedProfiler &)=delete
 
void stop ()
 
const std::chrono::duration< double > & current_duration () const
 

Detailed Description

template<typename Profiler>
requires std::same_as<Profiler, SetupProfiler> || std::same_as<Profiler, SolveProfiler>
class slp::ScopedProfiler< Profiler >

Starts a profiler in the constructor and stops it in the destructor.

Constructor & Destructor Documentation

◆ ScopedProfiler() [1/2]

template<typename Profiler >
slp::ScopedProfiler< Profiler >::ScopedProfiler ( Profiler &  profiler)
inlineexplicitnoexcept

Starts a profiler.

Parameters
profilerThe profiler.

◆ ~ScopedProfiler()

template<typename Profiler >
slp::ScopedProfiler< Profiler >::~ScopedProfiler ( )
inline

Stops a profiler.

◆ ScopedProfiler() [2/2]

template<typename Profiler >
slp::ScopedProfiler< Profiler >::ScopedProfiler ( ScopedProfiler< Profiler > &&  rhs)
inlinenoexcept

Move constructor.

Parameters
rhsThe other ScopedProfiler.

Member Function Documentation

◆ current_duration()

template<typename Profiler >
const std::chrono::duration< double > & slp::ScopedProfiler< Profiler >::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.

◆ stop()

template<typename Profiler >
void slp::ScopedProfiler< Profiler >::stop ( )
inline

Stops the profiler.

If this is called, the destructor is a no-op.


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