diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/et/doc/src/et_desc.xmlsrc | 82 | ||||
-rw-r--r-- | lib/et/doc/src/et_examples.xmlsrc | 255 | ||||
-rw-r--r-- | lib/et/doc/src/et_tutorial.xmlsrc | 13 |
3 files changed, 162 insertions, 188 deletions
diff --git a/lib/et/doc/src/et_desc.xmlsrc b/lib/et/doc/src/et_desc.xmlsrc index 96a4a9df31..29e0ab1fe3 100644 --- a/lib/et/doc/src/et_desc.xmlsrc +++ b/lib/et/doc/src/et_desc.xmlsrc @@ -55,13 +55,12 @@ <p></p> <code type="none"><![CDATA[ - % erl -pa et/examples - Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] - [async-threads:0] [kernel-poll:false] +% erl -pa et/examples +Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] - Eshell V5.7.4 (abort with ^G) - 1> {ok, Viewer} = et_viewer:start([]). - {ok,<0.40.0>}]]></code> +Eshell V5.7.4 (abort with ^G) +1> {ok, Viewer} = et_viewer:start([]). +{ok,<0.40.0>}]]></code> <p>A <c>Viewer</c> gets trace <c>Events</c> from its <c>Collector</c> by polling it regularly for more <c>Events</c> to @@ -69,40 +68,38 @@ <c>Collector</c> with <c>et_collector:report_event/6</c>:</p> <code type="none"><![CDATA[ - 2> Collector = et_viewer:get_collector_pid(Viewer). - <0.39.0> - 3> et_collector:report_event(Collector, 60, my_shell, mnesia_tm, start_outer, - 3> "Start outer transaction"), - 3> et_collector:report_event(Collector, 40, mnesia_tm, my_shell, new_tid, - 3> "New transaction id is 4711"), - 3> et_collector:report_event(Collector, 20, my_shell, mnesia_locker, try_write_lock, - 3> "Acquire write lock for {my_tab, key}"), - 3> et_collector:report_event(Collector, 10, mnesia_locker, my_shell, granted, - 3> "You got the write lock for {my_tab, key}"), - 3> et_collector:report_event(Collector, 60, my_shell, do_commit, - 3> "Perform transaction commit"), - 3> et_collector:report_event(Collector, 40, my_shell, mnesia_locker, release_tid, - 3> "Release all locks for transaction 4711"), - 3> et_collector:report_event(Collector, 60, my_shell, mnesia_tm, delete_transaction, - 3> "End of outer transaction"), - 3> et_collector:report_event(Collector, 20, my_shell, end_outer, - 3> "Transaction returned {atomic, ok}"). - {ok,{table_handle,<0.39.0>,16402,trace_ts, - #Fun<et_collector.0.62831470>}}]]></code> +2> Collector = et_viewer:get_collector_pid(Viewer). +<0.39.0> +3> et_collector:report_event(Collector, 60, my_shell, mnesia_tm, start_outer, +3> "Start outer transaction"), +3> et_collector:report_event(Collector, 40, mnesia_tm, my_shell, new_tid, +3> "New transaction id is 4711"), +3> et_collector:report_event(Collector, 20, my_shell, mnesia_locker, try_write_lock, +3> "Acquire write lock for {my_tab, key}"), +3> et_collector:report_event(Collector, 10, mnesia_locker, my_shell, granted, +3> "You got the write lock for {my_tab, key}"), +3> et_collector:report_event(Collector, 60, my_shell, do_commit, +3> "Perform transaction commit"), +3> et_collector:report_event(Collector, 40, my_shell, mnesia_locker, release_tid, +3> "Release all locks for transaction 4711"), +3> et_collector:report_event(Collector, 60, my_shell, mnesia_tm, delete_transaction, +3> "End of outer transaction"), +3> et_collector:report_event(Collector, 20, my_shell, end_outer, +3> "Transaction returned {atomic, ok}"). +{ok,{table_handle,<0.39.0>,16402,trace_ts, + #Fun<et_collector.0.62831470>}}]]></code> <p>This actually is a simulation of the process <c>Events</c> caused by a <c>Mnesia</c> transaction that writes a record in a local table:</p> <code type="none"><![CDATA[ - mnesia:transaction(fun() -> mnesia:write({my_tab, key, val}) end).]]></code> +mnesia:transaction(fun() -> mnesia:write({my_tab, key, val}) end).]]></code> <p>At this stage when we have a couple of <c>Events</c>, it is time to show how it looks like in the graphical interface of <c>et_viewer</c>:</p> - <p></p> - <image file="sim_trans.png"> <icaption>A simulated Mnesia transaction which writes one record</icaption> </image> @@ -144,11 +141,11 @@ <p></p> <code type="none"><![CDATA[ - filter(TraceData) -> false | true | {true, NewEvent} +filter(TraceData) -> false | true | {true, NewEvent} - TraceData = Event | erlang_trace_data() - Event = #event{} - NewEvent = #event{}]]></code> +TraceData = Event | erlang_trace_data() +Event = #event{} +NewEvent = #event{}]]></code> <p>The interface of the filter function is the same as the the filter functions for the good old <c>lists:filtermap/2</c>. If the filter @@ -204,10 +201,10 @@ <p></p> <code type="none"><![CDATA[ - 4> Fun = fun(E) -> et_demo:mgr_actors(E) end. - #Fun<erl_eval.6.13229925> - 5> et_collector:dict_insert(Collector, {filter, mgr_actors}, Fun). - ok]]></code> +4> Fun = fun(E) -> et_demo:mgr_actors(E) end. +#Fun<erl_eval.6.13229925> +5> et_collector:dict_insert(Collector, {filter, mgr_actors}, Fun). +ok]]></code> <p>you will see that the <c>Filter</c> menu in all viewers have got a new entry called <c>mgr_actors</c>. Select it, and a new @@ -228,21 +225,16 @@ <c>Contents Viewer</c> window to pop up, showing the <c>Event</c> in the <c>mgr_actors</c> view:</p> - <p></p> - <image file="sim_trans_contents_viewer_mgr_actors.png"> - <icaption>The trace <c>Event</c> in the mgr_actors view</icaption> + <icaption>The trace Event in the mgr_actors view</icaption> </image> <p>Select the <c>all</c> entry in the <c>Filters</c> menu and a new <c>Contents Viewer window</c> will pop up showing the same trace <c>Event</c> in the collectors view:</p> - <p></p> - <image file="sim_trans_contents_viewer_collector.png"> - <icaption>The same trace <c>Event</c> in the collectors - view</icaption> + <icaption>The same trace Event in the collectors view</icaption> </image> </section> @@ -311,7 +303,7 @@ <c>et_collector</c> or <c>et_viewer</c> in order to activate the global tracing. There is no restriction on how many concurrent (anonymous) collectors you can have, but you can only have one - <b>global</b> <c>Collector</c> as its name is registered in + <em>global</em> <c>Collector</c> as its name is registered in <c>global</c>.</p> <p>In order to further simplify the tracing, you can make use of diff --git a/lib/et/doc/src/et_examples.xmlsrc b/lib/et/doc/src/et_examples.xmlsrc index 6f143a397e..f4d94f7cb0 100644 --- a/lib/et/doc/src/et_examples.xmlsrc +++ b/lib/et/doc/src/et_examples.xmlsrc @@ -55,34 +55,32 @@ <p></p> <code type="none"><![CDATA[ - mnesia:transaction(fun() -> mnesia:write({my_tab, key, val}) end).]]></code> +mnesia:transaction(fun() -> mnesia:write({my_tab, key, val}) end).]]></code> <p>And the viewer window will look like:</p> <p></p> <code type="none"><![CDATA[ - Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] - [async-threads:0] [kernel-poll:false] +Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] - Eshell V5.7.4 (abort with ^G) - 1> {ok, Viewer} = et_viewer:start([]). - {ok,<0.40.0>;} - 2> et_demo:sim_trans(). - {ok,{table_handle,<0.45.0>,24596,trace_ts, - #Fun<et_collector.0.62831470>}}]]></code> +Eshell V5.7.4 (abort with ^G) +1> {ok, Viewer} = et_viewer:start([]). +{ok,<0.40.0>;} +2> et_demo:sim_trans(). +{ok,{table_handle,<0.45.0>,24596,trace_ts, + #Fun<et_collector.0.62831470>}}]]></code> <p></p> <image file="sim_trans.png"> - <icaption>A simulated <c>Mnesia</c> transaction which writes one - record</icaption> + <icaption>A simulated Mnesia transaction which writes one record</icaption> </image> </section> <section> - <title>Some convenient functions used in the <c>Mnesia</c> transaction + <title>Some convenient functions used in the Mnesia transaction example</title> <p>The <c>module_as_actor</c> filter converts the <c>Event @@ -173,21 +171,19 @@ <p></p> <code type="none"><![CDATA[ - erl -pa ../examples - Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] - [async-threads:0] [kernel-poll:false] +erl -pa ../examples +Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] + [async-threads:0] [kernel-poll:false] - Eshell V5.7.4 (abort with ^G) - 1> et_demo:live_trans(). - {atomic,ok}]]></code> +Eshell V5.7.4 (abort with ^G) +1> et_demo:live_trans(). +{atomic,ok}]]></code> <p>Please, explore the different filters in order to see how the traced transaction can be seen from different point of views:</p> - <p></p> - <image file="live_trans.png"> - <icaption>A real <c>Mnesia</c> transaction which writes one record</icaption> + <icaption>A real Mnesia transaction which writes one record</icaption> </image> </section> @@ -215,20 +211,20 @@ <p></p> <code type="none"><![CDATA[ - -module(megaco_filter). - -export([start/0]). - - start() -> - Options = - [{event_order, event_ts}, - {scale, 3}, - {max_actors, infinity}, - {trace_pattern, {megaco, max}}, - {trace_global, true}, - {dict_insert, {filter, megaco_filter}, fun filter/1}, - {active_filter, megaco_filter}, - {title, "Megaco tracer - Erlang/OTP"}], - et_viewer:start(Options).]]></code> +-module(megaco_filter). +-export([start/0]). + +start() -> + Options = + [{event_order, event_ts}, + {scale, 3}, + {max_actors, infinity}, + {trace_pattern, {megaco, max}}, + {trace_global, true}, + {dict_insert, {filter, megaco_filter}, fun filter/1}, + {active_filter, megaco_filter}, + {title, "Megaco tracer - Erlang/OTP"}], + et_viewer:start(Options).]]></code> <p>First we start an Erlang node with a global <c>Collector</c> and its <c>Viewer</c>.</p> @@ -236,13 +232,12 @@ <p></p> <code type="none"><![CDATA[ - erl -sname observer - Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] - [async-threads:0] [kernel-poll:false] +erl -sname observer +Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] - Eshell V5.7.4 (abort with ^G) - (observer@falco)1> megaco_filter:start(). - {ok,<0.48.0>}]]></code> +Eshell V5.7.4 (abort with ^G) +(observer@falco)1> megaco_filter:start(). +{ok,<0.48.0>}]]></code> <p>Secondly we start another Erlang node which we connect the observer node, before we start the application that we want to @@ -253,28 +248,27 @@ <p></p> <code type="none"><![CDATA[ - erl -sname mgc -pa ../../megaco/examples/simple - Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] - [async-threads:0] [kernel-poll:false] - - Eshell V5.7.4 (abort with ^G) - (mgc@falco)1> net:ping(observer@falco). - pong - (mgc@falco)2> megaco:start(). - ok - (mgc@falco)3> megaco_simple_mgc:start(). - {ok,[{ok,2944, - {megaco_receive_handle,{deviceName,"controller"}, - megaco_pretty_text_encoder,[],megaco_tcp,dynamic}}, - {ok,2944, - {megaco_receive_handle,{deviceName,"controller"}, - megaco_pretty_text_encoder,[],megaco_udp,dynamic}}, - {ok,2945, - {megaco_receive_handle,{deviceName,"controller"}, - megaco_binary_encoder,[],megaco_tcp,dynamic}}, - {ok,2945, - {megaco_receive_handle,{deviceName,"controller"}, - megaco_binary_encoder,[],megaco_udp,dynamic}}]}]]></code> +erl -sname mgc -pa ../../megaco/examples/simple +Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] + +Eshell V5.7.4 (abort with ^G) +(mgc@falco)1> net:ping(observer@falco). +pong +(mgc@falco)2> megaco:start(). +ok +(mgc@falco)3> megaco_simple_mgc:start(). +{ok,[{ok,2944, + {megaco_receive_handle,{deviceName,"controller"}, + megaco_pretty_text_encoder,[],megaco_tcp,dynamic}}, + {ok,2944, + {megaco_receive_handle,{deviceName,"controller"}, + megaco_pretty_text_encoder,[],megaco_udp,dynamic}}, + {ok,2945, + {megaco_receive_handle,{deviceName,"controller"}, + megaco_binary_encoder,[],megaco_tcp,dynamic}}, + {ok,2945, + {megaco_receive_handle,{deviceName,"controller"}, + megaco_binary_encoder,[],megaco_udp,dynamic}}]}]]></code> <p>And finally we start an Erlang node for the Media Gateways and connect to the observer node. Each Media Gateway connects to the @@ -288,94 +282,87 @@ <p></p> <code type="none"><![CDATA[ - Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] - [async-threads:0] [kernel-poll:false] - - Eshell V5.7.4 (abort with ^G) - (mg@falco)1> net:ping(observer@falco). - pong - (mg@falco)2> megaco_simple_mg:start(). - [{{deviceName,"gateway_tt"}, - {error,{start_user,megaco_not_started}}}, - {{deviceName,"gateway_tb"}, - {error,{start_user,megaco_not_started}}}, - {{deviceName,"gateway_ut"}, - {error,{start_user,megaco_not_started}}}, - {{deviceName,"gateway_ub"}, - {error,{start_user,megaco_not_started}}}] - (mg@falco)3> megaco:start(). - ok - (mg@falco)4> megaco_simple_mg:start(). - [{{deviceName,"gateway_tt"}, - {1, - {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, - [{serviceChangeReply, - {'ServiceChangeReply', - [{megaco_term_id,false,["root"]}], - {serviceChangeResParms, - {'ServiceChangeResParm', - {deviceName,"controller"}, - asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, - asn1_NOVALUE}}}}]}]}}}, - {{deviceName,"gateway_tb"}, - {1, - {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, - [{serviceChangeReply, - {'ServiceChangeReply', - [{megaco_term_id,false,["root"]}], - {serviceChangeResParms, - {'ServiceChangeResParm', - {deviceName,"controller"}, - asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, - asn1_NOVALUE}}}}]}]}}}, - {{deviceName,"gateway_ut"}, - {1, - {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, - [{serviceChangeReply, - {'ServiceChangeReply', - [{megaco_term_id,false,["root"]}], - {serviceChangeResParms, - {'ServiceChangeResParm', - {deviceName,"controller"}, - asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, - asn1_NOVALUE}}}}]}]}}}, - {{deviceName,"gateway_ub"}, - {1, - {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, - [{serviceChangeReply, - {'ServiceChangeReply', - [{megaco_term_id,false,["root"]}], - {serviceChangeResParms, - {'ServiceChangeResParm', - {deviceName,"controller"}, - asn1_NOVALUE,asn1_NOVALUE, - asn1_NOVALUE,...}}}}]}]}}}]]]></code> +Erlang R13B03 (erts-5.7.4) [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false] + +Eshell V5.7.4 (abort with ^G) +(mg@falco)1> net:ping(observer@falco). +pong +(mg@falco)2> megaco_simple_mg:start(). +[{{deviceName,"gateway_tt"}, + {error,{start_user,megaco_not_started}}}, + {{deviceName,"gateway_tb"}, + {error,{start_user,megaco_not_started}}}, + {{deviceName,"gateway_ut"}, + {error,{start_user,megaco_not_started}}}, + {{deviceName,"gateway_ub"}, + {error,{start_user,megaco_not_started}}}] +(mg@falco)3> megaco:start(). +ok +(mg@falco)4> megaco_simple_mg:start(). +[{{deviceName,"gateway_tt"}, + {1, + {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, + [{serviceChangeReply, + {'ServiceChangeReply', + [{megaco_term_id,false,["root"]}], + {serviceChangeResParms, + {'ServiceChangeResParm', + {deviceName,"controller"}, + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, + asn1_NOVALUE}}}}]}]}}}, + {{deviceName,"gateway_tb"}, + {1, + {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, + [{serviceChangeReply, + {'ServiceChangeReply', + [{megaco_term_id,false,["root"]}], + {serviceChangeResParms, + {'ServiceChangeResParm', + {deviceName,"controller"}, + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, + asn1_NOVALUE}}}}]}]}}}, + {{deviceName,"gateway_ut"}, + {1, + {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, + [{serviceChangeReply, + {'ServiceChangeReply', + [{megaco_term_id,false,["root"]}], + {serviceChangeResParms, + {'ServiceChangeResParm', + {deviceName,"controller"}, + asn1_NOVALUE,asn1_NOVALUE,asn1_NOVALUE, + asn1_NOVALUE}}}}]}]}}}, + {{deviceName,"gateway_ub"}, + {1, + {ok,[{'ActionReply',0,asn1_NOVALUE,asn1_NOVALUE, + [{serviceChangeReply, + {'ServiceChangeReply', + [{megaco_term_id,false,["root"]}], + {serviceChangeResParms, + {'ServiceChangeResParm', + {deviceName,"controller"}, + asn1_NOVALUE,asn1_NOVALUE, + asn1_NOVALUE,...}}}}]}]}}}]]]></code> <p>The <c>Megaco</c> adopted viewer looks like this, when we have clicked - on the <b>[gateway_tt]</b> actor name in order to only display the events + on the <em>[gateway_tt]</em> actor name in order to only display the events regarding that actor:</p> - <p></p> - <image file="megaco_tracer.png"> <icaption>The viewer adopted for Megaco</icaption> </image> <p>A pretty printed <c>Megaco</c> message looks like this:</p> - <p></p> - <image file="megaco_filter.png"> - <icaption>A textual <c>Megaco</c> message</icaption> + <icaption>A textual Megaco message</icaption> </image> <p>And the corresponding internal form for the same <c>Megaco</c> message looks like this:</p> - <p></p> - <image file="megaco_collector.png"> - <icaption>The internal form of a <c>Megaco</c> message</icaption> + <icaption>The internal form of a Megaco message</icaption> </image> </section> diff --git a/lib/et/doc/src/et_tutorial.xmlsrc b/lib/et/doc/src/et_tutorial.xmlsrc index b5d1b815be..b6e1ca141c 100644 --- a/lib/et/doc/src/et_tutorial.xmlsrc +++ b/lib/et/doc/src/et_tutorial.xmlsrc @@ -75,12 +75,10 @@ <codeinclude file="../../examples/et_display_demo.erl" tag="%module" type="erl"></codeinclude> <p>When you run the <c>et_display_demo:test().</c> function in the - example above, the <c>Viewer</c> window will look like this:</p>. - - <p></p> + example above, the <c>Viewer</c> window will look like this:</p> <image file="coffee_order.png"> - <icaption>Screenshot of the <c>Viewer</c> window</icaption> + <icaption>Screenshot of the Viewer window</icaption> </image> </section> @@ -262,14 +260,11 @@ </list> <p>When you run the <c>et_trace_demo:test()</c> function above, the - <c>Viewer</c> window will look like this screenshot:</p>. + <c>Viewer</c> window will look like this screenshot:</p> - <p></p> - <image file="coffee_order.png"> - <icaption>Screenshot of the <c>Viewer</c> window</icaption> + <icaption>Screenshot of the Viewer window</icaption> </image> </section> - </chapter> |