]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: organize test profiling flags into their own sub-section
authorJaana Burcu Dogan <jbd@google.com>
Thu, 8 Sep 2016 18:21:20 +0000 (11:21 -0700)
committerJaana Burcu Dogan <jbd@google.com>
Sat, 10 Sep 2016 00:35:48 +0000 (00:35 +0000)
Fixes #17020.

Change-Id: Ice21bd8eb4dbc208f244b275c3be604bc8e3efe7
Reviewed-on: https://go-review.googlesource.com/28783
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Jaana Burcu Dogan <jbd@google.com>

src/cmd/go/alldocs.go
src/cmd/go/test.go

index 16c0028f771593aaea747000a66922d960acc75c..1ff04f8206211cbe01682dc8a75934c482edccdd 100644 (file)
 //         By default, no benchmarks run. To run all benchmarks,
 //         use '-bench .' or '-bench=.'.
 //
-//     -benchmem
-//         Print memory allocation statistics for benchmarks.
-//
 //     -benchtime t
 //         Run enough iterations of each benchmark to take t, specified
 //         as a time.Duration (for example, -benchtime 1h30s).
 //         The default is 1 second (1s).
 //
-//     -blockprofile block.out
-//         Write a goroutine blocking profile to the specified file
-//         when all tests are complete.
-//         Writes test binary as -c would.
-//
-//     -blockprofilerate n
-//         Control the detail provided in goroutine blocking profiles by
-//         calling runtime.SetBlockProfileRate with n.
-//         See 'go doc runtime.SetBlockProfileRate'.
-//         The profiler aims to sample, on average, one blocking event every
-//         n nanoseconds the program spends blocked.  By default,
-//         if -test.blockprofile is set without this flag, all blocking events
-//         are recorded, equivalent to -test.blockprofilerate=1.
-//
 //     -count n
 //         Run each test and benchmark n times (default 1).
 //         If -cpu is set, run n times for each GOMAXPROCS value.
 //         Packages are specified as import paths.
 //         Sets -cover.
 //
-//     -coverprofile cover.out
-//         Write a coverage profile to the file after all tests have passed.
-//         Sets -cover.
-//
 //     -cpu 1,2,4
 //         Specify a list of GOMAXPROCS values for which the tests or
 //         benchmarks should be executed.  The default is the current value
 //         of GOMAXPROCS.
 //
-//     -cpuprofile cpu.out
-//         Write a CPU profile to the specified file before exiting.
-//         Writes test binary as -c would.
-//
-//     -memprofile mem.out
-//         Write a memory profile to the file after all tests have passed.
-//         Writes test binary as -c would.
-//
-//     -memprofilerate n
-//         Enable more precise (and expensive) memory profiles by setting
-//         runtime.MemProfileRate.  See 'go doc runtime.MemProfileRate'.
-//         To profile all memory allocations, use -test.memprofilerate=1
-//         and pass --alloc_space flag to the pprof tool.
-//
-//     -outputdir directory
-//         Place output files from profiling in the specified directory,
-//         by default the directory in which "go test" is running.
-//
 //     -parallel n
 //         Allow parallel execution of test functions that call t.Parallel.
 //         The value of this flag is the maximum number of tests to run
 //         If a test runs longer than t, panic.
 //         The default is 10 minutes (10m).
 //
-//     -trace trace.out
-//         Write an execution trace to the specified file before exiting.
-//
 //     -v
 //         Verbose output: log all tests as they are run. Also print all
 //         text from Log and Logf calls even if the test succeeds.
 //
+// The following flags are also recognized by 'go test' and can be used to
+// profile the tests during execution::
+//
+//     -benchmem
+//         Print memory allocation statistics for benchmarks.
+//
+//     -blockprofile block.out
+//         Write a goroutine blocking profile to the specified file
+//         when all tests are complete.
+//         Writes test binary as -c would.
+//
+//     -blockprofilerate n
+//         Control the detail provided in goroutine blocking profiles by
+//         calling runtime.SetBlockProfileRate with n.
+//         See 'go doc runtime.SetBlockProfileRate'.
+//         The profiler aims to sample, on average, one blocking event every
+//         n nanoseconds the program spends blocked.  By default,
+//         if -test.blockprofile is set without this flag, all blocking events
+//         are recorded, equivalent to -test.blockprofilerate=1.
+//
+//     -coverprofile cover.out
+//         Write a coverage profile to the file after all tests have passed.
+//         Sets -cover.
+//
+//     -cpuprofile cpu.out
+//         Write a CPU profile to the specified file before exiting.
+//         Writes test binary as -c would.
+//
+//     -memprofile mem.out
+//         Write a memory profile to the file after all tests have passed.
+//         Writes test binary as -c would.
+//
+//     -memprofilerate n
+//         Enable more precise (and expensive) memory profiles by setting
+//         runtime.MemProfileRate.  See 'go doc runtime.MemProfileRate'.
+//         To profile all memory allocations, use -test.memprofilerate=1
+//         and pass --alloc_space flag to the pprof tool.
+//
+//     -outputdir directory
+//         Place output files from profiling in the specified directory,
+//         by default the directory in which "go test" is running.
+//
+//     -trace trace.out
+//         Write an execution trace to the specified file before exiting.
+//
 // Each of these flags is also recognized with an optional 'test.' prefix,
 // as in -test.v. When invoking the generated test binary (the result of
 // 'go test -c') directly, however, the prefix is mandatory.
index e1527da255a4a7efee424a4618ed90f26da7a4f5..138d46c381701b73d577bd6e7bd8a8dc4edfede5 100644 (file)
@@ -135,28 +135,11 @@ const testFlag2 = `
            By default, no benchmarks run. To run all benchmarks,
            use '-bench .' or '-bench=.'.
 
-       -benchmem
-           Print memory allocation statistics for benchmarks.
-
        -benchtime t
            Run enough iterations of each benchmark to take t, specified
            as a time.Duration (for example, -benchtime 1h30s).
            The default is 1 second (1s).
 
-       -blockprofile block.out
-           Write a goroutine blocking profile to the specified file
-           when all tests are complete.
-           Writes test binary as -c would.
-
-       -blockprofilerate n
-           Control the detail provided in goroutine blocking profiles by
-           calling runtime.SetBlockProfileRate with n.
-           See 'go doc runtime.SetBlockProfileRate'.
-           The profiler aims to sample, on average, one blocking event every
-           n nanoseconds the program spends blocked.  By default,
-           if -test.blockprofile is set without this flag, all blocking events
-           are recorded, equivalent to -test.blockprofilerate=1.
-
        -count n
            Run each test and benchmark n times (default 1).
            If -cpu is set, run n times for each GOMAXPROCS value.
@@ -182,33 +165,11 @@ const testFlag2 = `
            Packages are specified as import paths.
            Sets -cover.
 
-       -coverprofile cover.out
-           Write a coverage profile to the file after all tests have passed.
-           Sets -cover.
-
        -cpu 1,2,4
            Specify a list of GOMAXPROCS values for which the tests or
            benchmarks should be executed.  The default is the current value
            of GOMAXPROCS.
 
-       -cpuprofile cpu.out
-           Write a CPU profile to the specified file before exiting.
-           Writes test binary as -c would.
-
-       -memprofile mem.out
-           Write a memory profile to the file after all tests have passed.
-           Writes test binary as -c would.
-
-       -memprofilerate n
-           Enable more precise (and expensive) memory profiles by setting
-           runtime.MemProfileRate.  See 'go doc runtime.MemProfileRate'.
-           To profile all memory allocations, use -test.memprofilerate=1
-           and pass --alloc_space flag to the pprof tool.
-
-       -outputdir directory
-           Place output files from profiling in the specified directory,
-           by default the directory in which "go test" is running.
-
        -parallel n
            Allow parallel execution of test functions that call t.Parallel.
            The value of this flag is the maximum number of tests to run
@@ -234,13 +195,55 @@ const testFlag2 = `
            If a test runs longer than t, panic.
            The default is 10 minutes (10m).
 
-       -trace trace.out
-           Write an execution trace to the specified file before exiting.
-
        -v
            Verbose output: log all tests as they are run. Also print all
            text from Log and Logf calls even if the test succeeds.
 
+The following flags are also recognized by 'go test' and can be used to
+profile the tests during execution::
+
+       -benchmem
+           Print memory allocation statistics for benchmarks.
+
+       -blockprofile block.out
+           Write a goroutine blocking profile to the specified file
+           when all tests are complete.
+           Writes test binary as -c would.
+
+       -blockprofilerate n
+           Control the detail provided in goroutine blocking profiles by
+           calling runtime.SetBlockProfileRate with n.
+           See 'go doc runtime.SetBlockProfileRate'.
+           The profiler aims to sample, on average, one blocking event every
+           n nanoseconds the program spends blocked.  By default,
+           if -test.blockprofile is set without this flag, all blocking events
+           are recorded, equivalent to -test.blockprofilerate=1.
+
+       -coverprofile cover.out
+           Write a coverage profile to the file after all tests have passed.
+           Sets -cover.
+
+       -cpuprofile cpu.out
+           Write a CPU profile to the specified file before exiting.
+           Writes test binary as -c would.
+
+       -memprofile mem.out
+           Write a memory profile to the file after all tests have passed.
+           Writes test binary as -c would.
+
+       -memprofilerate n
+           Enable more precise (and expensive) memory profiles by setting
+           runtime.MemProfileRate.  See 'go doc runtime.MemProfileRate'.
+           To profile all memory allocations, use -test.memprofilerate=1
+           and pass --alloc_space flag to the pprof tool.
+
+       -outputdir directory
+           Place output files from profiling in the specified directory,
+           by default the directory in which "go test" is running.
+
+       -trace trace.out
+           Write an execution trace to the specified file before exiting.
+
 Each of these flags is also recognized with an optional 'test.' prefix,
 as in -test.v. When invoking the generated test binary (the result of
 'go test -c') directly, however, the prefix is mandatory.