You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
640 B

4 months ago
  1. /*
  2. * IXBench.h
  3. * Author: Benjamin Sergeant
  4. * Copyright (c) 2017-2020 Machine Zone, Inc. All rights reserved.
  5. */
  6. #pragma once
  7. #include <chrono>
  8. #include <stdint.h>
  9. #include <string>
  10. namespace ix
  11. {
  12. class Bench
  13. {
  14. public:
  15. Bench(const std::string& description);
  16. ~Bench();
  17. void reset();
  18. void record();
  19. void report();
  20. void setReported();
  21. uint64_t getDuration() const;
  22. private:
  23. std::string _description;
  24. std::chrono::time_point<std::chrono::high_resolution_clock> _start;
  25. uint64_t _duration;
  26. bool _reported;
  27. };
  28. } // namespace ix