aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/stat/sample/pvalue.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-07-24 12:08:49 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-07-24 14:39:45 +0000
commit49e6369fe732c0f81e5b03b36e345afbf3c79a15 (patch)
tree651e322e41a8084abd6f2c80e4f9b7ff50a1dfe9 /pkg/stat/sample/pvalue.go
parent1f032c27c8158e44723253179928104813d45cdc (diff)
pkg/stat: rename package name to singular form
Go package names should generally be singular form: https://go.dev/blog/package-names https://rakyll.org/style-packages https://groups.google.com/g/golang-nuts/c/buBwLar1gNw
Diffstat (limited to 'pkg/stat/sample/pvalue.go')
-rw-r--r--pkg/stat/sample/pvalue.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/stat/sample/pvalue.go b/pkg/stat/sample/pvalue.go
new file mode 100644
index 000000000..acfff4bc4
--- /dev/null
+++ b/pkg/stat/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)
+}