This fixes a bug introduced in #341 which caused the browser
opening code to be disabled for the standard `pprof -http`
invocation.
Introduce a proper getter on the UI which determines whether
the browser ought to be opened.
* Avoid opening browser when not in terminal
This also reverts e82ee9a, though only in spirit since the revert
did not apply cleanly.
This change may look cosmetic, but note that `plugin.UI` can be
passed in from the outside. This is important for embedding pprof
into an application for easy access to the web ui: with this change,
such an application can pass a non-Terminal `profile.UI` and avoids
the browser code.
* Allow passing in a custom HTTPServer
This allows embedding the pprof ui into an existing application.
See https://github.com/cockroachdb/cockroach/pull/24145 for an example.
internal/driver: fix new unkeyed composite lit vet warnings (#298)
The current version of go vet does not flag these as noted in
golang/go#23539. A fix is in the works, and will likely be included in
Go 1.11. Make the updated vet tool happy, so that the vendored copy of
pprof in the Go tree can be updated and make the vet trybot happy.
Fixes #297.
weblist output disassembly now contains inlined source. (#235)
weblist output disassembly now contains inlined source.
In addition, fixed the line number assigned to instructions from inlined calls.
As an illustration, see the before and after output for a "pprof -weblist" command for a simple function:
[before](https://ghemawat.github.io/scratch/tmp/list1.html)
[after](https://ghemawat.github.io/scratch/tmp/list2.html)
Note that in the "before" page, the 7.26 second line cannot be expanded, but in the "after" page clicking on it reveals a wealth of information.
Replaced http wrapper field in plugin Options with HTTPServer. (#229)
Replaced http wrapper field in plugin Options with HTTPServer.
HTTPServer allows somebody embedding pprof to control how the
hosting HTTP server is constructed which makes pprof work in
more environments.
* Make top table sortable.
* Recompute Sum% column contents after sorting.
* Cleanups identified during review.
* Simplify top table sorting by generating it in Javascript.
Use common header for remaining web views (source code, disassembly, peek) (#214)
Use common header for remaining web views (source code, disassembly, peek).
Details:
* Made it easier to reuse css, javascript, etc. across views.
* Added two new templates: sourcelisting, plaintext.
* Use new templates for showing source code, disassembly, peek.
* Merged Functions menu into View menu.
* View change menu entries are now always enabled.
* Removed now unused "newWindow" argument to navigate.
* Removed redundancy in web handlers.
* Renamed /weblist URL to /source.
* Assembly and source code listings are now limited to 500 functions
sorted by decreasing flat value (to prevent huge delays when
selecting asm/source view across the entire profile).
Extend web UI to contain a tabular "top" display (#194)
* Split template into multiple defined templates for ease of sharing.
* Add a menu bar at the top and tie all buttons to it.
* Add top view.
* Handle top table clicks.
* Handle regexp based selection of top entries.
* Added test for /top view.
* Reduced code duplication between / and /top handlers.
* Add Refine menu to Top view as well.
Details:
* Pass base URL to web page.
* Use base URL in navigate() to stay in same view.
* Change Reset to stay in same view.
* Handled review comments + increased top display from 50 to 500 rows:
* Moved "inline" indicator to separate column of top display.
* Moved "Reset" button to "Refine" menu.
* Simplified some Javascript.
* Handle all meta characters in quotemeta.
* Removed unnecessary css "display: inline" from closedetails.
Signed-off-by: Sanjay Ghemawat <sanjay@alum.mit.edu>
Detailed list of changes:
* Since the list of actions is now long, move it into
an action box that is displayed only when applicable.
* Display help messages when hovering over action buttons.
* Hitting return in the search box invokes "focus" action.
* Cleaned up stale css entries.
I have attached one of the resulting pages to see what things look like easily. It is static, so won't allow navigation to other pages, but should be interactive enough.
[benchcpu.zip](https://github.com/google/pprof/files/1151238/benchcpu.zip)
* Allow -http to accept host:port
* Add serveWebInterface tests.
* Make sure serveWebInterface is serving on the URL.
* Avoid nil pointer dereference
* Simplify the -http flag test.
* Use the right capitalization for hostport.
* Fix the double escaping in regexps.
* Address review comments.
* Added an interactive web interface triggered by passing -http=port
on the command line. The interface is available by visiting
localhost:port in a browser.
Requirements:
* Graphviz must be installed.
* Browser must support Javascript.
* Tested in recent stable versions of chrome and firefox.
Features:
* The entry point is a dot graph display (equivalent to "web" output).
* Nodes in the graph can be selected by clicking.
* A regular expression can also be typed in for selection.
* The current selection (either list of nodes or a regexp)
can be focused, ignored, or hidden.
* Source code or disassembly of the current selection can be displayed.
* Remove unused function.
* Skip graph generation test if graphviz is not installed.
* Added -http port and the various modes of using pprof to the
usage message.
* Web interface now supports "show" option.
* Web interface automatically opens the browser pointed at
the page corresponding to command line arguments.
* Some tweaks for firefox.
* Handle review comments (better usage message, more testing).
* Handled review comments:
1. Capture and display errors like "Focus expression matched no samples".
2. Re-ordered buttons to match other interfaces.
3. Use UI.PrintErr to print error messages.
* Handle javascript code review comments (a bunch of cleanups).
Also added pprof binary to .gitignore.