Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::ScopedClock< Clock, Callback > Class Template Reference

#include <clock.h>

Inheritance diagram for inviwo::ScopedClock< Clock, Callback >:

Public Types

using Duration = Clock::duration
Public Types inherited from inviwo::Clock
using clock = std::chrono::high_resolution_clock
using duration = std::chrono::high_resolution_clock::duration
using time_point = std::chrono::high_resolution_clock::time_point

Public Member Functions

 ScopedClock (Callback message, Duration logIfAtLeast={}, LogLevel logLevel=LogLevel::Info, SourceContext context=std::source_location::current())
 ScopedClock (const ScopedClock &)=delete
 ScopedClock (ScopedClock &&)=delete
ScopedClockoperator= (const ScopedClock &)=delete
ScopedClockoperator= (ScopedClock &&)=delete
void print () const
void printAndReset ()
Public Member Functions inherited from inviwo::Clock
 Clock ()
bool isRunning () const
void start ()
void stop ()
void reset ()
duration getElapsedTime () const
double getElapsedMilliseconds () const
double getElapsedSeconds () const

Additional Inherited Members

Protected Attributes inherited from inviwo::Clock
bool isRunning_ = false
time_point startTime_
duration accumulatedTime_ = static_cast<duration>(0)

Detailed Description

template<typename Clock, typename Callback>
class inviwo::ScopedClock< Clock, Callback >

Scoped clock which prints the elapsed time when the instance is destroyed, i.e. print() is called by the destructor.

See also
ScopedClockCPU, ScopedClockGL

Member Function Documentation

◆ print()

template<typename Clock, typename Callback>
void inviwo::ScopedClock< Clock, Callback >::print ( ) const

log the accumulated time but only if it is larger than the duration threshold (logIfAtLeast) given in the constructor.

◆ printAndReset()

template<typename Clock, typename Callback>
void inviwo::ScopedClock< Clock, Callback >::printAndReset ( )

log the accumulated time but only if it is larger than the duration threshold (logIfAtLeast) given in the constructor. Also resets the clock and restarts it.


The documentation for this class was generated from the following file:
  • clock.h