Import the github.com/google/pprof and github.com/ianlancetaylor/demangle
packages, without modification.
Build the golang version of pprof from cmd/pprof/pprof.go
by importing the packages from src/cmd/vendot/github.com/google/pprof
The versions upstreamed are:
github.com/ianlancetaylor/demangle 4883227f66371e02c4948937d3e2be1664d9be38
github.com/google/pprof 7eb5ba977f28f2ad8dd5f6bb82cc9b454e123cdc
Update misc/nacl/testzip.proto for new tests.
Change-Id: I076584856491353607a3b98b67d0ca6838be50d6
Reviewed-on: https://go-review.googlesource.com/36798
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Updates Profile and Trace handlers to reject requests for durations >=
WriteTimeout.
Modifies go tool pprof to print the body of the http response when
status != 200.
Fixes#18755
Change-Id: I6faed21685693caf39f315f003039538114937b0
Reviewed-on: https://go-review.googlesource.com/35564
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Previous changes started using the full filename for object files
on graph nodes, instead of just the file basename. The basename
was still being used when selecting mappings to disassemble for
weblist and disasm commands, causing a mismatch.
This fixes#18385. It was already fixed on the upstream pprof.
Change-Id: I1664503634f2c8cd31743561301631f12c4949c9
Reviewed-on: https://go-review.googlesource.com/34665
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Search the sample types in the profile being processed to map
sample type options to indices in the profile sample type array.
Previously these were hardcoded, which caused issues when the
sample types for a profile type changed. For instance, this was
triggered by the native generation of profiles in profile.proto
format.
This fixes#18230. A similar mechanism already exists on the upstream
pprof.
Change-Id: I945d8d842a0c2ca14299dabefe83124746ecd7e2
Reviewed-on: https://go-review.googlesource.com/34382
Reviewed-by: Michael Matloob <matloob@golang.org>
Some commands generate binary outputs which are not human readable.
In interactive mode, there are no use-cases for such outputs.
Instead, the new code writes it to the temporary file on the $CWD and
shows the file name. So the user can use any program to display the
file outside interactive shell.
Fixes#17465
Change-Id: I5c479db26017607f7a28eafbff2385533e5c584e
Reviewed-on: https://go-review.googlesource.com/31123
Reviewed-by: Russ Cox <rsc@golang.org>
The original go tool pprof (written in Perl) got this right.
The Go rewrite never has, but should.
Change-Id: Ie1fc571214c61b1b5654a0bc90e15eb889adf059
Reviewed-on: https://go-review.googlesource.com/32617
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
CL 21870 moved the entire cmd/pprof/internal directory to cmd/internal/pprof
for use by cmd/trace, but really cmd/trace only needed cmd/pprof/internal/profile,
which became cmd/internal/pprof/profile, and then internal/pprof/profile.
Move the rest back under cmd/pprof so that it is clear that no other code
is reaching into the guts of cmd/pprof. Just like functions should not be
exported unless necessary, internals should not be made visible to more
code than necessary.
Raúl Silvera noted after the commit of CL 21870 that only the profile package
should have moved, but there was no followup fix (until now).
Change-Id: I603f4dcb0616df1e5d5eb7372e6fccda57e05079
Reviewed-on: https://go-review.googlesource.com/32453
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This allows both the runtime and the cmd/pprof code to use the package,
just like we do for internal/trace.
Change-Id: I7606977284e1def36c9647354c58e7c1e93dba6b
Reviewed-on: https://go-review.googlesource.com/32452
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Update goobj reader so it can provide all the information
necessary to disassemble .o (and .a) files.
Grab architecture of .o files from header.
.o files have relocations in them. This CL also contains a simple
mechanism to disassemble relocations and add relocation info as an extra
column in the output.
Fixes#13862
Change-Id: I608fd253ff1522ea47f18be650b38d528dae9054
Reviewed-on: https://go-review.googlesource.com/24818
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
If we are using a remote source (a URL), and the user did not specify
the executable file to use, then don't try to use a local source.
This was misbehaving because the local symbolizer will not fail
if there is any memory map available, but the presence of a memory map
does not ensure that the files and symbols are actually available.
We still need a pprof testsuite.
Fixes#16159.
Change-Id: I0250082a4d5181c7babc7eeec6bc95b2f3bcaec9
Reviewed-on: https://go-review.googlesource.com/24464
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Handling a symbol with address 0 and size 0, such as an ELF STT_FILE
symbols, was causing us to disassemble the entire program. We started
adding STT_FILE symbols to help fix issue #13247.
Fixes#16154.
Change-Id: I174b9614e66ddc3d65801f7c1af7650f291ac2af
Reviewed-on: https://go-review.googlesource.com/24460
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
The test is in the runtime package because there are other tests of
pprof there. At some point we should probably move them all into a pprof
testsuite.
Fixes#16128.
Change-Id: Ieefa40c61cf3edde11fe0cf04da1debfd8b3d7c0
Reviewed-on: https://go-review.googlesource.com/24274
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
In order to support pprof for position independent executables, pprof
needs to adjust the PC addresses stored in the profile by the address at
which the program is loaded. The legacy profiling support which we use
already supports recording the GNU/Linux /proc/self/maps data
immediately after the CPU samples, so do that. Also change the pprof
symbolizer to use the information, if available, when looking up
addresses in the Go pcline data.
Fixes#15714.
Change-Id: I4bf679210ef7c51d85cf873c968ce82db8898e3e
Reviewed-on: https://go-review.googlesource.com/23525
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Make internal pprof packages available to cmd/trace.
cmd/trace needs access to them to generate symbolized
svg profiles (create and serialize Profile struct).
And potentially generate svg programmatically instead
of invoking go tool pprof.
Change-Id: Iafd0c87ffdd4ddc081093be0b39761f19507907a
Reviewed-on: https://go-review.googlesource.com/21870
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Test to follow in a separate CL that arranges for the runtime package to
store non-Go addresses in a CPU profile.
Change-Id: I33ce1d66b77340b1e62b54505fc9b1abcec108a9
Reviewed-on: https://go-review.googlesource.com/21055
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Packed encoding is the default on the proto3 format. Profiles generated
in the profile.proto format by third parties cannot be decoded by the
Go pprof tool, since its proto decoder does not recognize packed
encoding for repeated fields.
In particular this issue prevents go tool pprof from reading profiles
generated by the version of pprof in github.com/google/pprof
Profiles generated by go tool pprof after this change will use packed
repeating fields, so older versions of pprof will not be able to read
them. pprof will continue to be able to read profiles generated before
this change.
Change-Id: Ife0b353a535ae1e495515b9bcec588dd967e171b
Reviewed-on: https://go-review.googlesource.com/21240
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>
This change removes a lot of dead code. Some of the code has never been
used, not even when it was first commited. The rest shouldn't have
survived refactors.
This change doesn't remove unused routines helpful for debugging, nor
does it remove code that's used in commented out blocks of code that are
only unused temporarily. Furthermore, unused constants weren't removed
when they were part of a set of constants from specifications.
One noteworthy omission from this CL are about 1000 lines of unused code
in cmd/fix, 700 lines of which are the typechecker, which hasn't been
used ever since the pre-Go 1 fixes have been removed. I wasn't sure if
this code should stick around for future uses of cmd/fix or be culled as
well.
Change-Id: Ib714bc7e487edc11ad23ba1c3222d1fd02e4a549
Reviewed-on: https://go-review.googlesource.com/20926
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions. This means contributors won't be confused by
misleading precedence.
This CL doesn't use go/doc to parse. It only addresses // comments.
It was generated with:
$ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])')
$ go test go/doc -update
Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
Reviewed-on: https://go-review.googlesource.com/20022
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This is a subset of https://golang.org/cl/20022 with only the copyright
header lines, so the next CL will be smaller and more reviewable.
Go policy has been single space after periods in comments for some time.
The copyright header template at:
https://golang.org/doc/contribute.html#copyright
also uses a single space.
Make them all consistent.
Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0
Reviewed-on: https://go-review.googlesource.com/20111
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Set the status code in case of error.
Fixes#11510
Change-Id: If461c30a1f6d2275539f33a2eabd7b19bbfa411d
Reviewed-on: https://go-review.googlesource.com/16718
Reviewed-by: Russ Cox <rsc@golang.org>
The previous commit (git 2ae77376) just did golang.org. This one
includes golang.org subdomains like blog, play, and build.
Change-Id: I4469f7b307ae2a12ea89323422044e604c5133ae
Reviewed-on: https://go-review.googlesource.com/12071
Reviewed-by: Rob Pike <r@golang.org>
These were found by grepping the comments from the go code and feeding
the output to aspell.
Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This flag no longer exists. It has been replaced with -unit=byte.
Change-Id: Iff9fc501f2c666067c9b1948c4623c8e3adddb8d
Reviewed-on: https://go-review.googlesource.com/1287
Reviewed-by: Russ Cox <rsc@golang.org>
While we're at there, also add a message to prompt the user to install
Graphviz if "dot" command is not found.
Fixes#9178.
LGTM=adg, alex.brainman, cookieo9, rsc
R=rsc, adg, bradfitz, alex.brainman, cookieo9, smyrman
CC=golang-codereviews
https://golang.org/cl/180380043
getFunctionSource gathers five lines of "margin" around every
requested sample line. However, if this margin went past the
end of the source file, getFunctionSource would encounter an
io.EOF error and abort with this error, resulting in listings
like
(pprof) list main.main
ROUTINE ======================== main.main in ...
0 8.33s (flat, cum) 99.17% of Total
Error: EOF
(pprof)
Modify the error handling in getFunctionSource so io.EOF is
always considered non-fatal. If it reaches EOF, it simply
returns the lines it has.
LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/172600043
Moving so that new Go 1.4 pprof can use it.
The old 'GNU objdump workalike' mode for 'go tool objdump'
is now gone, as are the tests for that mode. It was used only
by pre-Go 1.4 pprof. You can still specify an address range on
the command line; you just get the same output format as
you do when dumping the entire binary (without an address
limitation).
LGTM=r
R=r
CC=golang-codereviews, iant
https://golang.org/cl/167320043
Update #8798
This is a new implementation of pprof,
written in Go instead of in Perl.
It was written primarily by Raul Silvera and
is in use for profiling programs of all languages
inside Google.
The internal structure is a bit package-heavy,
but it matches the copy used inside Google, and
since it is in an internal directory, we can make
changes to it later if we need to.
The only "new" file here is src/cmd/pprof/pprof.go,
which stitches together the Google pprof and the
Go command libraries for object file access.
I am explicitly NOT interested in style or review
comments on the rest of the files
(that is, src/cmd/pprof/internal/...).
Those are intended to stay as close to the Google
copies as possible, like we did with the pprof Perl script.
Still to do:
- Basic tests.
- Real command documentation.
- Hook up disassemblers.
LGTM=r
R=r, bradfitz, alex.brainman, dave
CC=golang-codereviews
https://golang.org/cl/153750043