File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " binggan"
3- version = " 0.15.1 "
3+ version = " 0.15.2 "
44authors = [" Pascal Seitz <pascal.seitz@gmail.com>" ]
55edition = " 2021"
66homepage = " https://github.com/pseitz/binggan"
Original file line number Diff line number Diff line change @@ -9,6 +9,23 @@ use crate::{
99} ;
1010use quanta:: Clock ;
1111
12+ #[ inline( always) ]
13+ fn clock_raw_fenced ( clock : & Clock ) -> u64 {
14+ atomic:: compiler_fence ( atomic:: Ordering :: SeqCst ) ;
15+ #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ]
16+ // `_rdtsc()` is not serializing; `lfence` provides the needed ordering on modern x86.
17+ unsafe {
18+ core:: arch:: x86_64:: _mm_lfence ( ) ;
19+ }
20+ let t = clock. raw ( ) ;
21+ #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ]
22+ unsafe {
23+ core:: arch:: x86_64:: _mm_lfence ( ) ;
24+ }
25+ atomic:: compiler_fence ( atomic:: Ordering :: SeqCst ) ;
26+ t
27+ }
28+
1229/// The trait which typically wraps a InputWithBenchmark and allows to hide the generics.
1330pub trait Bench < ' a > {
1431 /// Returns the number of iterations the benchmark should do
You can’t perform that action at this time.
0 commit comments