File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1- use crate :: measurement;
1+ use crate :: { instrument_hooks :: InstrumentHooks , measurement} ;
22use colored:: Colorize ;
33use std:: ffi:: CString ;
44
@@ -19,7 +19,8 @@ pub struct CodSpeed {
1919
2020impl CodSpeed {
2121 pub fn new ( ) -> Self {
22- let is_instrumented = measurement:: is_instrumented ( ) ;
22+ let ih = InstrumentHooks :: instance ( ) ;
23+ let is_instrumented = ih. is_instrumented ( ) ;
2324 if !is_instrumented {
2425 println ! (
2526 "{} codspeed is enabled, but no performance measurement will be made since it's running in an unknown environment." ,
@@ -46,12 +47,17 @@ impl CodSpeed {
4647 #[ inline( always) ]
4748 pub fn start_benchmark ( & mut self , name : & str ) {
4849 self . current_benchmark = CString :: new ( name) . expect ( "CString::new failed" ) ;
50+ let _ = InstrumentHooks :: instance ( ) . start_benchmark ( ) ;
4951 measurement:: start ( ) ;
5052 }
5153
5254 #[ inline( always) ]
5355 pub fn end_benchmark ( & mut self ) {
5456 measurement:: stop ( & self . current_benchmark ) ;
57+ let _ = InstrumentHooks :: instance ( ) . stop_benchmark ( ) ;
58+ let _ = InstrumentHooks :: instance ( ) . set_executed_benchmark (
59+ & self . current_benchmark . to_string_lossy ( )
60+ ) ;
5561 self . benchmarked
5662 . push ( self . current_benchmark . to_str ( ) . unwrap ( ) . to_string ( ) ) ;
5763 let action_str = if self . is_instrumented {
You can’t perform that action at this time.
0 commit comments