HighRezTimer.h 776 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. /// @addtogroup util
  6. /// @{
  7. /// @addtogroup time
  8. /// @{
  9. /// High resolution timer. All time in seconds
  10. class HighRezTimer
  11. {
  12. public:
  13. /// The type that the timer manipulates the results
  14. typedef F64 Scalar;
  15. /// Start the timer
  16. void start();
  17. /// Stop the timer
  18. void stop();
  19. /// Get the time elapsed between start and stop (if its stopped) or
  20. /// between start and the current time
  21. Scalar getElapsedTime() const;
  22. /// Get the current date's seconds
  23. static Scalar getCurrentTime();
  24. /// Micro sleep
  25. static void sleep(Scalar seconds);
  26. private:
  27. Scalar startTime = 0.0;
  28. Scalar stopTime = 0.0;
  29. };
  30. /// @}
  31. /// @}
  32. } // end namespace anki
  33. #endif