1- use criterion:: { black_box , criterion_group, criterion_main, BenchmarkId , Criterion } ;
1+ use criterion:: { criterion_group, criterion_main, BenchmarkId , Criterion } ;
22use opentelemetry:: {
33 global:: BoxedTracer ,
44 trace:: {
@@ -11,9 +11,10 @@ use opentelemetry_sdk::{
1111 error:: OTelSdkResult ,
1212 trace:: { Sampler , SdkTracerProvider , SpanData , SpanExporter } ,
1313} ;
14- #[ cfg( not( target_os = "windows" ) ) ]
14+ #[ cfg( all ( not( target_os = "windows" ) , feature = "bench_profiling ") ) ]
1515use pprof:: criterion:: { Output , PProfProfiler } ;
1616use std:: fmt:: Display ;
17+ use std:: hint:: black_box;
1718
1819fn criterion_benchmark ( c : & mut Criterion ) {
1920 let mut group = c. benchmark_group ( "context" ) ;
@@ -170,7 +171,7 @@ impl SpanExporter for NoopExporter {
170171 }
171172}
172173
173- #[ cfg( not( target_os = "windows" ) ) ]
174+ #[ cfg( all ( not( target_os = "windows" ) , feature = "bench_profiling ") ) ]
174175criterion_group ! {
175176 name = benches;
176177 config = Criterion :: default ( )
@@ -179,12 +180,14 @@ criterion_group! {
179180 . with_profiler( PProfProfiler :: new( 100 , Output :: Flamegraph ( None ) ) ) ;
180181 targets = criterion_benchmark
181182}
182- #[ cfg( target_os = "windows" ) ]
183+
184+ #[ cfg( any( target_os = "windows" , not( feature = "bench_profiling" ) ) ) ]
183185criterion_group ! {
184186 name = benches;
185187 config = Criterion :: default ( )
186188 . warm_up_time( std:: time:: Duration :: from_secs( 1 ) )
187189 . measurement_time( std:: time:: Duration :: from_secs( 2 ) ) ;
188190 targets = criterion_benchmark
189191}
192+
190193criterion_main ! ( benches) ;
0 commit comments