get_seconds_hires.cpp 585 B

12345678910111213141516171819202122
  1. #include "get_seconds_hires.h"
  2. #if _WIN32
  3. # include <windows.h>
  4. # include <cassert>
  5. IGL_INLINE double igl::get_seconds_hires()
  6. {
  7. LARGE_INTEGER li_freq, li_current;
  8. const bool ret = QueryPerformanceFrequency(&li_freq);
  9. const bool ret2 = QueryPerformanceCounter(&li_current);
  10. assert(ret && ret2);
  11. assert(li_freq.QuadPart > 0);
  12. return double(li_current.QuadPart) / double(li_freq.QuadPart);
  13. }
  14. #else
  15. # include "get_seconds.h"
  16. IGL_INLINE double igl::get_seconds_hires()
  17. {
  18. // Sorry I've no idea how performance counters work on Mac...
  19. return igl::get_seconds();
  20. }
  21. #endif