File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,27 @@ pub(crate) fn compile_fn(
182
182
cx. profiler . generic_activity ( "define function" ) . run ( || {
183
183
context. want_disasm = cx. should_write_ir ;
184
184
module. define_function ( codegened_func. func_id , context) . unwrap ( ) ;
185
+
186
+ if cx. profiler . enabled ( ) {
187
+ let mut recording_args = false ;
188
+ cx. profiler
189
+ . generic_activity_with_arg_recorder (
190
+ "define function (clif pass timings)" ,
191
+ |recorder| {
192
+ let pass_times = cranelift_codegen:: timing:: take_current ( ) ;
193
+ // Replace newlines with | as measureme doesn't allow control characters like
194
+ // newlines inside strings.
195
+ recorder. record_arg ( format ! ( "{}" , pass_times) . replace ( "\n " , " | " ) ) ;
196
+ recording_args = true ;
197
+ } ,
198
+ )
199
+ . run ( || {
200
+ if recording_args {
201
+ // Wait a tiny bit to ensure chrome's profiler doesn't hide the event
202
+ std:: thread:: sleep ( std:: time:: Duration :: from_nanos ( 2 ) )
203
+ }
204
+ } ) ;
205
+ }
185
206
} ) ;
186
207
187
208
if cx. should_write_ir {
You can’t perform that action at this time.
0 commit comments