This repository has been archived by the owner on Nov 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to somehow implement clock_res_get on Windows. (#124)
* Implement clock_time_get on Windows. Also update misc_testsuite to include latest clock_time_get test changes. * Try to somehow implement clock_res_get on Windows. * Fix 55ms * Cache the perf counter resolution * Fix integration tests
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
extern crate bitflags; | ||
|
||
pub mod file; | ||
pub mod time; | ||
pub mod winerror; | ||
|
||
use winerror::WinError; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use cvt::cvt; | ||
use winapi::um::{profileapi::QueryPerformanceFrequency, winnt::LARGE_INTEGER}; | ||
|
||
pub fn perf_counter_frequency() -> std::io::Result<u64> { | ||
unsafe { | ||
let mut frequency: LARGE_INTEGER = std::mem::zeroed(); | ||
cvt(QueryPerformanceFrequency(&mut frequency))?; | ||
Ok(*frequency.QuadPart() as u64) | ||
} | ||
} |