diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-07-30 14:46:13 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-07-30 14:46:13 -0600 |
commit | 4837dd9a1c172a55bfad0a7ae67dc3b64753be9a (patch) | |
tree | a20c4a6318d47f8346d767586bf725f7e5f9d4d5 /components/profile/mem.rs | |
parent | 3792bd7611df7343c1bad6119a07bd14296c9ba6 (diff) | |
parent | bd3be999feb2f2d933526023ad5c082405d61160 (diff) | |
download | servo-4837dd9a1c172a55bfad0a7ae67dc3b64753be9a.tar.gz servo-4837dd9a1c172a55bfad0a7ae67dc3b64753be9a.zip |
Auto merge of #6850 - servo:rustup_2015-07-30, r=SimonSapin
Upgrade to rustc 1.3.0-dev (87055a68c 2015-07-30)
This builds and passes unit tests.
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6850)
<!-- Reviewable:end -->
Diffstat (limited to 'components/profile/mem.rs')
-rw-r--r-- | components/profile/mem.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/components/profile/mem.rs b/components/profile/mem.rs index ba0d9e168e6..b04ced9905a 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -313,14 +313,15 @@ impl ReportsForest { // Insert the path and size into the forest, adding any trees and nodes as necessary. fn insert(&mut self, path: &[String], size: usize) { + let (head, tail) = path.split_first().unwrap(); // Get the right tree, creating it if necessary. - if !self.trees.contains_key(&path[0]) { - self.trees.insert(path[0].clone(), ReportsTree::new(path[0].clone())); + if !self.trees.contains_key(head) { + self.trees.insert(head.clone(), ReportsTree::new(head.clone())); } - let t = self.trees.get_mut(&path[0]).unwrap(); + let t = self.trees.get_mut(head).unwrap(); - // Use tail() because the 0th path segment was used to find the right tree in the forest. - t.insert(path.tail(), size); + // Use tail because the 0th path segment was used to find the right tree in the forest. + t.insert(tail, size); } fn print(&mut self) { @@ -500,6 +501,13 @@ mod system_reporter { ); #[cfg(target_os="linux")] + fn page_size() -> usize { + unsafe { + ::libc::sysconf(::libc::_SC_PAGESIZE) as usize + } + } + + #[cfg(target_os="linux")] fn get_proc_self_statm_field(field: usize) -> Option<usize> { use std::fs::File; use std::io::Read; @@ -509,7 +517,7 @@ mod system_reporter { option_try!(f.read_to_string(&mut contents).ok()); let s = option_try!(contents.split_whitespace().nth(field)); let npages = option_try!(s.parse::<usize>().ok()); - Some(npages * ::std::env::page_size()) + Some(npages * page_size()) } #[cfg(target_os="linux")] |