Skip to content

Commit e5e6825

Browse files
authored
additional warn column for dbcompare based on threshhold (#2471)
1 parent 47c4183 commit e5e6825

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

scripts/dbcompare/main.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ type dbEntry struct {
3737
}
3838

3939
type opts struct {
40-
mustHaveChar string
41-
iters int
42-
workers int
40+
mustHaveChar string
41+
iters int
42+
workers int
43+
warnPerThreshhold float64
4344
}
4445

4546
func main() {
4647
var opt opts
4748
flag.StringVar(&opt.mustHaveChar, "must", "", "comma separated character names that must be present, otherwise skip. default blank")
49+
flag.Float64Var(&opt.warnPerThreshhold, "warn", 0.05, "percent difference threshold to warn on")
4850
flag.IntVar(&opt.iters, "iters", 1000, "iterations to run each comparison")
4951
flag.IntVar(&opt.workers, "workers", 30, "number of workers to use")
5052
flag.Parse()
@@ -53,7 +55,7 @@ func main() {
5355
panic(err)
5456
}
5557
filters := strings.Split(opt.mustHaveChar, ",")
56-
fmt.Println("chars,id,original,next,diff,abs_diff,per_diff,err")
58+
fmt.Println("diff_ok,chars,id,original,next,diff,abs_diff,per_diff,err")
5759
for _, v := range res {
5860
simcfg, gcsl, err := simulator.Parse(v.Config)
5961
if err != nil {
@@ -86,7 +88,11 @@ func main() {
8688
diff := dps - v.Summary.MeanDpsPerTarget
8789
absDiff := math.Abs(diff)
8890
percentDiff := absDiff / v.Summary.MeanDpsPerTarget
89-
fmt.Printf("%v,%v,%v,%v,%v,%v,%v,%v\n", team, v.Id, v.Summary.MeanDpsPerTarget, dps, diff, absDiff, percentDiff, err)
91+
warn := "ok"
92+
if percentDiff > opt.warnPerThreshhold {
93+
warn = "WARNING"
94+
}
95+
fmt.Printf("%v,%v,%v,%v,%v,%v,%v,%v,%v\n", warn, team, v.Id, v.Summary.MeanDpsPerTarget, dps, diff, absDiff, percentDiff, err)
9096
}
9197
}
9298

0 commit comments

Comments
 (0)