1
Fork 0

Include additional data in the json output

This commit is contained in:
Wesley Wiser 2018-06-13 22:08:41 -04:00
parent 579facaba2
commit 256a6e4fa9
2 changed files with 12 additions and 3 deletions

View file

@ -841,7 +841,7 @@ impl Session {
pub fn save_json_results(&self) { pub fn save_json_results(&self) {
let profiler = self.self_profiling.borrow(); let profiler = self.self_profiling.borrow();
profiler.save_results(); profiler.save_results(&self.opts);
} }
pub fn print_perf_stats(&self) { pub fn print_perf_stats(&self) {

View file

@ -269,8 +269,17 @@ impl SelfProfiler {
writeln!(lock, "Incremental: {}", incremental).unwrap(); writeln!(lock, "Incremental: {}", incremental).unwrap();
} }
pub fn save_results(&self) { pub fn save_results(&self, opts: &Options) {
fs::write("self_profiler_results.json", self.data.json()).unwrap(); let category_data = self.data.json();
let compilation_options = format!("{{ \"optimization_level\": \"{:?}\", \"incremental\": {} }}",
opts.optimize,
if opts.incremental.is_some() { "true" } else { "false" });
let json = format!("{{ \"category_data\": {}, \"compilation_options\": {} }}",
category_data,
compilation_options);
fs::write("self_profiler_results.json", json).unwrap();
} }
pub fn record_activity<'a>(&'a mut self, category: ProfileCategory) -> ProfilerActivity<'a> { pub fn record_activity<'a>(&'a mut self, category: ProfileCategory) -> ProfilerActivity<'a> {