@@ -29,6 +29,7 @@ mod args;
29
29
mod defer;
30
30
mod options;
31
31
32
+ use :: codspeed:: instrument_hooks:: InstrumentHooks ;
32
33
use defer:: { DeferSlot , DeferStore } ;
33
34
34
35
pub use self :: {
@@ -657,8 +658,7 @@ impl<'a> BenchContext<'a> {
657
658
658
659
let bench_overheads = timer. bench_overheads ( ) ;
659
660
660
- #[ cfg( unix) ]
661
- let _guard = codspeed:: fifo:: BenchGuard :: new_with_runner_fifo ( ) ;
661
+ let _ = InstrumentHooks :: instance ( ) . start_benchmark ( ) ;
662
662
while {
663
663
// Conditions for when sampling is over:
664
664
if elapsed_picos >= max_picos {
@@ -812,8 +812,7 @@ impl<'a> BenchContext<'a> {
812
812
elapsed_picos = elapsed_picos. saturating_add ( progress_picos) ;
813
813
}
814
814
}
815
- #[ cfg( unix) ]
816
- core:: mem:: drop ( _guard) ;
815
+ let _ = InstrumentHooks :: instance ( ) . stop_benchmark ( ) ;
817
816
818
817
// Reset flag for ignoring allocations.
819
818
crate :: alloc:: IGNORE_ALLOC . set ( false ) ;
@@ -899,6 +898,7 @@ impl<'a> BenchContext<'a> {
899
898
let sample_start: UntaggedTimestamp ;
900
899
let sample_end: UntaggedTimestamp ;
901
900
901
+ let instrument_hooks = InstrumentHooks :: instance ( ) ;
902
902
if size_of :: < I > ( ) == 0 && ( size_of :: < O > ( ) == 0 || !mem:: needs_drop :: < O > ( ) ) {
903
903
// Use a range instead of `defer_store` to make the benchmarking
904
904
// loop cheaper.
@@ -914,6 +914,8 @@ impl<'a> BenchContext<'a> {
914
914
}
915
915
916
916
sync_threads ( true ) ;
917
+
918
+ let start_time = InstrumentHooks :: current_timestamp ( ) ;
917
919
sample_start = UntaggedTimestamp :: start ( timer_kind) ;
918
920
919
921
// Sample loop:
@@ -926,6 +928,9 @@ impl<'a> BenchContext<'a> {
926
928
}
927
929
928
930
sample_end = UntaggedTimestamp :: end ( timer_kind) ;
931
+ let end_time = InstrumentHooks :: current_timestamp ( ) ;
932
+ instrument_hooks. add_benchmark_timestamps ( start_time, end_time) ;
933
+
929
934
sync_threads ( false ) ;
930
935
save_alloc_info ( ) ;
931
936
@@ -967,6 +972,7 @@ impl<'a> BenchContext<'a> {
967
972
let defer_slots_iter = defer_slots_slice. iter ( ) ;
968
973
969
974
sync_threads ( true ) ;
975
+ let start_time = InstrumentHooks :: current_timestamp ( ) ;
970
976
sample_start = UntaggedTimestamp :: start ( timer_kind) ;
971
977
972
978
// Sample loop:
@@ -981,6 +987,8 @@ impl<'a> BenchContext<'a> {
981
987
}
982
988
983
989
sample_end = UntaggedTimestamp :: end ( timer_kind) ;
990
+ let end_time = InstrumentHooks :: current_timestamp ( ) ;
991
+ instrument_hooks. add_benchmark_timestamps ( start_time, end_time) ;
984
992
sync_threads ( false ) ;
985
993
save_alloc_info ( ) ;
986
994
@@ -1020,6 +1028,7 @@ impl<'a> BenchContext<'a> {
1020
1028
let defer_inputs_iter = defer_inputs_slice. iter ( ) ;
1021
1029
1022
1030
sync_threads ( true ) ;
1031
+ let start_time = InstrumentHooks :: current_timestamp ( ) ;
1023
1032
sample_start = UntaggedTimestamp :: start ( timer_kind) ;
1024
1033
1025
1034
// Sample loop:
@@ -1030,6 +1039,8 @@ impl<'a> BenchContext<'a> {
1030
1039
}
1031
1040
1032
1041
sample_end = UntaggedTimestamp :: end ( timer_kind) ;
1042
+ let end_time = InstrumentHooks :: current_timestamp ( ) ;
1043
+ instrument_hooks. add_benchmark_timestamps ( start_time, end_time) ;
1033
1044
sync_threads ( false ) ;
1034
1045
save_alloc_info ( ) ;
1035
1046
0 commit comments