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

cmd/tools/repeat.v: add and fill a new map[string][]int field CmdResult.oms

This commit is contained in:
Delyan Angelov 2020-10-01 21:06:32 +03:00
parent 9dc75f5cd9
commit d96f1bf26d

View File

@ -9,6 +9,7 @@ struct CmdResult {
mut: mut:
runs int runs int
outputs []string outputs []string
oms map[string][]int
timings []int timings []int
} }
struct Context { struct Context {
@ -88,7 +89,7 @@ fn (mut context Context) run() {
eprintln('${i:10} non 0 exit code for cmd: $cmd') eprintln('${i:10} non 0 exit code for cmd: $cmd')
continue continue
} }
context.results[icmd].outputs << res.output context.results[icmd].outputs << res.output.trim_right('\r\n').replace('\r\n', '\n').split("\n")
context.results[icmd].timings << duration context.results[icmd].timings << duration
sum += duration sum += duration
runs++ runs++
@ -97,10 +98,23 @@ fn (mut context Context) run() {
context.results[icmd].runs = runs context.results[icmd].runs = runs
println('') println('')
} }
for icmd in 0..context.results.len{
mut m := map[string][]int
for o in context.results[icmd].outputs {
x := o.split(':')
if x.len > 1 {
k := x[0]
v := x[1].trim_left(' ').int()
m[k] << v
}
}
context.results[icmd].oms = m
}
} }
fn (mut context Context) show_diff_summary() { fn (mut context Context) show_diff_summary() {
// TODO // TODO
//eprintln("$context.results")
} }
fn (mut context Context) show_stddev() { fn (mut context Context) show_stddev() {
// TODO // TODO