aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShing Lyu <shing.lyu@gmail.com>2016-09-09 17:32:12 +0800
committerShing Lyu <shing.lyu@gmail.com>2016-09-09 17:38:19 +0800
commitfc8731990cef746bcacdfae6dd6180cd983dace3 (patch)
tree5f8bfdd0405090494093fecb348b39bacb541941
parentbba3eefde86d7716c35b6dcb6f45c9d42fbe758f (diff)
downloadservo-fc8731990cef746bcacdfae6dd6180cd983dace3.tar.gz
servo-fc8731990cef746bcacdfae6dd6180cd983dace3.zip
Create separate layout trace file for each reflow
-rw-r--r--components/layout/layout_debug.rs4
-rw-r--r--components/layout_thread/lib.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs
index 20e8a16714b..77ed1741add 100644
--- a/components/layout/layout_debug.rs
+++ b/components/layout/layout_debug.rs
@@ -121,13 +121,13 @@ pub fn begin_trace(flow_root: FlowRef) {
/// End the debug layout trace. This will write the layout
/// trace to disk in the current directory. The output
/// file can then be viewed with an external tool.
-pub fn end_trace() {
+pub fn end_trace(generation: u32) {
let mut thread_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap());
assert!(thread_state.scope_stack.len() == 1);
let mut root_scope = thread_state.scope_stack.pop().unwrap();
root_scope.post = json::encode(&flow::base(&*thread_state.flow_root)).unwrap();
let result = json::encode(&root_scope).unwrap();
- let mut file = File::create("layout_trace.json").unwrap();
+ let mut file = File::create(format!("layout_trace-{}.json", generation)).unwrap();
file.write_all(result.as_bytes()).unwrap();
}
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index d3be538e2b3..d3d55b590b9 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -1522,7 +1522,7 @@ impl LayoutThread {
self.first_reflow = false;
if opts::get().trace_layout {
- layout_debug::end_trace();
+ layout_debug::end_trace(self.generation);
}
if opts::get().dump_flow_tree {