v.util: simplify the sorting of v's timing output
parent
a1c81aa49d
commit
2f1cc2bd08
|
@ -26,7 +26,7 @@ pub mut:
|
||||||
parsed_files []ast.File
|
parsed_files []ast.File
|
||||||
cached_msvc MsvcResult
|
cached_msvc MsvcResult
|
||||||
table &table.Table
|
table &table.Table
|
||||||
timers &util.Timers
|
timers &util.Timers = util.new_timers(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_builder(pref &pref.Preferences) Builder {
|
pub fn new_builder(pref &pref.Preferences) Builder {
|
||||||
|
|
|
@ -66,7 +66,7 @@ mut:
|
||||||
vweb_gen_types []table.Type // vweb route checks
|
vweb_gen_types []table.Type // vweb route checks
|
||||||
prevent_sum_type_unwrapping_once bool // needed for assign new values to sum type, stopping unwrapping then
|
prevent_sum_type_unwrapping_once bool // needed for assign new values to sum type, stopping unwrapping then
|
||||||
loop_label string // set when inside a labelled for loop
|
loop_label string // set when inside a labelled for loop
|
||||||
timers &util.Timers
|
timers &util.Timers = util.new_timers(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_checker(table &table.Table, pref &pref.Preferences) Checker {
|
pub fn new_checker(table &table.Table, pref &pref.Preferences) Checker {
|
||||||
|
|
|
@ -129,7 +129,7 @@ mut:
|
||||||
aggregate_type_idx int
|
aggregate_type_idx int
|
||||||
returned_var_name string // to detect that a var doesn't need to be freed since it's being returned
|
returned_var_name string // to detect that a var doesn't need to be freed since it's being returned
|
||||||
branch_parent_pos int // used in BranchStmt (continue/break) for autofree stop position
|
branch_parent_pos int // used in BranchStmt (continue/break) for autofree stop position
|
||||||
timers &util.Timers
|
timers &util.Timers = util.new_timers(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -182,12 +182,13 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string
|
||||||
module_built: module_built
|
module_built: module_built
|
||||||
timers: util.new_timers(timers_should_print)
|
timers: util.new_timers(timers_should_print)
|
||||||
}
|
}
|
||||||
|
g.timers.start('cgen init')
|
||||||
for mod in g.table.modules {
|
for mod in g.table.modules {
|
||||||
g.inits[mod] = strings.new_builder(100)
|
g.inits[mod] = strings.new_builder(100)
|
||||||
g.cleanups[mod] = strings.new_builder(100)
|
g.cleanups[mod] = strings.new_builder(100)
|
||||||
}
|
}
|
||||||
g.timers.start('cgen common')
|
|
||||||
g.init()
|
g.init()
|
||||||
|
g.timers.show('cgen init')
|
||||||
//
|
//
|
||||||
mut tests_inited := false
|
mut tests_inited := false
|
||||||
mut autofree_used := false
|
mut autofree_used := false
|
||||||
|
@ -220,6 +221,7 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string
|
||||||
g.stmts(file.stmts)
|
g.stmts(file.stmts)
|
||||||
g.timers.show('cgen_file $file.path')
|
g.timers.show('cgen_file $file.path')
|
||||||
}
|
}
|
||||||
|
g.timers.start('cgen common')
|
||||||
if autofree_used {
|
if autofree_used {
|
||||||
g.autofree = true // so that void _vcleanup is generated
|
g.autofree = true // so that void _vcleanup is generated
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ pub fn (mut t Timers) measure(name string) i64 {
|
||||||
|
|
||||||
pub fn (mut t Timers) message(name string) string {
|
pub fn (mut t Timers) message(name string) string {
|
||||||
ms := f64(t.measure(name)) / 1000.0
|
ms := f64(t.measure(name)) / 1000.0
|
||||||
value := bold('${ms:.3f}')
|
value := bold('${ms:-8.3f}')
|
||||||
formatted_message := '$name: $value ms'
|
formatted_message := '$value ms $name'
|
||||||
return formatted_message
|
return formatted_message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue