NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
Loading...
Searching...
No Matches
nimble::TimeKeeper Class Reference

#include <nimble_timer.h>

Public Member Functions

 TimeKeeper ()
 
void Start ()
 
void Stop ()
 
double GetElapsedTime () const
 

Constructor & Destructor Documentation

◆ TimeKeeper()

nimble::TimeKeeper::TimeKeeper ( )
inline
56: total_time_(0.0) {}

Member Function Documentation

◆ GetElapsedTime()

double nimble::TimeKeeper::GetElapsedTime ( ) const
inline
86 {
87 return total_time_;
88 }

◆ Start()

void nimble::TimeKeeper::Start ( )
inline
69 {
70 start_time_ = std::chrono::high_resolution_clock::now();
71 }

◆ Stop()

void nimble::TimeKeeper::Stop ( )
inline
75 {
76 using std::chrono::duration;
77 using std::chrono::duration_cast;
78 end_time_ = std::chrono::high_resolution_clock::now();
79 std::chrono::duration<double> time_increment(0.0);
80 if (end_time_ > start_time_) { time_increment = duration_cast<duration<double>>(end_time_ - start_time_); }
81 total_time_ += time_increment.count();
82 }

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