@@ -268,7 +268,15 @@ impl Frame {
268268 }
269269 }
270270
271+ // #[cfg_attr(feature = "flame-it", flame("Frame"))]
271272 pub fn run ( & self , vm : & VirtualMachine ) -> Result < ExecutionResult , PyObjectRef > {
273+ flame_guard ! ( format!( "Frame::run({})" , self . code. obj_name) ) ;
274+ // flame doesn't include notes in the html graph :(
275+ flame_note ! (
276+ flame:: StrCow :: from( "CodeObj name" ) ,
277+ self . code. obj_name. clone( ) . into( )
278+ ) ;
279+
272280 let filename = & self . code . source_path . to_string ( ) ;
273281
274282 // This is the name of the object being run:
@@ -334,6 +342,7 @@ impl Frame {
334342
335343 /// Execute a single instruction.
336344 #[ allow( clippy:: cognitive_complexity) ]
345+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
337346 fn execute_instruction ( & self , vm : & VirtualMachine ) -> FrameResult {
338347 let instruction = self . fetch_instruction ( ) ;
339348
@@ -891,6 +900,7 @@ impl Frame {
891900 }
892901 }
893902
903+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
894904 fn get_elements (
895905 & self ,
896906 vm : & VirtualMachine ,
@@ -912,6 +922,7 @@ impl Frame {
912922 }
913923 }
914924
925+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
915926 fn import (
916927 & self ,
917928 vm : & VirtualMachine ,
@@ -938,6 +949,7 @@ impl Frame {
938949 Ok ( None )
939950 }
940951
952+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
941953 fn import_star ( & self , vm : & VirtualMachine , module : & str , level : usize ) -> FrameResult {
942954 let module = vm. import ( module, & vm. ctx . new_tuple ( vec ! [ ] ) , level) ?;
943955
@@ -951,6 +963,7 @@ impl Frame {
951963 }
952964
953965 // Unwind all blocks:
966+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
954967 fn unwind_blocks ( & self , vm : & VirtualMachine ) -> Option < PyObjectRef > {
955968 while let Some ( block) = self . pop_block ( ) {
956969 match block. typ {
@@ -978,6 +991,7 @@ impl Frame {
978991 None
979992 }
980993
994+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
981995 fn unwind_loop ( & self , vm : & VirtualMachine ) -> Block {
982996 loop {
983997 let block = self . current_block ( ) . expect ( "not in a loop" ) ;
@@ -1003,6 +1017,7 @@ impl Frame {
10031017 }
10041018 }
10051019
1020+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
10061021 fn unwind_exception ( & self , vm : & VirtualMachine , exc : PyObjectRef ) -> Option < PyObjectRef > {
10071022 // unwind block stack on exception and find any handlers:
10081023 while let Some ( block) = self . pop_block ( ) {
@@ -1105,6 +1120,7 @@ impl Frame {
11051120 }
11061121 }
11071122
1123+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
11081124 fn load_name (
11091125 & self ,
11101126 vm : & VirtualMachine ,
@@ -1150,6 +1166,7 @@ impl Frame {
11501166 * self . lasti . borrow_mut ( ) = target_pc;
11511167 }
11521168
1169+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
11531170 fn execute_binop (
11541171 & self ,
11551172 vm : & VirtualMachine ,
@@ -1194,6 +1211,7 @@ impl Frame {
11941211 Ok ( None )
11951212 }
11961213
1214+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
11971215 fn execute_unop ( & self , vm : & VirtualMachine , op : & bytecode:: UnaryOperator ) -> FrameResult {
11981216 let a = self . pop_value ( ) ;
11991217 let value = match * op {
@@ -1234,6 +1252,7 @@ impl Frame {
12341252 Ok ( result)
12351253 }
12361254
1255+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
12371256 fn execute_compare (
12381257 & self ,
12391258 vm : & VirtualMachine ,
@@ -1326,6 +1345,7 @@ impl Frame {
13261345 stack[ stack. len ( ) - depth - 1 ] . clone ( )
13271346 }
13281347
1348+ #[ cfg_attr( feature = "flame-it" , flame( "Frame" ) ) ]
13291349 fn get_exception ( & self , vm : & VirtualMachine , none_allowed : bool ) -> PyResult {
13301350 let exception = self . pop_value ( ) ;
13311351 if none_allowed && vm. get_none ( ) . is ( & exception)
0 commit comments