File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use crate :: prelude:: * ;
2+ use std:: collections:: HashSet ;
3+ use std:: fs;
4+ use std:: path:: { Path , PathBuf } ;
5+
6+ pub async fn harvest_perf_maps_for_pids (
7+ profile_folder : & Path ,
8+ pids : & HashSet < libc:: pid_t > ,
9+ ) -> Result < ( ) > {
10+ let perf_maps = pids
11+ . iter ( )
12+ . map ( |pid| format ! ( "perf-{pid}.map" ) )
13+ . map ( |file_name| {
14+ (
15+ PathBuf :: from ( "/tmp" ) . join ( & file_name) ,
16+ profile_folder. join ( & file_name) ,
17+ )
18+ } )
19+ . filter ( |( src_path, _) | src_path. exists ( ) )
20+ . collect :: < Vec < _ > > ( ) ;
21+ debug ! ( "Found {} perf maps" , perf_maps. len( ) ) ;
22+
23+ for ( src_path, dst_path) in perf_maps {
24+ fs:: copy ( & src_path, & dst_path) . map_err ( |e| {
25+ anyhow ! (
26+ "Failed to copy perf map file: {:?} to {}: {}" ,
27+ src_path. file_name( ) ,
28+ profile_folder. display( ) ,
29+ e
30+ )
31+ } ) ?;
32+ }
33+
34+ Ok ( ( ) )
35+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ pub mod apt;
22pub mod command;
33pub mod env;
44pub mod get_bench_command;
5+ pub mod harvest_perf_maps_for_pids;
56pub mod introspected_golang;
67pub mod introspected_nodejs;
78pub mod profile_folder;
Original file line number Diff line number Diff line change 1+ use crate :: executor:: helpers:: harvest_perf_maps_for_pids:: harvest_perf_maps_for_pids;
12use crate :: prelude:: * ;
23use std:: collections:: HashSet ;
34use std:: fs;
4- use std:: path:: { Path , PathBuf } ;
5+ use std:: path:: Path ;
56
67pub async fn harvest_perf_maps ( profile_folder : & Path ) -> Result < ( ) > {
78 // Get profile files (files with .out extension)
@@ -20,34 +21,3 @@ pub async fn harvest_perf_maps(profile_folder: &Path) -> Result<()> {
2021
2122 harvest_perf_maps_for_pids ( profile_folder, & pids) . await
2223}
23-
24- pub async fn harvest_perf_maps_for_pids (
25- profile_folder : & Path ,
26- pids : & HashSet < libc:: pid_t > ,
27- ) -> Result < ( ) > {
28- let perf_maps = pids
29- . iter ( )
30- . map ( |pid| format ! ( "perf-{pid}.map" ) )
31- . map ( |file_name| {
32- (
33- PathBuf :: from ( "/tmp" ) . join ( & file_name) ,
34- profile_folder. join ( & file_name) ,
35- )
36- } )
37- . filter ( |( src_path, _) | src_path. exists ( ) )
38- . collect :: < Vec < _ > > ( ) ;
39- debug ! ( "Found {} perf maps" , perf_maps. len( ) ) ;
40-
41- for ( src_path, dst_path) in perf_maps {
42- fs:: copy ( & src_path, & dst_path) . map_err ( |e| {
43- anyhow ! (
44- "Failed to copy perf map file: {:?} to {}: {}" ,
45- src_path. file_name( ) ,
46- profile_folder. display( ) ,
47- e
48- )
49- } ) ?;
50- }
51-
52- Ok ( ( ) )
53- }
Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ use crate::cli::UnwindingMode;
44use crate :: executor:: Config ;
55use crate :: executor:: helpers:: command:: CommandBuilder ;
66use crate :: executor:: helpers:: env:: is_codspeed_debug_enabled;
7+ use crate :: executor:: helpers:: harvest_perf_maps_for_pids:: harvest_perf_maps_for_pids;
78use crate :: executor:: helpers:: run_command_with_log_pipe:: run_command_with_log_pipe_and_callback;
89use crate :: executor:: helpers:: run_with_sudo:: run_with_sudo;
910use crate :: executor:: helpers:: run_with_sudo:: wrap_with_sudo;
1011use crate :: executor:: shared:: fifo:: FifoBenchmarkData ;
1112use crate :: executor:: shared:: fifo:: RunnerFifo ;
1213use crate :: executor:: valgrind:: helpers:: ignored_objects_path:: get_objects_path_to_ignore;
13- use crate :: executor:: valgrind:: helpers:: perf_maps:: harvest_perf_maps_for_pids;
1414use crate :: executor:: wall_time:: perf:: debug_info:: ProcessDebugInfo ;
1515use crate :: executor:: wall_time:: perf:: jit_dump:: harvest_perf_jit_for_pids;
1616use crate :: executor:: wall_time:: perf:: perf_executable:: get_working_perf_executable;
You can’t perform that action at this time.
0 commit comments