public static void SetResolution(uint Resolution_ns) { if (!m_initialized) { Initialize(); } m_desiredSystemTimerResolution = Resolution_ns; if (Resolution_ns < m_maximumSystemTimerResolution) { Resolution_ns = m_maximumSystemTimerResolution; } else if (Resolution_ns > m_minimumSystemTimerResolution) { Resolution_ns = m_minimumSystemTimerResolution; } // Try to disable previous: MyWindowsAPIWrapper.NTSTATUS result = MyWindowsAPIWrapper.NtSetTimerResolution((uint)Resolution_ns, false, ref m_currentSystemTimerResolution); // Try to set current: result = MyWindowsAPIWrapper.NtSetTimerResolution((uint)Resolution_ns, true, ref m_currentSystemTimerResolution); uint set = GetSystemResolution(); m_isMaxResolution = false; m_isMinResolution = false; // Write to log: // .. change resolution timer to ... }
public static uint GetSystemResolution() { // Only default system settings??? MyWindowsAPIWrapper.NTSTATUS result = MyWindowsAPIWrapper.NtQueryTimerResolution(ref m_minimumSystemTimerResolution, ref m_maximumSystemTimerResolution, ref m_currentSystemTimerResolution); return(m_currentSystemTimerResolution); }
public static void SetNormalResolution() { if (!m_initialized) { Initialize(); } MyWindowsAPIWrapper.NTSTATUS result = MyWindowsAPIWrapper.NtSetTimerResolution(m_systemTimerNormalResolution, true, ref m_currentSystemTimerResolution); }