Send high resolution millisecond timestamps in timeline markers #5665

This commit is contained in:
Guro Bokum 2015-04-14 20:24:00 +07:00
parent bdcf606f48
commit 491851610e
3 changed files with 54 additions and 20 deletions

View file

@ -4,6 +4,7 @@
/// General actor system infrastructure.
use rustc_serialize::json;
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::cell::{Cell, RefCell};
@ -11,7 +12,7 @@ use std::mem::{replace, transmute};
use std::net::TcpStream;
use std::raw::TraitObject;
use std::sync::{Arc, Mutex};
use rustc_serialize::json;
use time::PreciseTime;
/// A common trait for all devtools actors that encompasses an immutable name
/// and the ability to process messages that are directed to particular actors.
@ -82,6 +83,7 @@ pub struct ActorRegistry {
script_actors: RefCell<HashMap<String, String>>,
shareable: Option<Arc<Mutex<ActorRegistry>>>,
next: Cell<u32>,
start_stamp: PreciseTime,
}
impl ActorRegistry {
@ -94,6 +96,7 @@ impl ActorRegistry {
script_actors: RefCell::new(HashMap::new()),
shareable: None,
next: Cell::new(0),
start_stamp: PreciseTime::now(),
}
}
@ -115,6 +118,11 @@ impl ActorRegistry {
self.shareable.as_ref().unwrap().clone()
}
/// Get start stamp when registry was started
pub fn get_start_stamp(&self) -> PreciseTime {
self.start_stamp.clone()
}
pub fn register_script_actor(&self, script_id: String, actor: String) {
println!("registering {} ({})", actor, script_id);
let mut script_actors = self.script_actors.borrow_mut();