Visualizing golang.org/x/cmd/callgraph output?

970 views
Skip to first unread message

Matt Joiner

unread,
May 29, 2015, 12:07:47 AM5/29/15
to golan...@googlegroups.com
golang.org/x/cmd/callgraph outputs the callgraph of a program in text. What can I use to get a visual representation of this?

minux

unread,
May 29, 2015, 1:16:07 AM5/29/15
to Matt Joiner, golang-nuts
On Fri, May 29, 2015 at 12:07 AM, Matt Joiner <anac...@gmail.com> wrote:
golang.org/x/cmd/callgraph outputs the callgraph of a program in text. What can I use to get a visual representation of this?


You can use -format graphviz to generate input for the dot
processor in GraphViz.

Example:
callgraph -format graphviz import/path | dot -Tpdf > output.pdf

adon...@google.com

unread,
May 29, 2015, 2:08:21 PM5/29/15
to golan...@googlegroups.com, anac...@gmail.com
Graphviz doesn't scale very well to graphs of more than about 100 nodes.  An alternative visualization is an infinite tree; you can see an example if you run 'godoc -http :8000 -analysis=pointer' and expand the "call graph" widget in the package documentation.  This particular viewer only expands intra-package edges.  I suppose it could be easily extended to view the entire call graph.

There are various graph databases out there, many of which have sophisticated visualizations.  You could try neo4j.

Matt Joiner

unread,
May 30, 2015, 12:24:03 AM5/30/15
to adon...@google.com, golang-nuts
Thanks very much Alan.

Damian Gryski

unread,
May 30, 2015, 3:39:59 AM5/30/15
to golan...@googlegroups.com

matt

unread,
May 30, 2015, 8:22:04 AM5/30/15
to golan...@googlegroups.com

Matt Joiner

unread,
May 30, 2015, 10:30:45 AM5/30/15
to matt, golang-nuts
Both of these look like terrible ways to represent the callgraph. Cayley just seems to put the command-line into the browser for a single use case. Very confusing.

On 30 May 2015 at 22:22, matt <matthew....@gmail.com> wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/ZVhpLUBghB8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

matt

unread,
May 30, 2015, 1:40:16 PM5/30/15
to golan...@googlegroups.com
Matt, I thought you were asking for suggestions. For what purpose do you want to show the call graphs?

Matt Joiner

unread,
May 30, 2015, 11:17:03 PM5/30/15
to matt, golang-nuts
You are right. I wonder what other people are using the callgraphs for. In particular I want to identify any cycles, and determine unique call chains that arrive at a particular function.

On 31 May 2015 at 03:40, matt <matthew....@gmail.com> wrote:
Matt, I thought you were asking for suggestions. For what purpose do you want to show the call graphs?
Reply all
Reply to author
Forward
0 new messages