aboutsummaryrefslogtreecommitdiffstats
path: root/components/profile/time.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-07-14 18:28:57 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-07-24 17:02:17 -0700
commitf10c0761802ed0f77e21d410124ef54239beb48a (patch)
treec17f2bb6b6ee77c246802a88a5b7acaa40e1f57e /components/profile/time.rs
parented1b6a3513e7546b580693f554a081bc0c7c478a (diff)
downloadservo-f10c0761802ed0f77e21d410124ef54239beb48a.tar.gz
servo-f10c0761802ed0f77e21d410124ef54239beb48a.zip
profile: Make the time and memory profilers run over IPC.
Uses the `Router` abstraction inside `ipc-channel` to avoid spawning new threads.
Diffstat (limited to 'components/profile/time.rs')
-rw-r--r--components/profile/time.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/profile/time.rs b/components/profile/time.rs
index 133b48c09c1..02e9f44c294 100644
--- a/components/profile/time.rs
+++ b/components/profile/time.rs
@@ -4,12 +4,12 @@
//! Timing functions.
+use ipc_channel::ipc::{self, IpcReceiver};
use profile_traits::time::{ProfilerCategory, ProfilerChan, ProfilerMsg, TimerMetadata};
use std::borrow::ToOwned;
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::f64;
-use std::sync::mpsc::{channel, Receiver};
use std::thread::sleep_ms;
use std_time::precise_time_ns;
use util::task::spawn_named;
@@ -86,14 +86,14 @@ type ProfilerBuckets = BTreeMap<(ProfilerCategory, Option<TimerMetadata>), Vec<f
// back end of the profiler that handles data aggregation and performance metrics
pub struct Profiler {
- pub port: Receiver<ProfilerMsg>,
+ pub port: IpcReceiver<ProfilerMsg>,
buckets: ProfilerBuckets,
pub last_msg: Option<ProfilerMsg>,
}
impl Profiler {
pub fn create(period: Option<f64>) -> ProfilerChan {
- let (chan, port) = channel();
+ let (chan, port) = ipc::channel().unwrap();
match period {
Some(period) => {
let period = (period * 1000.) as u32;
@@ -128,7 +128,7 @@ impl Profiler {
ProfilerChan(chan)
}
- pub fn new(port: Receiver<ProfilerMsg>) -> Profiler {
+ pub fn new(port: IpcReceiver<ProfilerMsg>) -> Profiler {
Profiler {
port: port,
buckets: BTreeMap::new(),