mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8.
This commit is contained in:
parent
7b87085c18
commit
ef8edd4e87
168 changed files with 2247 additions and 2408 deletions
|
@ -5,12 +5,8 @@
|
|||
#![feature(box_syntax)]
|
||||
#![feature(collections)]
|
||||
#![feature(core)]
|
||||
#![cfg_attr(target_os="linux", feature(io))]
|
||||
#![feature(old_io)]
|
||||
#![cfg_attr(target_os="linux", feature(page_size))]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(std_misc)]
|
||||
#![cfg_attr(target_os="linux", feature(str_words))]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
|
||||
|
@ -22,7 +18,7 @@ extern crate profile_traits;
|
|||
extern crate regex;
|
||||
#[cfg(target_os="macos")]
|
||||
extern crate task_info;
|
||||
extern crate "time" as std_time;
|
||||
extern crate time as std_time;
|
||||
extern crate util;
|
||||
|
||||
pub mod mem;
|
||||
|
|
|
@ -9,9 +9,8 @@ use self::system_reporter::SystemReporter;
|
|||
use std::borrow::ToOwned;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::old_io::timer::sleep;
|
||||
use std::thread::sleep_ms;
|
||||
use std::sync::mpsc::{channel, Receiver};
|
||||
use std::time::duration::Duration;
|
||||
use util::task::spawn_named;
|
||||
|
||||
pub struct Profiler {
|
||||
|
@ -28,11 +27,11 @@ impl Profiler {
|
|||
|
||||
// Create the timer thread if a period was provided.
|
||||
if let Some(period) = period {
|
||||
let period_ms = Duration::milliseconds((period * 1000f64) as i64);
|
||||
let period_ms = (period * 1000.) as u32;
|
||||
let chan = chan.clone();
|
||||
spawn_named("Memory profiler timer".to_owned(), move || {
|
||||
loop {
|
||||
sleep(period_ms);
|
||||
sleep_ms(period_ms);
|
||||
if chan.send(ProfilerMsg::Print).is_err() {
|
||||
break;
|
||||
}
|
||||
|
@ -444,7 +443,7 @@ mod system_reporter {
|
|||
let mut f = option_try!(File::open("/proc/self/statm").ok());
|
||||
let mut contents = String::new();
|
||||
option_try!(f.read_to_string(&mut contents).ok());
|
||||
let s = option_try!(contents.words().nth(field));
|
||||
let s = option_try!(contents.split_whitespace().nth(field));
|
||||
let npages = option_try!(s.parse::<usize>().ok());
|
||||
Some(npages * ::std::env::page_size())
|
||||
}
|
||||
|
@ -485,7 +484,7 @@ mod system_reporter {
|
|||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader, BufReadExt};
|
||||
use std::io::{BufReader, BufRead};
|
||||
|
||||
// The first line of an entry in /proc/<pid>/smaps looks just like an entry
|
||||
// in /proc/<pid>/maps:
|
||||
|
|
|
@ -9,11 +9,8 @@ use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, TimerMet
|
|||
use std::borrow::ToOwned;
|
||||
use std::cmp::Ordering;
|
||||
use std::f64;
|
||||
use std::old_io::timer::sleep;
|
||||
use std::iter::AdditiveIterator;
|
||||
use std::num::Float;
|
||||
use std::sync::mpsc::{channel, Receiver};
|
||||
use std::time::duration::Duration;
|
||||
use std::thread::sleep_ms;
|
||||
use std_time::precise_time_ns;
|
||||
use util::task::spawn_named;
|
||||
|
||||
|
@ -99,11 +96,11 @@ impl Profiler {
|
|||
let (chan, port) = channel();
|
||||
match period {
|
||||
Some(period) => {
|
||||
let period = Duration::milliseconds((period * 1000f64) as i64);
|
||||
let period = (period * 1000.) as u32;
|
||||
let chan = chan.clone();
|
||||
spawn_named("Time profiler timer".to_owned(), move || {
|
||||
loop {
|
||||
sleep(period);
|
||||
sleep_ms(period);
|
||||
if chan.send(ProfilerMsg::Print).is_err() {
|
||||
break;
|
||||
}
|
||||
|
@ -192,7 +189,7 @@ impl Profiler {
|
|||
let data_len = data.len();
|
||||
if data_len > 0 {
|
||||
let (mean, median, min, max) =
|
||||
(data.iter().map(|&x|x).sum() / (data_len as f64),
|
||||
(data.iter().map(|&x|x).sum::<f64>() / (data_len as f64),
|
||||
data[data_len / 2],
|
||||
data.iter().fold(f64::INFINITY, |a, &b| a.min(b)),
|
||||
data.iter().fold(-f64::INFINITY, |a, &b| a.max(b)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue