Skip to content

Commit d7331f9

Browse files
committed
tools: fix parsing of new -show-timings output format in fast.vlang.io
1 parent 53cbdbc commit d7331f9

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

cmd/tools/fast/fast.v

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,28 @@ fn measure(cmd string, description string) int {
116116

117117
fn measure_steps(vdir string) (int, int, int) {
118118
resp := os.execute_or_panic('$vdir/vprod -o v.c -show-timings $vdir/cmd/v')
119+
mut parse, mut check, mut cgen := 0, 0, 0
119120
lines := resp.output.split_into_lines()
120-
if lines.len != 3 {
121-
return 0, 0, 0
121+
if lines.len == 3 {
122+
parse = lines[0].before('.').int()
123+
check = lines[1].before('.').int()
124+
cgen = lines[2].before('.').int()
125+
} else {
126+
ms_lines := lines.map(it.split(' ms '))
127+
for line in ms_lines {
128+
if line.len == 2 {
129+
// if line[1] == 'SCAN' { scan = line[0].int() }
130+
if line[1] == 'PARSE' {
131+
parse = line[0].int()
132+
}
133+
if line[1] == 'CHECK' {
134+
check = line[0].int()
135+
}
136+
if line[1] == 'C GEN' {
137+
cgen = line[0].int()
138+
}
139+
}
140+
}
122141
}
123-
parse := lines[0].before('.').int()
124-
check := lines[1].before('.').int()
125-
cgen := lines[2].before('.').int()
126142
return parse, check, cgen
127143
}

0 commit comments

Comments
 (0)