Auto merge of #14272 - connorimes:fix-energy-profiling-feature, r=Manishearth

Fix energy profiling feature

<!-- Please describe your changes on the following line: -->
The `energy-profiling` feature was broken at some point when `#![deny(unsafe_code)]` was introduced to the `profile_traits` component.  This PR sets `#[allow(unsafe_code)]` on the `energy` module.
There is an additional commit (my original intention) to update the profiler logging to use the current `ProfilerCategory` enum values for (typically developer-only) performance/power analysis.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because it fixes is a compile error for a feature.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14272)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-19 02:32:00 -06:00 committed by GitHub
commit 1e42e4d9ce
3 changed files with 25 additions and 2 deletions

View file

@ -30,9 +30,13 @@ pub fn init() {
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutTreeBuilder);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutDamagePropagate);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutGeneratedContent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutDisplayListSorting);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutFloatPlacementSpeculation);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutMain);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutStoreOverflow);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutParallelWarmup);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::LayoutDispListBuild);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::NetHTTPRequestResponse);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::PaintingPerTile);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::PaintingPrepBuff);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::Painting);
@ -43,16 +47,24 @@ pub fn init() {
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptDevtoolsMsg);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptDocumentEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptDomEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptEvaluate);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptFileRead);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptImageCacheMsg);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptInputEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptNetworkEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptParseHTML);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptPlannedNavigation);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptResize);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptUpdateReplacedElement);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptSetScrollState);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptSetViewport);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptTimerEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptStylesheetLoad);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptUpdateReplacedElement);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptWebSocketEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptWorkerEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptServiceWorkerEvent);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ScriptParseXML);
maybe_create_heartbeat(&mut hbs, ProfilerCategory::ApplicationHeartbeat);
unsafe {
HBS = Some(mem::transmute(Box::new(hbs)));

View file

@ -21,6 +21,7 @@ extern crate serde_derive;
extern crate signpost;
extern crate util;
#[allow(unsafe_code)]
pub mod energy;
pub mod mem;
pub mod time;