Skip to content

Commit 7273a2b

Browse files
dgryskiaykevl
authored andcommitted
src/testing stub AllocsPerRun
1 parent 44bb381 commit 7273a2b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/testing/testing.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,19 @@ func Verbose() bool {
302302
return flagVerbose
303303
}
304304

305+
// AllocsPerRun returns the average number of allocations during calls to f.
306+
// Although the return value has type float64, it will always be an integral
307+
// value.
308+
//
309+
// Not implemented.
310+
func AllocsPerRun(runs int, f func()) (avg float64) {
311+
f()
312+
for i := 0; i < runs; i++ {
313+
f()
314+
}
315+
return 0
316+
}
317+
305318
func TestMain(m *M) {
306319
os.Exit(m.Run())
307320
}

0 commit comments

Comments
 (0)