HighRezTimer.h 705 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef ANKI_UTIL_HIGH_REZ_TIMER_H
  2. #define ANKI_UTIL_HIGH_REZ_TIMER_H
  3. #include "anki/util/StdTypes.h"
  4. namespace anki {
  5. /// High resolution timer. All time in seconds
  6. class HighRezTimer
  7. {
  8. public:
  9. /// The type that the timer manipulates the results
  10. typedef F64 Scalar;
  11. /// Start the timer
  12. void start();
  13. /// Stop the timer
  14. void stop();
  15. /// Get the time elapsed between start and stop (if its stopped) or
  16. /// between start and the current time
  17. Scalar getElapsedTime() const;
  18. /// Get the current date's seconds
  19. static Scalar getCurrentTime();
  20. /// Micro sleep
  21. static void sleep(Scalar seconds);
  22. private:
  23. Scalar startTime = 0.0;
  24. Scalar stopTime = 0.0;
  25. };
  26. } // end namespace anki
  27. #endif