Previously, web interface was assuming that the ith node in
the dot graph was being assigned the id "node<i+1>". However,
this assumption was invalid when extra nodes were inserted
into the dot output (e.g., nodelets added for allocation
profiles). Because of this bug, node selection by clicking
in the webui graph output would sometimes pick a random
string to match against.
The problem is now fixed by manually assigning an id to
every node in the generated dot graph. dot will propagate
this id reliably to the svg output.
Updated the golden tests to reflect the new dot output.
Extended dotgraph_test.go with an -update flag that can be
used to update golden files. Also removed a bunch of code
duplication in the test.
When generating a call tree, pprof was using a map to keep track of all the
inline nodes for a location. That is incorrect as it may cause inline functions
at different nesting levels to reuse the same node, causing the resulting graph
to not be a tree.
When creating a tree nodes with the same info may appear on multiple places
in the tree. Keeping one of them preserves them all, which may cause disconnected
nodes to remain. To ensure the resulting graph is a connected tree, do not include
children on any removed node, which is suitable for the normal tree refinement
(nodecount and nodefraction) but does not allow visual refinement, which may eliminate
intermediate nodes. Disable visual mode refinement for call_tree to avoid this issue.
When reconciling samples, cleanup file paths to allow functions to be
combined if their source filenames match after cleanup (eg "src.cpp" and
"./src.cpp").
Also clean up existing uses of filepath to avoid passing empty strings
to it: filepath.Base("") returns "."