mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
profile: Make the time and memory profilers run over IPC.
Uses the `Router` abstraction inside `ipc-channel` to avoid spawning new threads.
This commit is contained in:
parent
ed1b6a3513
commit
f10c076180
19 changed files with 212 additions and 168 deletions
|
@ -5,19 +5,19 @@
|
|||
extern crate time as std_time;
|
||||
extern crate url;
|
||||
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use self::std_time::precise_time_ns;
|
||||
use self::url::Url;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)]
|
||||
#[derive(PartialEq, Clone, PartialOrd, Eq, Ord, Deserialize, Serialize)]
|
||||
pub struct TimerMetadata {
|
||||
pub url: String,
|
||||
pub iframe: bool,
|
||||
pub incremental: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ProfilerChan(pub Sender<ProfilerMsg>);
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct ProfilerChan(pub IpcSender<ProfilerMsg>);
|
||||
|
||||
impl ProfilerChan {
|
||||
pub fn send(&self, msg: ProfilerMsg) {
|
||||
|
@ -26,7 +26,7 @@ impl ProfilerChan {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub enum ProfilerMsg {
|
||||
/// Normal message used for reporting time
|
||||
Time((ProfilerCategory, Option<TimerMetadata>), f64),
|
||||
|
@ -37,7 +37,7 @@ pub enum ProfilerMsg {
|
|||
}
|
||||
|
||||
#[repr(u32)]
|
||||
#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)]
|
||||
#[derive(PartialEq, Clone, PartialOrd, Eq, Ord, Deserialize, Serialize)]
|
||||
pub enum ProfilerCategory {
|
||||
Compositing,
|
||||
LayoutPerform,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue