Previously, the web UI was hard-coded to be served at `/` but
applications which are *embedding* the ui are unlikely to host it there.
This change makes the links between the various ui pages relative,
addressing this problem.
To make sure this doesn't rot, the internal http server now serves the
ui at /ui/ (redirecting there from the root).
I think we can all agree that the ui code and JavaScript is kind of a
haphazard affair. I performed a great deal of clicking around to make
sure the semantics didn't change and interestingly spent some time
trying to fix semantics I later realized weren't actually there: I
thought that when navigating to another page from a focused search (say
`flamegraph?f=x`) the focus would be carried over. This doesn't seem to
be the case, however.
The point being, there's no test coverage and setting it up is way
beyond what I can do here. I'm happy to manually verify whatever
sequence of clicks is suggested, though.
Touches https://github.com/cockroachdb/cockroach/pull/24145.
Keep refine menu enabled for views other than graph. (#286)
Pull request #263 disabled the refine menu for any views other than
Graph, but that's not expected - it's perfectly fine to use it for Flame
and Top, so just keep it enabled.
Fixes #285.
Update the web user interface aesthetically (#263)
Update the web user interface aesthetically.
The Refine menu is greyed-out for pages besides the Graph.
The description box now opens upon clicking the filename in the top-right.
* Show menu on click, not hover.
Previously, users had to be careful to not move the mouse
outside the menu (otherwise it would disappear unintentionally).
Also fixed a minor bug where we were not overwriting URL
parameters correctly when no selection was made.
* Use vendor prefixes for user-select.
* Make top table sortable.
* Recompute Sum% column contents after sorting.
* Cleanups identified during review.
* Simplify top table sorting by generating it in Javascript.
* Change menu buttons to links.
This allows right-click/middle-click etc. to work properly.
* Clean up javascript in response to review comments.
Also fix error in handling of Enter key.
* Simplify regular expression construction from selection.
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)
* 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.