aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2021-11-11 08:57:28 -0800
committerAyke <[email protected]>2021-11-17 19:25:52 +0100
commit7273a2b5fd616f8476ba9d3b3ca74ad44d6fc33c (patch)
tree30ac765bea94395cc88855744dea3a3be9eb8fea
parent44bb3812200998048aef95f313716d6908c045ed (diff)
downloadtinygo-7273a2b5fd616f8476ba9d3b3ca74ad44d6fc33c.tar.gz
tinygo-7273a2b5fd616f8476ba9d3b3ca74ad44d6fc33c.zip
src/testing stub AllocsPerRun
-rw-r--r--src/testing/testing.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 5b7ec78c8..bd829dc81 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -302,6 +302,19 @@ func Verbose() bool {
return flagVerbose
}
+// AllocsPerRun returns the average number of allocations during calls to f.
+// Although the return value has type float64, it will always be an integral
+// value.
+//
+// Not implemented.
+func AllocsPerRun(runs int, f func()) (avg float64) {
+ f()
+ for i := 0; i < runs; i++ {
+ f()
+ }
+ return 0
+}
+
func TestMain(m *M) {
os.Exit(m.Run())
}