1
0
mirror of https://github.com/golang/go synced 2024-10-02 20:31:21 -06:00
Commit Graph

20 Commits

Author SHA1 Message Date
Dmitry Vyukov
7b0c73aa28 cmd/trace: move goroutine analysis code to internal/trace
This allows to test goroutine analysis code in runtime/pprof tests.
Also fix a nil-deref crash in goroutine analysis code that happens on runtime/pprof tests.

Change-Id: Id7884aa29f7fe4a8d7042482a86fe434e030461e
Reviewed-on: https://go-review.googlesource.com/7301
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-11 12:53:24 +00:00
Dmitry Vyukov
9d332a8324 cmd/trace: dump thread id on proc start
Augment ProcStart events with OS thread id.
This helps in scheduler locality analysis.

Change-Id: I93fea75d3072cf68de66110d0b59d07101badcb5
Reviewed-on: https://go-review.googlesource.com/7302
Reviewed-by: Keith Randall <khr@golang.org>
2015-03-11 12:52:41 +00:00
Dmitry Vyukov
5471e02338 runtime/pprof: fix trace test
Some of the trace stacks are OS-dependent due to OS-specific code
in net package. Check these stacks only on subset of OSes.

Change-Id: If95e4485839f4120fd6395725374c3a2f8706dfc
Reviewed-on: https://go-review.googlesource.com/7300
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-03-10 16:29:25 +00:00
Dmitry Vyukov
919fd24884 runtime: remove runtime frames from stacks in traces
Stip uninteresting bottom and top frames from trace stacks.
This makes both binary and json trace files smaller,
and also makes stacks shorter and more readable in the viewer.

Change-Id: Ib9c80ccc280504f0e235f867f53f1d2652c41583
Reviewed-on: https://go-review.googlesource.com/5523
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
2015-03-10 14:46:15 +00:00
David Crawshaw
90dbd428e5 runtime/pprof: skip tests that fork on darwin/arm
Change-Id: I9b08b74214e5a41a7e98866a993b038030a4c073
Reviewed-on: https://go-review.googlesource.com/6251
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-02-27 19:55:54 +00:00
Shenghou Ma
f0bbb5c450 runtime/pprof: make TestBlockProfile more robust
It's using debug mode of pprof.writeBlock, so the output actually goes
through text/tabwriter. It is possible that tabwriter expands each tab
into multiple tabs in certain cases.

For example, this output has been observed on the new arm64 port:
10073805 1 @ 0x1088ec 0xd1b8c 0xd0628 0xb68c0 0x867f4
#	0x1088ec	sync.(*Cond).Wait+0xfc				/home/minux/go.git/src/sync/cond.go:63
#	0xd1b8c		runtime/pprof_test.blockCond+0x22c		/home/minux/go.git/src/runtime/pprof/pprof_test.go:454
#	0xd0628		runtime/pprof_test.TestBlockProfile+0x1b8	/home/minux/go.git/src/runtime/pprof/pprof_test.go:359
#	0xb68c0		testing.tRunner+0x140				/home/minux/go.git/src/testing/testing.go:447

10069965 1 @ 0x14008 0xd1390 0xd0628 0xb68c0 0x867f4
#	0x14008	runtime.chansend1+0x48				/home/minux/go.git/src/runtime/chan.go:76
#	0xd1390	runtime/pprof_test.blockChanSend+0x100		/home/minux/go.git/src/runtime/pprof/pprof_test.go:396
#	0xd0628	runtime/pprof_test.TestBlockProfile+0x1b8	/home/minux/go.git/src/runtime/pprof/pprof_test.go:359
#	0xb68c0	testing.tRunner+0x140				/home/minux/go.git/src/testing/testing.go:447

10069706 1 @ 0x108e0c 0xd193c 0xd0628 0xb68c0 0x867f4
#	0x108e0c	sync.(*Mutex).Lock+0x19c			/home/minux/go.git/src/sync/mutex.go:67
#	0xd193c		runtime/pprof_test.blockMutex+0xbc		/home/minux/go.git/src/runtime/pprof/pprof_test.go:441
#	0xd0628		runtime/pprof_test.TestBlockProfile+0x1b8	/home/minux/go.git/src/runtime/pprof/pprof_test.go:359
#	0xb68c0		testing.tRunner+0x140				/home/minux/go.git/src/testing/testing.go:447

Change-Id: I3bef778c5fe01a894cfdc526fdc5fecb873b8ade
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/5554
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-02-23 21:05:55 +00:00
Dmitry Vyukov
edadffa2f3 cmd/trace: add new command
Trace command allows to visualize and analyze traces.
Run as:
$ go tool trace binary trace.file
The commands opens web browser with the main page,
which contains links for trace visualization,
blocking profiler, network IO profiler and per-goroutine
traces.

Also move trace parser from runtime/pprof/trace_parser_test.go
to internal/trace/parser.go, so that it can be shared between
tests and the command.

Change-Id: Ic97ed59ad6e4c7e1dc9eca5e979701a2b4aed7cf
Reviewed-on: https://go-review.googlesource.com/3601
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-20 18:31:25 +00:00
Dmitry Vyukov
3c3848ad92 runtime: fix system memory allocator on plan9
The following line in sysFree:
n += (n + memRound) &^ memRound
doubles value of n (n += n).
Which is wrong and can lead to memory corruption.

Fixes #9712

Change-Id: I3c141b71da11e38837c09408cf4f1d22e8f7f36e
Reviewed-on: https://go-review.googlesource.com/3602
Reviewed-by: David du Colombier <0intro@gmail.com>
2015-01-30 12:01:31 +00:00
Dmitry Vyukov
256116ad25 runtime: fix trace ticks frequency on windows
Change-Id: I8c7fcc7705070bc9979e39d08a4c9b2870087a08
Reviewed-on: https://go-review.googlesource.com/3500
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-01-30 08:35:38 +00:00
Dmitry Vyukov
4737399bd9 runtime/pprof: skip trace tests on solaris and windows
Coarse-grained test skips to fix bots.
Need to look closer at windows and nacl failures.

Change-Id: I767ef1707232918636b33f715459ee3c0349b45e
Reviewed-on: https://go-review.googlesource.com/3416
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-28 19:29:39 +00:00
Dmitry Vyukov
2059ffbc8d runtime/pprof: add tests for tracer
Change-Id: I832a433f0f2fc10b0a2fea0bfb003a988fc2c81b
Reviewed-on: https://go-review.googlesource.com/2039
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-28 16:52:10 +00:00
Dmitry Vyukov
986a1d2d1c runtime/pprof: add tracing support
runtime/pprof part of tracing functionality:
https://docs.google.com/document/u/1/d/1FP5apqzBgr7ahCCgFO-yoVhk4YZrNIDNf9RybngBc14/pub
Full change:
https://codereview.appspot.com/146920043

Change-Id: I3143a569cbd33576f19ca47308d1ff5200d8c955
Reviewed-on: https://go-review.googlesource.com/1452
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-28 16:40:35 +00:00
Burcu Dogan
dc72db90ea runtime/pprof: ignore CPU profile test failures in QEMU
Fixes #9605

Change-Id: Iafafa4c1362bbd1940f8e4fb979f72feae3ec3ad
Reviewed-on: https://go-review.googlesource.com/3000
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-20 18:15:06 +00:00
Russ Cox
b2cdf30eb6 [dev.cc] runtime: convert scheduler from C to Go
The conversion was done with an automated tool and then
modified only as necessary to make it compile and run.

[This CL is part of the removal of C code from package runtime.
See golang.org/s/dev.cc for an overview.]

LGTM=r
R=r, daniel.morsing
CC=austin, dvyukov, golang-codereviews, iant, khr
https://golang.org/cl/172260043
2014-11-11 17:08:33 -05:00
Dmitriy Vyukov
f4de59e234 runtime/pprof: fix memory profiler test
Don't use cmd/pprof as it is not necessary installed
and does not work on nacl and plan9.
Instead just look at the raw profile.

LGTM=crawshaw, rsc
R=golang-codereviews, crawshaw, 0intro, rsc
CC=golang-codereviews
https://golang.org/cl/159010043
2014-10-17 21:28:47 +04:00
Russ Cox
fb173c4185 runtime/pprof: fix test
gogo called from GC is okay
for the same reasons that
gogo called from System or ExternalCode is okay.
All three are fake stack traces.

Fixes #8408.

LGTM=dvyukov, r
R=r, dvyukov
CC=golang-codereviews
https://golang.org/cl/152580043
2014-10-17 11:23:15 -04:00
Russ Cox
25f79b9dbe runtime/pprof: disable new memory test
It cannot run 'go tool pprof'. There is no guarantee that's installed.
It needs to build a temporary pprof binary and run that.
It also needs to skip the test on systems that can't build and
run binaries, namely android and nacl.

See src/cmd/nm/nm_test.go's TestNM for a template.

Update #8867
Status: Accepted

TBR=dvyukov
CC=golang-codereviews
https://golang.org/cl/153710043
2014-10-16 14:58:11 -04:00
Dmitriy Vyukov
8f47c837fd runtime: fix memory profiler
There are 3 issues:
1. Skip argument of callers is off by 3,
so that all allocations are deep inside of memory profiler.
2. Memory profiling statistics are not updated after runtime.GC.
3. Testing package does not update memory profiling statistics
before capturing the profile.
Also add an end-to-end test.
Fixes #8867.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/148710043
2014-10-16 22:11:26 +04:00
Alex Brainman
d72029e3a3 undo CL 140110043 / 17b5fc2aa130
I have found better approach, then longer wait.
See CL 134360043 for details.

««« original CL description
runtime/pprof: adjust cpuHogger so that tests pass on windows builders

LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/140110043

»»»

LGTM=dave
R=golang-codereviews, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/133500043
2014-09-09 16:05:00 +10:00
Russ Cox
c007ce824d build: move package sources from src/pkg to src
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
2014-09-08 00:08:51 -04:00