1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: move timing_start/timing_measure to util.timing_start/util.timing_measure

This commit is contained in:
Delyan Angelov
2021-02-05 16:34:56 +02:00
parent 25a3873019
commit 16dffc7c1d
8 changed files with 49 additions and 34 deletions

View File

@@ -19,6 +19,25 @@ pub fn new_timers(should_print bool) &Timers {
}
}
const timers = new_timers(false)
pub fn get_timers() &Timers {
return util.timers
}
pub fn timing_start(label string) {
get_timers().start(label)
}
pub fn timing_measure(label string) {
get_timers().show(label)
}
pub fn timing_set_should_print(should_print bool) {
mut t := util.timers
t.should_print = should_print
}
pub fn (mut t Timers) start(name string) {
sw := time.new_stopwatch({})
t.swatches[name] = sw