Auto merge of #10995 - rzambre:master, r=larsbergstrom

Interval + CSV time-profiling

This PR fixes #10886. The -p option can be followed by either an interval number or a CSV filename.
* In the interval profiling, the profiler output would be spitted out to the terminal periodically.
Example usage: **./mach run -p 1 http://www.google.com** will print the time-profiling output to the terminal every second.

* In the CSV file profiling, a CSV file will be generate upon termination of servo.
Example usage: **./mach run -x -o out.png -p out.csv http://www.google.com** will generate out.csv upon termination of Servo.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10995)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-11 17:19:53 -07:00
commit d4315855aa
9 changed files with 214 additions and 92 deletions

View file

@ -11,3 +11,4 @@ doctest = false
[dependencies]
profile = {path = "../../../components/profile"}
profile_traits = {path = "../../../components/profile_traits"}
ipc-channel = {git = "https://github.com/servo/ipc-channel"}

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
extern crate ipc_channel;
extern crate profile;
extern crate profile_traits;

View file

@ -2,14 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use ipc_channel::ipc;
use profile::time;
use profile_traits::time::ProfilerMsg;
#[test]
fn time_profiler_smoke_test() {
let chan = time::Profiler::create(None, None);
let chan = time::Profiler::create(&None, None);
assert!(true, "Can create the profiler thread");
chan.send(ProfilerMsg::Exit);
let (ipcchan, ipcport) = ipc::channel().unwrap();
chan.send(ProfilerMsg::Exit(ipcchan));
assert!(true, "Can tell the profiler thread to exit");
}