File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,11 @@ impl WallTimeExecutor {
3434 . into_iter ( )
3535 . map ( |( k, v) | ( k. into ( ) , v) ) ,
3636 )
37- . map ( |( env, value) | format ! ( "{env}={value}" ) )
37+ . map ( |( env, value) | {
38+ // Properly quote the value to handle special characters
39+ let escaped_value = value. replace ( "\\ " , "\\ \\ " ) . replace ( "\" " , "\\ \" " ) ;
40+ format ! ( "export {env}=\" {escaped_value}\" " )
41+ } )
3842 . collect :: < Vec < _ > > ( )
3943 . join ( "\n " ) ;
4044
@@ -49,8 +53,10 @@ impl WallTimeExecutor {
4953
5054 let uid = nix:: unistd:: Uid :: current ( ) . as_raw ( ) ;
5155 let gid = nix:: unistd:: Gid :: current ( ) . as_raw ( ) ;
56+
57+ // Note: We're using --scope so that perf is able to capture the events of the benchmark process.
5258 let cmd = format ! (
53- "systemd-run {quiet_flag} --pipe --collect --wait -- slice=codspeed.slice --same-dir --uid={uid} --gid={gid} --property=EnvironmentFile={} -- sh -c '{}'" ,
59+ "systemd-run {quiet_flag} --scope --slice=codspeed.slice --same-dir --uid={uid} --gid={gid} -- sh -c 'source {} && {}'" ,
5460 env_file. path( ) . display( ) ,
5561 bench_cmd. replace( "'" , "\" " )
5662 ) ;
Original file line number Diff line number Diff line change 1- use std:: collections:: HashMap ;
2-
3- use anyhow:: { anyhow, bail} ;
1+ use crate :: prelude:: * ;
42use linux_perf_data:: { PerfFileReader , PerfFileRecord , linux_perf_event_reader:: EventRecord } ;
3+ use std:: collections:: HashMap ;
54
65/// Tries to find the pid of the sampled process within a perf.data file.
76pub fn find_pid < P : AsRef < std:: path:: Path > > ( perf_file : P ) -> anyhow:: Result < i32 > {
@@ -48,6 +47,7 @@ pub fn find_pid<P: AsRef<std::path::Path>>(perf_file: P) -> anyhow::Result<i32>
4847 }
4948 }
5049 }
50+ debug ! ( "Pid frequency: {pid_freq:?}" ) ;
5151
5252 // Choose the pid with the highest frequency. However, we can only use a pid if more than N% of the
5353 // events are from that pid.
Original file line number Diff line number Diff line change @@ -251,7 +251,10 @@ impl PerfRunner {
251251 let perf_map_pids = futures:: future:: try_join_all ( copy_tasks)
252252 . await ?
253253 . into_iter ( )
254- . filter_map ( Result :: ok)
254+ . filter_map ( |result| {
255+ debug ! ( "Copy task result: {result:?}" ) ;
256+ result. ok ( )
257+ } )
255258 . collect :: < HashSet < _ > > ( ) ;
256259 harvest_perf_maps_for_pids ( profile_folder, & perf_map_pids) . await ?;
257260
You can’t perform that action at this time.
0 commit comments