[erlang-questions] How is graph like this generated?

Hynek Vychodil vychodil.hynek@REDACTED
Fri Jul 24 13:43:18 CEST 2015


There is example in official documentation showing graph generation without
involving internal erlang tracing in tutorial
http://www.erlang.org/doc/apps/et/et_tutorial.html

-module(et_display_demo).

-export([test/0]).

test() ->
    {ok, Viewer} = et_viewer:start([{title,"Coffee Order"},
{max_actors,10}]),
    Drink = {drink,iced_chai_latte},
    Size = {size,grande},
    Milk = {milk,whole},
    Flavor = {flavor,vanilla},
    C = et_viewer:get_collector_pid(Viewer),

et_collector:report_event(C,99,customer,barrista1,place_order,[Drink,Size,Milk,Flavor]),

et_collector:report_event(C,80,barrista1,register,enter_order,[Drink,Size,Flavor]),
    et_collector:report_event(C,80,register,barrista1,give_total,"$5"),

et_collector:report_event(C,80,barrista1,barrista1,get_cup,[Drink,Size]),
    et_collector:report_event(C,80,barrista1,barrista2,give_cup,[]),
    et_collector:report_event(C,90,barrista1,customer,request_money,"$5"),
    et_collector:report_event(C,90,customer,barrista1,pay_money,"$5"),
    et_collector:report_event(C,80,barrista2,barrista2,get_chai_mix,[]),
    et_collector:report_event(C,80,barrista2,barrista2,add_flavor,[Flavor]),
    et_collector:report_event(C,80,barrista2,barrista2,add_milk,[Milk]),
    et_collector:report_event(C,80,barrista2,barrista2,add_ice,[]),
    et_collector:report_event(C,80,barrista2,barrista2,swirl,[]),

et_collector:report_event(C,80,barrista2,customer,give_tasty_beverage,[Drink,Size]),
    ok.

I think it is a pretty descriptive demo.

Cheers!
H.

On Fri, Jul 24, 2015 at 12:46 PM, Fernando 'Brujo' Benavides <
fernando.benavides@REDACTED> wrote:

> Based on that great example, and the easter egg I recently found
> (et:phone_home/4,5), I created this example module:
> https://github.com/elbrujohalcon/witchcraft/blob/master/src/ufo.erl
>
> To see it in action, do…
> 1> ufo:start().
> 2> ufo:run().
>
> You will see stuff like this going around:
> http://g.recordit.co/9KvFR7FRqN.gif
>
> Cheers!
>
> [image: --]
> Fernando "Brujo" Benavides
> [image: http://]about.me/elbrujohalcon
> <http://about.me/elbrujohalcon?promo=email_sig>
>
>
>
>
> On Jul 24, 2015, at 06:13, Jesper Louis Andersen <
> jesper.louis.andersen@REDACTED> wrote:
>
>
> On Fri, Jul 24, 2015 at 9:54 AM, Leo Liu <sdl.web@REDACTED> wrote:
>
>> I wonder how those graphs are generated? Thanks.
>
>
> I think those graphs are generated by a tool. Either manually, or
> automatically. The have many names, one of which is "Sequence Diagrams" and
> another one being "Message Sequence Chart (MSC)". Usually there is specific
> meaning attached to different shapes in them, but the general rule is that
> time flows downwards and you can see the interaction between several agents.
>
> In Erlang, we have a tool for generating these, which is the `et`
> application (short for event tracer). It allows you to add dummy function
> calls into your application and then record what the application is doing,
> automatically generating a diagram for you. My post is somewhat old, but I
> still think it is applicable:
>
>
> http://jlouisramblings.blogspot.dk/2011/10/using-event-tracer-tool-set-in-erlang.html
>
> That way, you can build diagrams automatically by attaching trace probes
> to the report_event function.
>
>
>
> --
> J.
>  _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150724/c5ceb59b/attachment.htm>


More information about the erlang-questions mailing list