catch_timer.h 885 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Created by Phil on 05/08/2013.
  3. * Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
  4. *
  5. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
  9. #define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
  10. #include <cstdint>
  11. namespace Catch {
  12. auto getCurrentNanosecondsSinceEpoch() -> uint64_t;
  13. auto getEstimatedClockResolution() -> uint64_t;
  14. class Timer {
  15. uint64_t m_nanoseconds = 0;
  16. public:
  17. void start();
  18. auto getElapsedNanoseconds() const -> uint64_t;
  19. auto getElapsedMicroseconds() const -> uint64_t;
  20. auto getElapsedMilliseconds() const -> unsigned int;
  21. auto getElapsedSeconds() const -> double;
  22. };
  23. } // namespace Catch
  24. #endif // TWOBLUECUBES_CATCH_TIMER_H_INCLUDED