timer_resolution.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <chrono>
  5. namespace Common::Windows {
  6. /// Returns the minimum (least precise) supported timer resolution in nanoseconds.
  7. std::chrono::nanoseconds GetMinimumTimerResolution();
  8. /// Returns the maximum (most precise) supported timer resolution in nanoseconds.
  9. std::chrono::nanoseconds GetMaximumTimerResolution();
  10. /// Returns the current timer resolution in nanoseconds.
  11. std::chrono::nanoseconds GetCurrentTimerResolution();
  12. /**
  13. * Sets the current timer resolution.
  14. *
  15. * @param timer_resolution Timer resolution in nanoseconds.
  16. *
  17. * @returns The current timer resolution.
  18. */
  19. std::chrono::nanoseconds SetCurrentTimerResolution(std::chrono::nanoseconds timer_resolution);
  20. /**
  21. * Sets the current timer resolution to the maximum supported timer resolution.
  22. *
  23. * @returns The current timer resolution.
  24. */
  25. std::chrono::nanoseconds SetCurrentTimerResolutionToMaximum();
  26. /// Sleep for one tick of the current timer resolution.
  27. void SleepForOneTick();
  28. } // namespace Common::Windows