Add support for saving the current configuration settings (#535)
Add support for saving the current configuration settings as a named
configuration and reloading such a configuration later.
All of the configurations are stored in a settings file, by default:
~/.config/pprof.json
A struct named config replaces the old map[string]string which used
to store the set of configurable options. Instead, each option is
now a field in the config struct.
The UI now has a new 'Config' menu with
Save as: prompts for a name and saves current config.
Default: applies default config.
$X: for every config named X: applies settings from X.
The currently selected config is highlighted.
Every named config has a delete button to control deletion.
Some semi-related changes:
1. Both filefunctions and functions in the granularity group had an
initial value of true, which is incorrect since these are mutually
incompatible choices. Set filefunctions' initial value to false.
2. Renamed the group for sorting from "cumulative" to "sort".
3. Store testing.T in TestUI instead of leaving the field nil.
internal/driver: skip tests requiring tcp on js (#373)
This commit upstreams the changes made in golang.org/cl/110096. As the
change says, it is acceptable for the new js/wasm target to only support
what nacl supports right now.
Switch to use goroutine profile in TestHttpsInsecure. (#350)
Trying to test against /debug/pprof/profile has been giving some flakes
and trouble so far (#146, #253, #328, golang/go#24611, golang/go#22594). While
some of the discussions the failures triggered appear to be useful (such
as whether CPU profiles are expected to be working on Windows XP or
not), that kind of testing is not really in the scope for this
particular test. This change switches the test to use goroutine profile
instead which is hopefully much less dependent on the environment. The
change also makes the test much faster to run.
internal/driver: ignore temp dir error on Android (#295)
On an instance of the Android emulator running x86_64, $HOME points
to / which is not writable. Add Android to the list of GOOS where
the temp dir error is skipped.
Fixes the android/amd64 and android/386 builders on build.golang.org.
* Handle "listen hungup" error on Plan 9 in TestHttpsInsecure
Plan 9 returns the "listen hungup" error when closing a closed listener.
See https://github.com/0intro/plan9/blob/4225c3e/sys/src/9/ip/devip.c#L476
Fixes #253.
* Handle empty profile on Plan 9 in TestHttpsInsecure
CPU profiling isn't implemented on Plan 9.
See golang.org/issues/22564.
Fixes #253.
* Add support for tag units
Updated tests for adding tag units
* updated proto docs to describe tag units
* fixed formatting
* added additional test
* require specific units for graph tag to be recognixed
* updated tests and formatting
* Fixed formatting
* Fixed style error
* modify proto_test to be sure tag units not overwritten
* Clarified label docs
* call legacy profile memory allocations size, not byte
* updated tests to call bytes tags in legacy profile size
* Revert "updated tests to call bytes tags in legacy profile size"
This reverts commit 9289378af2.
* Revert "call legacy profile memory allocations size, not byte"
This reverts commit 6b18973562.
* Updated so units not modified when profile written out
* Fixed formatting errors
* Removed field for inferred numeric label units from profile
* Modified profile String() output
* fixed formatting error
* changed name of function used to identify units for numeric labels
* Refactor String() for profile
* Modified for clarity and address comments
* renamed function for clarity
* Made numeric label units field seperate in profile
* Modified test
* Refactored identifyNumLabelUnits()
* Updated comments
* Fixed formatting error
* Addressed comments
* Fixed style error
* clarify comment
* Refactored to address comments
* addressed comments
* addressed comments
* addressed comments
Make TestHttpsInsecure test reliably passing on Darwin. (#171)
* Make TestHttpsInsecure test reliably passing on Darwin.
TestHttpsInsecure test runs a profiling session and checks that the
results contain expected function name. On OSX prior to 10.11 El Capitan
the SIGPROF signal is delivered to the process rather than to the thread
which skews the results enough for the test to fail.
Relax the check when running on OSX and other operating systems known to
have issues with the profiling signal (the list is taken from
src/runtime/pprof/pprof_test.go in Go source).
Also add the multiple variants of OSX to the continuous testing.
Fixes #146 and #156.
* Document the motivation for the empty loop.
Create a fake mapping for profile.proto profiles (#135)
* Create a fake mapping for profile.proto profiles
If a profile has mappings but no profiles, pprof may be unable to
symbolize it offline, as it uses the mappings to keep track of which
locations need symbolization.
This fixes #120.
Added the test, verified it fails on Mac with Go 1.7 before the fix, and
passes with the fix. The test is done by augmenting the existing test
for handling https+insecure:// schema in URLs. This is a bit vague but I
figured that this test needed an updated anyway since as we moved it
recently we stopped exercising the symbolization as part of the test
which was its original intention in fixing #94. Can split the tests if
things do look too ugly.
* Fix the test to include the failed regex matching error in the message.
Use a more regular mechanism to name sources during driver tests and
recognize the naming during fetching to avoid saving the test profiles
into $HOME/pprof.
Also move the https+insecure testing into fetch_test, to focus it on
fetching the profile.
This fixes #107
In changeset f90721db3d, fetch.go was changed to handle
the correct home directory environment variable on Plan 9
and Windows, but the tests were still using the $HOME
environment variable.
We change the tests to use the homeEnv function instead
of the $HOME environment variable.
Fixes #100.
Allow binary override for profiles with no mappings (#89)
The go runtime generates profiles in profile.proto format
without symbols or mappings. The expectation is that these
can be symbolized by passing the binary name to pprof.
The mechanism pprof uses relies to override the binary relies
on there being a mapping, and previously we moved the creation
of fake mappings to the legacy profile handlers, so profiles
parsed from profile.proto with no mappings can no longer be
symbolized.
Special case this situation to create a fake mapping and associate
all locations to it if there is a command line override but no
mappings.
Reset mapping file to empty string if it was patched to be the source URL.
When the source is remote and a mapping doesn't have either build ID or
file field set, the file field is set to the source URL so that the
proper source from the source mapping is used during symbolz processing.
Before this change, the file field would continue to point to the URL
producing the URL in pprof output which confuses users.
With the change it resets the file field back to the empty string. It
also now skips the URL-like paths during local symbolization as
reading at that path is not going to succeed.
We discussed switching to generating more unique IDs. On the second
thought, I propose leaving these to be URLs as that seems unique enough
and in case this field leaks into the tool or log output seeing the URL
seems still friendlier than some arbitrarily prefixed string.