@@ -236,6 +236,21 @@ impl PerfRunner {
236236 FifoCommand :: CurrentBenchmark { pid, uri } => {
237237 bench_order_by_pid. entry ( pid) . or_default ( ) . push ( uri) ;
238238
239+ // Split the perf.data file
240+ let perf_pid = perf_pid. get_or_init ( || {
241+ let output = std:: process:: Command :: new ( "sh" )
242+ . arg ( "-c" )
243+ . arg ( "pidof -s perf" )
244+ . output ( )
245+ . expect ( "Failed to run pidof command" ) ;
246+
247+ String :: from_utf8_lossy ( & output. stdout )
248+ . trim ( )
249+ . parse :: < u32 > ( )
250+ . expect ( "Failed to parse perf pid" )
251+ } ) ;
252+ run_with_sudo ( & [ "kill" , "-USR2" , & perf_pid. to_string ( ) ] ) ?;
253+
239254 #[ cfg( target_os = "linux" ) ]
240255 if !symbols_by_pid. contains_key ( & pid) && !unwind_data_by_pid. contains_key ( & pid)
241256 {
@@ -297,22 +312,6 @@ impl PerfRunner {
297312 runner_fifo. send_cmd ( FifoCommand :: Ack ) . await ?;
298313 }
299314 FifoCommand :: StartBenchmark => {
300- let perf_pid = perf_pid. get_or_init ( || {
301- let output = std:: process:: Command :: new ( "sh" )
302- . arg ( "-c" )
303- . arg ( "pidof -s perf" )
304- . output ( )
305- . expect ( "Failed to run pidof command" ) ;
306-
307- String :: from_utf8_lossy ( & output. stdout )
308- . trim ( )
309- . parse :: < u32 > ( )
310- . expect ( "Failed to parse perf pid" )
311- } ) ;
312-
313- // Split the perf.data file
314- run_with_sudo ( & [ "kill" , "-USR2" , & perf_pid. to_string ( ) ] ) ?;
315-
316315 perf_fifo. start_events ( ) . await ?;
317316 runner_fifo. send_cmd ( FifoCommand :: Ack ) . await ?;
318317 }
0 commit comments