aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/stats/sample/pvalue.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/stats/sample/pvalue.go')
-rw-r--r--pkg/stats/sample/pvalue.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/stats/sample/pvalue.go b/pkg/stats/sample/pvalue.go
new file mode 100644
index 000000000..acfff4bc4
--- /dev/null
+++ b/pkg/stats/sample/pvalue.go
@@ -0,0 +1,20 @@
+// Copyright 2021 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+package sample
+
+// TODO: I didn't find the substitution as of Feb 2023. Let's keep it as is while it works.
+import "golang.org/x/perf/benchstat" // nolint:all
+
+// Mann-Whitney U test.
+func UTest(old, new *Sample) (pval float64, err error) {
+ // Unfortunately we cannot just invoke MannWhitneyUTest from x/perf/benchstat/internal/stats,
+ // so we first wrap the data in Metrics.
+ mOld := benchstat.Metrics{
+ RValues: old.Xs,
+ }
+ mNew := benchstat.Metrics{
+ RValues: new.Xs,
+ }
+ return benchstat.UTest(&mOld, &mNew)
+}