aboutsummaryrefslogtreecommitdiffstats
path: root/components/profile/heartbeats.rs
diff options
context:
space:
mode:
authorConnor Imes <connor.k.imes@gmail.com>2015-07-28 15:23:57 -0500
committerConnor Imes <connor.k.imes@gmail.com>2015-09-09 13:35:21 -0500
commit3c25f47dbcfd39396298fdd9f229305676836118 (patch)
treef1bf48e6094cb53d03b9769e5f34cf041f1cfb55 /components/profile/heartbeats.rs
parent0d37e8f96b7f40d14bf4fbb0b66e42a01302a336 (diff)
downloadservo-3c25f47dbcfd39396298fdd9f229305676836118.tar.gz
servo-3c25f47dbcfd39396298fdd9f229305676836118.zip
Add energy monitoring and characterization scripts
Diffstat (limited to 'components/profile/heartbeats.rs')
-rw-r--r--components/profile/heartbeats.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/components/profile/heartbeats.rs b/components/profile/heartbeats.rs
index e782067f8a6..6eaff00e79f 100644
--- a/components/profile/heartbeats.rs
+++ b/components/profile/heartbeats.rs
@@ -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,