From d7331f981b54928c5c1648107b72f0990cf903c3 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 2 Apr 2021 20:23:32 +0300 Subject: [PATCH] tools: fix parsing of new -show-timings output format in fast.vlang.io --- cmd/tools/fast/fast.v | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/cmd/tools/fast/fast.v b/cmd/tools/fast/fast.v index 701ca88774..9a366a2221 100644 --- a/cmd/tools/fast/fast.v +++ b/cmd/tools/fast/fast.v @@ -116,12 +116,28 @@ fn measure(cmd string, description string) int { fn measure_steps(vdir string) (int, int, int) { resp := os.execute_or_panic('$vdir/vprod -o v.c -show-timings $vdir/cmd/v') + mut parse, mut check, mut cgen := 0, 0, 0 lines := resp.output.split_into_lines() - if lines.len != 3 { - return 0, 0, 0 + if lines.len == 3 { + parse = lines[0].before('.').int() + check = lines[1].before('.').int() + cgen = lines[2].before('.').int() + } else { + ms_lines := lines.map(it.split(' ms ')) + for line in ms_lines { + if line.len == 2 { + // if line[1] == 'SCAN' { scan = line[0].int() } + if line[1] == 'PARSE' { + parse = line[0].int() + } + if line[1] == 'CHECK' { + check = line[0].int() + } + if line[1] == 'C GEN' { + cgen = line[0].int() + } + } + } } - parse := lines[0].before('.').int() - check := lines[1].before('.').int() - cgen := lines[2].before('.').int() return parse, check, cgen }