github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/pkg/stats/pvalue.go (about)

     1  // Copyright 2021 syzkaller project authors. All rights reserved.
     2  // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  package stats
     5  
     6  // TODO: I didn't find the substitution as of Feb 2023. Let's keep it as is while it works.
     7  import "golang.org/x/perf/benchstat" // nolint:all
     8  
     9  // Mann-Whitney U test.
    10  func UTest(old, new *Sample) (pval float64, err error) {
    11  	// Unfortunately we cannot just invoke MannWhitneyUTest from x/perf/benchstat/internal/stats,
    12  	// so we first wrap the data in Metrics.
    13  	mOld := benchstat.Metrics{
    14  		RValues: old.Xs,
    15  	}
    16  	mNew := benchstat.Metrics{
    17  		RValues: new.Xs,
    18  	}
    19  	return benchstat.UTest(&mOld, &mNew)
    20  }