Xref visualization

Gerd Flaig <>
Tue Mar 2 13:55:37 CET 2004


Peter Olin <> writes:

> I'm trying to understand the dependencies between a bunch of modules
> that someone else wrote. The new xref tool looks good, but I can't
> find any tool for visualizing the dependendcies between
> modules/functions. As I recall it, there used to exist a thing that
> showed arrows and such.
>
> Do you know of any such tool?

some time ago, I used dotty to visualize the data, like this:

%%% File    : doc.erl
%%% Author  : Gerd Flaig <>
%%% Description : Generate some documentation
%%% Created : 30 Oct 2003 by Gerd Flaig <>

-module(doc).

-export([do/0, graph/1]).

do() ->
    xref:start(a),
    lists:foreach(fun add_app/1, [support, logger, mplex, fax, rc_callout,
				  confer, status]).

add_app(AppName) ->
    io:format("Adding ~s~n", [AppName]),
    xref:add_application(a, atom_to_list(AppName)).

graph(Filename) ->
    {ok, E} = xref:q(a, "AE"),
    Header = "digraph world {\n",
    F = fun({A,B}) ->
		atom_to_list(A) ++ " -> " ++ atom_to_list(B) ++ ";\n"
	end,
    Edges = lists:concat(lists:map(F, E)),
    Trailer = "}\n",
    file:write_file(Filename, list_to_binary(Header ++ Edges ++ Trailer)).


HTH.

        Goodbyte, Gerd.
-- 
Gerd Flaig                     Technik                
Bei Schlund + Partner AG       Brauerstraße 48      D-76135 Karlsruhe
 Physics is like sex: sure, it may give some practical results,
 but that's not why we do it. -- Richard Feynman



More information about the erlang-questions mailing list