@@ -657,6 +657,8 @@ impl<'a> BenchContext<'a> {
657657
658658 let bench_overheads = timer. bench_overheads ( ) ;
659659
660+ #[ cfg( unix) ]
661+ let _guard = codspeed:: fifo:: BenchGuard :: new_with_runner_fifo ( ) ;
660662 while {
661663 // Conditions for when sampling is over:
662664 if elapsed_picos >= max_picos {
@@ -810,6 +812,8 @@ impl<'a> BenchContext<'a> {
810812 elapsed_picos = elapsed_picos. saturating_add ( progress_picos) ;
811813 }
812814 }
815+ #[ cfg( unix) ]
816+ core:: mem:: drop ( _guard) ;
813817
814818 // Reset flag for ignoring allocations.
815819 crate :: alloc:: IGNORE_ALLOC . set ( false ) ;
@@ -909,8 +913,6 @@ impl<'a> BenchContext<'a> {
909913 mem:: forget ( input) ;
910914 }
911915
912- #[ cfg( unix) ]
913- let _guard = codspeed:: fifo:: BenchGuard :: new_with_runner_fifo ( ) ;
914916 sync_threads ( true ) ;
915917 sample_start = UntaggedTimestamp :: start ( timer_kind) ;
916918
@@ -933,8 +935,6 @@ impl<'a> BenchContext<'a> {
933935 sample_end = UntaggedTimestamp :: end ( timer_kind) ;
934936 sync_threads ( false ) ;
935937 save_alloc_info ( ) ;
936- #[ cfg( unix) ]
937- core:: mem:: drop ( _guard) ;
938938
939939 // Drop outputs and inputs.
940940 for _ in 0 ..sample_size {
@@ -973,8 +973,6 @@ impl<'a> BenchContext<'a> {
973973 // reduce benchmarking overhead.
974974 let defer_slots_iter = defer_slots_slice. iter ( ) ;
975975
976- #[ cfg( unix) ]
977- let _guard = codspeed:: fifo:: BenchGuard :: new_with_runner_fifo ( ) ;
978976 sync_threads ( true ) ;
979977 sample_start = UntaggedTimestamp :: start ( timer_kind) ;
980978
@@ -999,8 +997,6 @@ impl<'a> BenchContext<'a> {
999997 sample_end = UntaggedTimestamp :: end ( timer_kind) ;
1000998 sync_threads ( false ) ;
1001999 save_alloc_info ( ) ;
1002- #[ cfg( unix) ]
1003- core:: mem:: drop ( _guard) ;
10041000
10051001 // Prevent the optimizer from removing writes to inputs
10061002 // and outputs in the sample loop.
@@ -1037,8 +1033,6 @@ impl<'a> BenchContext<'a> {
10371033 // reduce benchmarking overhead.
10381034 let defer_inputs_iter = defer_inputs_slice. iter ( ) ;
10391035
1040- #[ cfg( unix) ]
1041- let _guard = codspeed:: fifo:: BenchGuard :: new_with_runner_fifo ( ) ;
10421036 sync_threads ( true ) ;
10431037 sample_start = UntaggedTimestamp :: start ( timer_kind) ;
10441038
@@ -1059,8 +1053,6 @@ impl<'a> BenchContext<'a> {
10591053 sample_end = UntaggedTimestamp :: end ( timer_kind) ;
10601054 sync_threads ( false ) ;
10611055 save_alloc_info ( ) ;
1062- #[ cfg( unix) ]
1063- core:: mem:: drop ( _guard) ;
10641056
10651057 // Prevent the optimizer from removing writes to inputs
10661058 // in the sample loop.
0 commit comments