parser: support for `-d time_parsing`

pull/7398/head
Delyan Angelov 2020-12-18 17:23:38 +02:00
parent 7e1e247f56
commit 6f7889a3ca
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 7 additions and 1 deletions

View File

@ -267,6 +267,10 @@ fn (mut q Queue) run() {
} }
*/ */
pub fn parse_files(paths []string, table &table.Table, pref &pref.Preferences, global_scope &ast.Scope) []ast.File { pub fn parse_files(paths []string, table &table.Table, pref &pref.Preferences, global_scope &ast.Scope) []ast.File {
mut timers := util.new_timers(false)
$if time_parsing ? {
timers.should_print = true
}
// println('nr_cpus= $nr_cpus') // println('nr_cpus= $nr_cpus')
$if macos { $if macos {
/* /*
@ -300,7 +304,9 @@ pub fn parse_files(paths []string, table &table.Table, pref &pref.Preferences, g
mut files := []ast.File{} mut files := []ast.File{}
for path in paths { for path in paths {
// println('parse_files $path') // println('parse_files $path')
timers.start('parse_file $path')
files << parse_file(path, table, .skip_comments, pref, global_scope) files << parse_file(path, table, .skip_comments, pref, global_scope)
timers.show('parse_file $path')
} }
return files return files
} }

View File

@ -7,7 +7,7 @@ import time
[ref_only] [ref_only]
pub struct Timers { pub struct Timers {
mut: pub mut:
swatches map[string]time.StopWatch swatches map[string]time.StopWatch
should_print bool should_print bool
} }