//! Things to help you profile your code.
use super::*;
use winapi::um::profileapi::QueryPerformanceCounter;
/// Gets the high resolution performance counter value.
///
/// See [`QueryPerformanceCounter`](https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter)
#[inline(always)]
pub fn query_performance_counter() -> Result<i64, ErrorCode> {
let mut large = winapi::um::winnt::LARGE_INTEGER::default();
if unsafe { QueryPerformanceCounter(&mut large) } != 0 {
Ok(*unsafe { large.QuadPart() })
} else {
Err(get_last_error())
}
}