Turns a `/proc/ /maps` line into the mapping event memtrack records for it.
(pid: pid_t, timestamp: u64, line: &str)
| 702 | /// Turns a `/proc/<pid>/maps` line into the mapping event memtrack records |
| 703 | /// for it. |
| 704 | fn mapping_event_from_maps_line(pid: pid_t, timestamp: u64, line: &str) -> MemtrackEvent { |
| 705 | let fields = line.split_whitespace().collect::<Vec<_>>(); |
| 706 | let (start, end) = fields[0].split_once('-').unwrap(); |
| 707 | let (start, end) = ( |
| 708 | u64::from_str_radix(start, 16).unwrap(), |
| 709 | u64::from_str_radix(end, 16).unwrap(), |
| 710 | ); |
| 711 | let (major, minor) = fields[3].split_once(':').unwrap(); |
| 712 | let dev = |
| 713 | u64::from_str_radix(major, 16).unwrap() << 20 | u64::from_str_radix(minor, 16).unwrap(); |
| 714 | |
| 715 | MemtrackEvent { |
| 716 | pid, |
| 717 | tid: pid, |
| 718 | timestamp, |
| 719 | addr: start, |
| 720 | kind: MemtrackEventKind::Mapping { |
| 721 | path: fields[5].to_string(), |
| 722 | dev, |
| 723 | ino: fields[4].parse().unwrap(), |
| 724 | file_offset: u64::from_str_radix(fields[2], 16).unwrap(), |
| 725 | len: end - start, |
| 726 | }, |
| 727 | } |
| 728 | } |
| 729 | |
| 730 | /// A process can map its own binary a second time, as V8 does with its |
| 731 | /// embedded builtins. Each placement has its own load bias, and frames in |
no test coverage detected