basic code timer for microcontroller usage
Diff: codeTimer.cpp
- Revision:
- 0:ef39a53751b9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/codeTimer.cpp Sun Oct 31 10:42:20 2021 +0000 @@ -0,0 +1,21 @@ +#include "codeTimer.h" + +void CTIMER::cTimerStart(){ + t_.reset(); + t_.start(); +} + +void CTIMER::cTimerBreak(unsigned int interval){ + t_.stop(); + printf("Time interval %x : %lld \n" , interval, duration_cast<std::chrono::microseconds>(t_.elapsed_time()).count()); + time_us_ += duration_cast<std::chrono::microseconds>(t_.elapsed_time()).count(); + t_.reset(); + t_.start(); +} + +void CTIMER::cTimerStop(){ + t_.stop(); + printf("Time interval finish : %lld \n" , duration_cast<std::chrono::microseconds>(t_.elapsed_time()).count()); + time_us_ += duration_cast<std::chrono::microseconds>(t_.elapsed_time()).count(); + printf("Total Time for completion : %lld \n" , time_us_ += duration_cast<std::chrono::microseconds>(t_.elapsed_time()).count()); +} \ No newline at end of file