@@ -29,6 +29,7 @@ mod args;
2929mod defer;
3030mod options;
3131
32+ use :: codspeed:: instrument_hooks:: InstrumentHooks ;
3233use defer:: { DeferSlot , DeferStore } ;
3334
3435pub use self :: {
@@ -657,8 +658,7 @@ impl<'a> BenchContext<'a> {
657658
658659 let bench_overheads = timer. bench_overheads ( ) ;
659660
660- #[ cfg( unix) ]
661- let _guard = codspeed:: fifo:: BenchGuard :: new_with_runner_fifo ( ) ;
661+ let _ = InstrumentHooks :: instance ( ) . start_benchmark ( ) ;
662662 while {
663663 // Conditions for when sampling is over:
664664 if elapsed_picos >= max_picos {
@@ -812,8 +812,7 @@ impl<'a> BenchContext<'a> {
812812 elapsed_picos = elapsed_picos. saturating_add ( progress_picos) ;
813813 }
814814 }
815- #[ cfg( unix) ]
816- core:: mem:: drop ( _guard) ;
815+ let _ = InstrumentHooks :: instance ( ) . stop_benchmark ( ) ;
817816
818817 // Reset flag for ignoring allocations.
819818 crate :: alloc:: IGNORE_ALLOC . set ( false ) ;
@@ -899,6 +898,7 @@ impl<'a> BenchContext<'a> {
899898 let sample_start: UntaggedTimestamp ;
900899 let sample_end: UntaggedTimestamp ;
901900
901+ let instrument_hooks = InstrumentHooks :: instance ( ) ;
902902 if size_of :: < I > ( ) == 0 && ( size_of :: < O > ( ) == 0 || !mem:: needs_drop :: < O > ( ) ) {
903903 // Use a range instead of `defer_store` to make the benchmarking
904904 // loop cheaper.
@@ -914,6 +914,8 @@ impl<'a> BenchContext<'a> {
914914 }
915915
916916 sync_threads ( true ) ;
917+
918+ let start_time = InstrumentHooks :: current_timestamp ( ) ;
917919 sample_start = UntaggedTimestamp :: start ( timer_kind) ;
918920
919921 // Sample loop:
@@ -926,6 +928,9 @@ impl<'a> BenchContext<'a> {
926928 }
927929
928930 sample_end = UntaggedTimestamp :: end ( timer_kind) ;
931+ let end_time = InstrumentHooks :: current_timestamp ( ) ;
932+ instrument_hooks. add_benchmark_timestamps ( start_time, end_time) ;
933+
929934 sync_threads ( false ) ;
930935 save_alloc_info ( ) ;
931936
@@ -967,6 +972,7 @@ impl<'a> BenchContext<'a> {
967972 let defer_slots_iter = defer_slots_slice. iter ( ) ;
968973
969974 sync_threads ( true ) ;
975+ let start_time = InstrumentHooks :: current_timestamp ( ) ;
970976 sample_start = UntaggedTimestamp :: start ( timer_kind) ;
971977
972978 // Sample loop:
@@ -981,6 +987,8 @@ impl<'a> BenchContext<'a> {
981987 }
982988
983989 sample_end = UntaggedTimestamp :: end ( timer_kind) ;
990+ let end_time = InstrumentHooks :: current_timestamp ( ) ;
991+ instrument_hooks. add_benchmark_timestamps ( start_time, end_time) ;
984992 sync_threads ( false ) ;
985993 save_alloc_info ( ) ;
986994
@@ -1020,6 +1028,7 @@ impl<'a> BenchContext<'a> {
10201028 let defer_inputs_iter = defer_inputs_slice. iter ( ) ;
10211029
10221030 sync_threads ( true ) ;
1031+ let start_time = InstrumentHooks :: current_timestamp ( ) ;
10231032 sample_start = UntaggedTimestamp :: start ( timer_kind) ;
10241033
10251034 // Sample loop:
@@ -1030,6 +1039,8 @@ impl<'a> BenchContext<'a> {
10301039 }
10311040
10321041 sample_end = UntaggedTimestamp :: end ( timer_kind) ;
1042+ let end_time = InstrumentHooks :: current_timestamp ( ) ;
1043+ instrument_hooks. add_benchmark_timestamps ( start_time, end_time) ;
10331044 sync_threads ( false ) ;
10341045 save_alloc_info ( ) ;
10351046
0 commit comments