mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Profile: Resident Segments was not correctly parsing /proc/self/smaps as the regexp did not work anymore. (#37549)
Resident Segments was not being correctly parsed because the regexp changed. Testing: I do not think memory reporting has testcases. We keep the old output intact (i.e., resident) while adding the new output `resident-according-to-smaps` which was previously evaluated to an empty vector on linux. Other targets always return the empty vector. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
fd1255932b
commit
d55e2c4c90
1 changed files with 4 additions and 1 deletions
|
@ -40,6 +40,8 @@ pub fn collect_reports(request: ReporterRequest) {
|
|||
report(path!["resident"], resident());
|
||||
|
||||
// Memory segments, as reported by the OS.
|
||||
// Notice that the sum of this should be more accurate according to
|
||||
// the manpage of /proc/pid/statm
|
||||
for seg in resident_segments() {
|
||||
report(path!["resident-according-to-smaps", seg.0], Some(seg.1));
|
||||
}
|
||||
|
@ -238,6 +240,7 @@ fn resident_segments() -> Vec<(String, usize)> {
|
|||
// For example:
|
||||
//
|
||||
// Rss: 132 kB
|
||||
// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
|
||||
|
||||
let f = match File::open("/proc/self/smaps") {
|
||||
Ok(f) => BufReader::new(f),
|
||||
|
@ -245,7 +248,7 @@ fn resident_segments() -> Vec<(String, usize)> {
|
|||
};
|
||||
|
||||
let seg_re = Regex::new(
|
||||
r"^[:xdigit:]+-[:xdigit:]+ (....) [:xdigit:]+ [:xdigit:]+:[:xdigit:]+ \d+ +(.*)",
|
||||
r"^[[:xdigit:]]+-[[:xdigit:]]+ (....) [[:xdigit:]]+ [[:xdigit:]]+:[[:xdigit:]]+ \d+ +(.*)",
|
||||
)
|
||||
.unwrap();
|
||||
let rss_re = Regex::new(r"^Rss: +(\d+) kB").unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue