mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #20251 - jdm:memchart, r=ajeffrey
Chart memory reports over time This is a tool that can take the output of Servo when run with `-m N` and generate an HTML file that charts the behaviour of the various labels over time. Run with `./mach run http://url >/tmp/log; python etc/memory_reports_over_time.py /tmp/log`. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes <!-- 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/20251) <!-- Reviewable:end -->
This commit is contained in:
commit
324e22db03
3 changed files with 255 additions and 1 deletions
|
@ -12,6 +12,7 @@ use std::borrow::ToOwned;
|
|||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
use time::duration_from_seconds;
|
||||
|
||||
pub struct Profiler {
|
||||
|
@ -20,6 +21,9 @@ pub struct Profiler {
|
|||
|
||||
/// Registered memory reporters.
|
||||
reporters: HashMap<String, Reporter>,
|
||||
|
||||
/// Instant at which this profiler was created.
|
||||
created: Instant,
|
||||
}
|
||||
|
||||
const JEMALLOC_HEAP_ALLOCATED_STR: &'static str = "jemalloc-heap-allocated";
|
||||
|
@ -69,6 +73,7 @@ impl Profiler {
|
|||
Profiler {
|
||||
port: port,
|
||||
reporters: HashMap::new(),
|
||||
created: Instant::now(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +116,8 @@ impl Profiler {
|
|||
}
|
||||
|
||||
fn handle_print_msg(&self) {
|
||||
println!("Begin memory reports");
|
||||
let elapsed = self.created.elapsed();
|
||||
println!("Begin memory reports {}", elapsed.as_secs());
|
||||
println!("|");
|
||||
|
||||
// Collect reports from memory reporters.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue