TickCounter.cpp 1011 B

12345678910111213141516171819202122232425262728293031323334
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #include <Jolt/Jolt.h>
  5. #include <Jolt/Core/TickCounter.h>
  6. #if defined(JPH_PLATFORM_WINDOWS)
  7. JPH_SUPPRESS_WARNING_PUSH
  8. JPH_MSVC_SUPPRESS_WARNING(5039) // winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
  9. #define WIN32_LEAN_AND_MEAN
  10. #ifndef JPH_COMPILER_MINGW
  11. #include <Windows.h>
  12. #else
  13. #include <windows.h>
  14. #endif
  15. JPH_SUPPRESS_WARNING_POP
  16. #endif
  17. JPH_NAMESPACE_BEGIN
  18. #if defined(JPH_PLATFORM_WINDOWS_UWP) || (defined(JPH_PLATFORM_WINDOWS) && defined(JPH_CPU_ARM))
  19. uint64 GetProcessorTickCount()
  20. {
  21. LARGE_INTEGER count;
  22. QueryPerformanceCounter(&count);
  23. return uint64(count.QuadPart);
  24. }
  25. #endif // JPH_PLATFORM_WINDOWS_UWP || (JPH_PLATFORM_WINDOWS && JPH_CPU_ARM)
  26. JPH_NAMESPACE_END