File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ publish = false
6
6
7
7
[dependencies ]
8
8
criterion = " 0.3"
9
- criterion-linux-perf = " 0.1.0"
10
9
memmem = " 0.1"
11
10
sliceslice = { path = " .." }
12
11
sse4-strstr = { path = " sse4-strstr" , optional = true }
13
12
twoway = " 0.2"
14
13
14
+ [target .'cfg(target_os = "linux")' .dependencies ]
15
+ criterion-linux-perf = " 0.1"
16
+
15
17
[[bench ]]
16
18
name = " i386"
17
19
harness = false
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use criterion::{
3
3
measurement:: { Measurement , WallTime } ,
4
4
Criterion ,
5
5
} ;
6
+ #[ cfg( target_os = "linux" ) ]
6
7
use criterion_linux_perf:: { PerfMeasurement , PerfMode } ;
7
8
use memmem:: { Searcher , TwoWaySearcher } ;
8
9
use std:: {
@@ -171,10 +172,16 @@ criterion_group!(
171
172
config = Criterion :: default ( ) . with_measurement( WallTime ) ;
172
173
targets = search_short_haystack, search_long_haystack
173
174
) ;
175
+
176
+ #[ cfg( target_os = "linux" ) ]
174
177
criterion_group ! (
175
178
name = i386_perf_instructions;
176
179
config = Criterion :: default ( ) . with_measurement( PerfMeasurement :: new( PerfMode :: Instructions ) ) ;
177
180
targets = search_short_haystack, search_long_haystack
178
181
) ;
179
182
183
+ #[ cfg( target_os = "linux" ) ]
180
184
criterion_main ! ( i386_wall_time, i386_perf_instructions) ;
185
+
186
+ #[ cfg( not( target_os = "linux" ) ) ]
187
+ criterion_main ! ( i386_wall_time) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use criterion::{
3
3
measurement:: { Measurement , WallTime } ,
4
4
BenchmarkId , Criterion ,
5
5
} ;
6
+ #[ cfg( target_os = "linux" ) ]
6
7
use criterion_linux_perf:: { PerfMeasurement , PerfMode } ;
7
8
use memmem:: { Searcher , TwoWaySearcher } ;
8
9
@@ -85,10 +86,16 @@ criterion_group!(
85
86
config = Criterion :: default ( ) . with_measurement( WallTime ) ;
86
87
targets = search
87
88
) ;
89
+
90
+ #[ cfg( target_os = "linux" ) ]
88
91
criterion_group ! (
89
92
name = random_perf_instructions;
90
93
config = Criterion :: default ( ) . with_measurement( PerfMeasurement :: new( PerfMode :: Instructions ) ) ;
91
94
targets = search
92
95
) ;
93
96
97
+ #[ cfg( target_os = "linux" ) ]
94
98
criterion_main ! ( random_wall_time, random_perf_instructions) ;
99
+
100
+ #[ cfg( not( target_os = "linux" ) ) ]
101
+ criterion_main ! ( random_wall_time) ;
You can’t perform that action at this time.
0 commit comments