mirror of
https://github.com/servo/servo.git
synced 2025-09-04 20:18:21 +01:00
Add energy monitoring and characterization scripts
This commit is contained in:
parent
0d37e8f96b
commit
3c25f47dbc
11 changed files with 834 additions and 5 deletions
|
@ -51,6 +51,7 @@ pub fn init() {
|
|||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptWebSocketEvent);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptWorkerEvent);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptXhrEvent);
|
||||
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ApplicationHeartbeat);
|
||||
unsafe {
|
||||
HBS = Some(mem::transmute(Box::new(hbs)));
|
||||
}
|
||||
|
@ -71,6 +72,12 @@ pub fn cleanup() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_heartbeat_enabled(category: &ProfilerCategory) -> bool {
|
||||
unsafe {
|
||||
HBS.map_or(false, |m| (*m).contains_key(category))
|
||||
}
|
||||
}
|
||||
|
||||
/// Issue a heartbeat (if one exists) for the given category
|
||||
pub fn maybe_heartbeat(category: &ProfilerCategory,
|
||||
start_time: u64,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue