aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2015-07-22 13:09:26 +0200
committerRuss Cox <rsc@golang.org>2015-07-22 15:47:16 +0000
commitae1ea2aa94b366107f4f92a591d102fd32ad86ae (patch)
tree762c1f7f9399e385088feff953f271f44809ca30 /src/testing/testing.go
parent1a99ba55df902a2657d1ccfc52a60024c22dba98 (diff)
downloadgo-ae1ea2aa94b366107f4f92a591d102fd32ad86ae.tar.xz
runtime/trace: add new package
Move tracing functions from runtime/pprof to the new runtime/trace package. Fixes #9710 Change-Id: I718bcb2ae3e5959d9f72cab5e6708289e5c8ebd5 Reviewed-on: https://go-review.googlesource.com/12511 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/testing/testing.go')
-rw-r--r--src/testing/testing.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 8381917478..1dcc35ebc0 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -150,6 +150,7 @@ import (
"os"
"runtime"
"runtime/pprof"
+ "runtime/trace"
"strconv"
"strings"
"sync"
@@ -180,7 +181,7 @@ var (
cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to the named file during execution")
blockProfile = flag.String("test.blockprofile", "", "write a goroutine blocking profile to the named file after execution")
blockProfileRate = flag.Int("test.blockprofilerate", 1, "if >= 0, calls runtime.SetBlockProfileRate()")
- trace = flag.String("test.trace", "", "write an execution trace to the named file after execution")
+ traceFile = flag.String("test.trace", "", "write an execution trace to the named file after execution")
timeout = flag.Duration("test.timeout", 0, "if positive, sets an aggregate time limit for all tests")
cpuListStr = flag.String("test.cpu", "", "comma-separated list of number of CPUs to use for each test")
parallel = flag.Int("test.parallel", runtime.GOMAXPROCS(0), "maximum test parallelism")
@@ -605,13 +606,13 @@ func before() {
}
// Could save f so after can call f.Close; not worth the effort.
}
- if *trace != "" {
- f, err := os.Create(toOutputDir(*trace))
+ if *traceFile != "" {
+ f, err := os.Create(toOutputDir(*traceFile))
if err != nil {
fmt.Fprintf(os.Stderr, "testing: %s", err)
return
}
- if err := pprof.StartTrace(f); err != nil {
+ if err := trace.Start(f); err != nil {
fmt.Fprintf(os.Stderr, "testing: can't start tracing: %s", err)
f.Close()
return
@@ -632,8 +633,8 @@ func after() {
if *cpuProfile != "" {
pprof.StopCPUProfile() // flushes profile to disk
}
- if *trace != "" {
- pprof.StopTrace() // flushes trace to disk
+ if *traceFile != "" {
+ trace.Stop() // flushes trace to disk
}
if *memProfile != "" {
f, err := os.Create(toOutputDir(*memProfile))