mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-21 13:55:19 +00:00
[timings-export] Implement JSON + CSV timngs export.
This commit is contained in:
@@ -169,14 +169,19 @@ f64 time_stamp(TimeStamp const &ts, u64 freq, TimingUnit unit) {
|
||||
}
|
||||
}
|
||||
|
||||
void timings_print_all(Timings *t, TimingUnit unit = TimingUnit_Millisecond) {
|
||||
void timings_print_all(Timings *t, TimingUnit unit = TimingUnit_Millisecond, bool timings_are_finalized = false) {
|
||||
isize const SPACES_LEN = 256;
|
||||
char SPACES[SPACES_LEN+1] = {0};
|
||||
gb_memset(SPACES, ' ', SPACES_LEN);
|
||||
|
||||
|
||||
timings__stop_current_section(t);
|
||||
t->total.finish = time_stamp_time_now();
|
||||
/*
|
||||
NOTE(Jeroen): Whether we call `timings_print_all()`, then `timings_export_all()`, the other way around,
|
||||
or just one of them, we only need to stop the clock once.
|
||||
*/
|
||||
if (!timings_are_finalized) {
|
||||
timings__stop_current_section(t);
|
||||
t->total.finish = time_stamp_time_now();
|
||||
}
|
||||
|
||||
isize max_len = gb_min(36, t->total.label.len);
|
||||
for_array(i, t->sections) {
|
||||
@@ -207,4 +212,4 @@ void timings_print_all(Timings *t, TimingUnit unit = TimingUnit_Millisecond) {
|
||||
timing_unit_strings[unit],
|
||||
100.0*section_time/total_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user