]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add support for -test.benchmem
authorShenghou Ma <minux.ma@gmail.com>
Thu, 4 Oct 2012 05:20:18 +0000 (13:20 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Thu, 4 Oct 2012 05:20:18 +0000 (13:20 +0800)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6587074

src/cmd/go/test.go
src/cmd/go/testflag.go

index eab3213d29161c0bc3fea7b5aff93a28588b7826..48cef3a944070731103e4f1ffdd7ad59d87a334a 100644 (file)
@@ -94,6 +94,9 @@ directory containing the package sources, has its own flags:
            Run benchmarks matching the regular expression.
            By default, no benchmarks run.
 
+       -test.benchmem
+           Print memory allocation statistics for benchmarks.
+
        -test.cpuprofile cpu.out
            Write a CPU profile to the specified file before exiting.
 
index 1dd27a2e4aa808159d8e6bcfa893e3ac15c1871f..5a7e401a1a32900c7a327efe475f2b3fa468da9b 100644 (file)
@@ -25,6 +25,7 @@ var usageMessage = `Usage of go test:
 
   // These flags can be passed with or without a "test." prefix: -v or -test.v.
   -bench="": passes -test.bench to test
+  -benchmem=false: print memory allocation statistics for benchmarks
   -benchtime=1: passes -test.benchtime to test
   -cpu="": passes -test.cpu to test
   -cpuprofile="": passes -test.cpuprofile to test
@@ -75,6 +76,7 @@ var testFlagDefn = []*testFlagSpec{
 
        // passed to 6.out, adding a "test." prefix to the name if necessary: -v becomes -test.v.
        {name: "bench", passToTest: true},
+       {name: "benchmem", boolVar: new(bool), passToTest: true},
        {name: "benchtime", passToTest: true},
        {name: "cpu", passToTest: true},
        {name: "cpuprofile", passToTest: true},