Commit 7b269195 authored by Jaana Burcu Dogan's avatar Jaana Burcu Dogan

cmd/go: organize test profiling flags into their own sub-section

Fixes #17020.

Change-Id: Ice21bd8eb4dbc208f244b275c3be604bc8e3efe7
Reviewed-on: https://go-review.googlesource.com/28783Reviewed-by: 's avatarRob Pike <r@golang.org>
Run-TryBot: Jaana Burcu Dogan <jbd@google.com>
parent 81dfcba3
......@@ -1380,28 +1380,11 @@
// 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.
......@@ -1427,33 +1410,11 @@
// 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
......@@ -1479,13 +1440,55 @@
// 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.
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment