File tree Expand file tree Collapse file tree
src/executor/wall_time/perf Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,7 +110,8 @@ pub fn parse_for_memmap2<P: AsRef<Path>>(
110110
111111 // Collect jitdump file paths before the PROT_EXEC filter in process_mmap2_record
112112 // skips them. JIT runtimes mmap the jitdump file so perf records it.
113- if mmap2_record. path . as_slice ( ) . ends_with ( b".dump" ) {
113+ // Match perf's jit_detect(): basename must be `jit-<pid>.dump`.
114+ if is_jit_dump_path ( & mmap2_record. path . as_slice ( ) ) {
114115 let path = PathBuf :: from (
115116 String :: from_utf8_lossy ( & mmap2_record. path . as_slice ( ) ) . into_owned ( ) ,
116117 ) ;
@@ -179,6 +180,23 @@ impl PidFilter {
179180 }
180181}
181182
183+ /// Returns true if the path basename matches perf's jitdump pattern: `jit-<digits>.dump`.
184+ fn is_jit_dump_path ( path : & [ u8 ] ) -> bool {
185+ let basename = match path. iter ( ) . rposition ( |& b| b == b'/' ) {
186+ Some ( pos) => & path[ pos + 1 ..] ,
187+ None => return false ,
188+ } ;
189+ let rest = match basename. strip_prefix ( b"jit-" ) {
190+ Some ( rest) => rest,
191+ None => return false ,
192+ } ;
193+ let rest = match rest. strip_suffix ( b".dump" ) {
194+ Some ( rest) => rest,
195+ None => return false ,
196+ } ;
197+ !rest. is_empty ( ) && rest. iter ( ) . all ( |b| b. is_ascii_digit ( ) )
198+ }
199+
182200/// Process a single MMAP2 record and add it to the symbols and unwind data maps
183201fn process_mmap2_record (
184202 record : linux_perf_data:: linux_perf_event_reader:: Mmap2Record ,
You can’t perform that action at this time.
0 commit comments