diff options
author | Sverker Eriksson <[email protected]> | 2017-08-30 20:55:08 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-08-30 20:55:08 +0200 |
commit | 7c67bbddb53c364086f66260701bc54a61c9659c (patch) | |
tree | 92ab0d4b91d5e2f6e7a3f9d61ea25089e8a71fe0 /lib/et | |
parent | 97dc5e7f396129222419811c173edc7fa767b0f8 (diff) | |
parent | 3b7a6ffddc819bf305353a593904cea9e932e7dc (diff) | |
download | otp-7c67bbddb53c364086f66260701bc54a61c9659c.tar.gz otp-7c67bbddb53c364086f66260701bc54a61c9659c.tar.bz2 otp-7c67bbddb53c364086f66260701bc54a61c9659c.zip |
Merge tag 'OTP-19.0' into sverker/19/binary_to_atom-utf8-crash/ERL-474/OTP-14590
Diffstat (limited to 'lib/et')
40 files changed, 911 insertions, 2876 deletions
diff --git a/lib/et/Makefile b/lib/et/Makefile index 1b3476897e..f0bb7be211 100644 --- a/lib/et/Makefile +++ b/lib/et/Makefile @@ -1,18 +1,19 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2002-2009. All Rights Reserved. +# Copyright Ericsson AB 2002-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% # diff --git a/lib/et/doc/src/Makefile b/lib/et/doc/src/Makefile index 249d45fa52..0257a8f817 100644 --- a/lib/et/doc/src/Makefile +++ b/lib/et/doc/src/Makefile @@ -1,18 +1,19 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2002-2012. All Rights Reserved. +# Copyright Ericsson AB 2002-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% # diff --git a/lib/et/doc/src/book.xml b/lib/et/doc/src/book.xml index 222fbda046..5dddb44454 100644 --- a/lib/et/doc/src/book.xml +++ b/lib/et/doc/src/book.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE book SYSTEM "book.dtd"> <book xmlns:xi="http://www.w3.org/2001/XInclude"> <header titlestyle="normal"> <copyright> - <year>2002</year><year>2009</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/et.xml b/lib/et/doc/src/et.xml index 5e3453c348..3009b559e1 100644 --- a/lib/et/doc/src/et.xml +++ b/lib/et/doc/src/et.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2002</year><year>2010</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/et_collector.xml b/lib/et/doc/src/et_collector.xml index e9885dcbb3..6a85b81ec2 100644 --- a/lib/et/doc/src/et_collector.xml +++ b/lib/et/doc/src/et_collector.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2002</year><year>2010</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/et_desc.xmlsrc b/lib/et/doc/src/et_desc.xmlsrc index 68017b972e..29e0ab1fe3 100644 --- a/lib/et/doc/src/et_desc.xmlsrc +++ b/lib/et/doc/src/et_desc.xmlsrc @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2002</year><year>2013</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> @@ -54,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 @@ -68,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> @@ -143,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 @@ -203,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 @@ -227,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> @@ -310,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 7678184515..f4d94f7cb0 100644 --- a/lib/et/doc/src/et_examples.xmlsrc +++ b/lib/et/doc/src/et_examples.xmlsrc @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2002</year><year>2010</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> @@ -54,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 @@ -172,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> @@ -214,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> @@ -235,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 @@ -252,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 @@ -287,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_intro.xml b/lib/et/doc/src/et_intro.xml index f90a6d2b5c..729f95647d 100644 --- a/lib/et/doc/src/et_intro.xml +++ b/lib/et/doc/src/et_intro.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2002</year><year>2012</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/et_selector.xml b/lib/et/doc/src/et_selector.xml index 34203306bb..441a4dd278 100644 --- a/lib/et/doc/src/et_selector.xml +++ b/lib/et/doc/src/et_selector.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2002</year><year>2010</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/et_tutorial.xmlsrc b/lib/et/doc/src/et_tutorial.xmlsrc index 1337af76d1..b6e1ca141c 100644 --- a/lib/et/doc/src/et_tutorial.xmlsrc +++ b/lib/et/doc/src/et_tutorial.xmlsrc @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2009</year><year>2011</year> + <year>2009</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> @@ -74,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> @@ -261,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> diff --git a/lib/et/doc/src/et_viewer.xml b/lib/et/doc/src/et_viewer.xml index d4cfbdfa31..e0b39636e9 100644 --- a/lib/et/doc/src/et_viewer.xml +++ b/lib/et/doc/src/et_viewer.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE erlref SYSTEM "erlref.dtd"> <erlref> <header> <copyright> - <year>2002</year><year>2010</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/files.mk b/lib/et/doc/src/files.mk index 41fffb83f1..e0ea9b0b76 100644 --- a/lib/et/doc/src/files.mk +++ b/lib/et/doc/src/files.mk @@ -1,18 +1,19 @@ #-*-makefile-*- ; force emacs to enter makefile-mode # %CopyrightBegin% # -# Copyright Ericsson AB 2002-2010. All Rights Reserved. +# Copyright Ericsson AB 2002-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% diff --git a/lib/et/doc/src/notes.xml b/lib/et/doc/src/notes.xml index d45d0a89bf..5300d2e4ef 100644 --- a/lib/et/doc/src/notes.xml +++ b/lib/et/doc/src/notes.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE chapter SYSTEM "chapter.dtd"> <chapter> <header> <copyright> - <year>2002</year><year>2013</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> @@ -36,6 +37,102 @@ one section in this document. The title of each section is the version number of <c>Event Tracer (ET)</c>.</p> +<section><title>ET 1.6</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Update selector to utilize new garbage collection trace + tags.</p> + <p> + Own Id: OTP-13545</p> + </item> + </list> + </section> + +</section> + +<section><title>ET 1.5.1</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p>The <c>et</c> application must continue to use + <c>erlang:now/0</c> in order to obtain timestamps that + are consistent with timestamps obtained from tracing. The + application has been updated to suppress the warning for + <c>erlang:now/0</c>.</p> + <p> + Own Id: OTP-12780</p> + </item> + </list> + </section> + +</section> + +<section><title>ET 1.5</title> + + <section><title>Fixed Bugs and Malfunctions</title> + <list> + <item> + <p> + Application upgrade (appup) files are corrected for the + following applications: </p> + <p> + <c>asn1, common_test, compiler, crypto, debugger, + dialyzer, edoc, eldap, erl_docgen, et, eunit, gs, hipe, + inets, observer, odbc, os_mon, otp_mibs, parsetools, + percept, public_key, reltool, runtime_tools, ssh, + syntax_tools, test_server, tools, typer, webtool, wx, + xmerl</c></p> + <p> + A new test utility for testing appup files is added to + test_server. This is now used by most applications in + OTP.</p> + <p> + (Thanks to Tobias Schlager)</p> + <p> + Own Id: OTP-11744</p> + </item> + </list> + </section> + + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + Removed gs based applications and gs based backends. The + <c>observer</c> application replaces the removed + applications.</p> + <p> + *** POTENTIAL INCOMPATIBILITY ***</p> + <p> + Own Id: OTP-10915</p> + </item> + </list> + </section> + +</section> + +<section><title>ET 1.4.4.5</title> + + <section><title>Improvements and New Features</title> + <list> + <item> + <p> + The encoding of the <c>notes.xml</c> file has been + changed from latin1 to utf-8 to avoid future merge + problems.</p> + <p> + Own Id: OTP-11310</p> + </item> + </list> + </section> + +</section> + <section><title>ET 1.4.4.4</title> <section><title>Improvements and New Features</title> @@ -43,7 +140,7 @@ <item> <p> Use erlang:demonitor(Ref, [flush]) where applicable. - Thanks to Lo�c Hoguin.</p> + Thanks to Loïc Hoguin.</p> <p> Own Id: OTP-11039</p> </item> @@ -82,7 +179,7 @@ <list> <item> <p> - Fix typo in ET doc (Thanks to Ricardo Catalinas Jim�nez)</p> + Fix typo in ET doc (Thanks to Ricardo Catalinas Jiménez)</p> <p> Own Id: OTP-10119</p> </item> diff --git a/lib/et/doc/src/part.xml b/lib/et/doc/src/part.xml index 627aee866d..a282dc2c16 100644 --- a/lib/et/doc/src/part.xml +++ b/lib/et/doc/src/part.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE part SYSTEM "part.dtd"> <part xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2002</year><year>2010</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/doc/src/ref_man.xml b/lib/et/doc/src/ref_man.xml index 344b4fabed..bf131bef85 100644 --- a/lib/et/doc/src/ref_man.xml +++ b/lib/et/doc/src/ref_man.xml @@ -1,23 +1,24 @@ -<?xml version="1.0" encoding="latin1" ?> +<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE application SYSTEM "application.dtd"> <application xmlns:xi="http://www.w3.org/2001/XInclude"> <header> <copyright> - <year>2002</year><year>2009</year> + <year>2002</year><year>2016</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> - The contents of this file are subject to the Erlang Public License, - Version 1.1, (the "License"); you may not use this file except in - compliance with the License. You should have received a copy of the - Erlang Public License along with this software. If not, it can be - retrieved online at http://www.erlang.org/. - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and limitations - under the License. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. </legalnotice> diff --git a/lib/et/examples/Makefile b/lib/et/examples/Makefile index 3edbebc2e4..fe6811e45d 100644 --- a/lib/et/examples/Makefile +++ b/lib/et/examples/Makefile @@ -1,18 +1,19 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2002-2012. All Rights Reserved. +# Copyright Ericsson AB 2002-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% # diff --git a/lib/et/examples/et_demo.erl b/lib/et/examples/et_demo.erl index e439e6882c..b0fb29e7c6 100644 --- a/lib/et/examples/et_demo.erl +++ b/lib/et/examples/et_demo.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/et/include/et.hrl b/lib/et/include/et.hrl index b2cb7d17c3..75e82a5c85 100644 --- a/lib/et/include/et.hrl +++ b/lib/et/include/et.hrl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% Copyright Ericsson AB 2000-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/et/src/Makefile b/lib/et/src/Makefile index 386169fe95..b6347d8b6d 100644 --- a/lib/et/src/Makefile +++ b/lib/et/src/Makefile @@ -1,18 +1,19 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2000-2012. All Rights Reserved. +# Copyright Ericsson AB 2000-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% # @@ -65,7 +66,7 @@ APPUP_TARGET = $(EBIN)/$(APPUP_FILE) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- -ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/et/ebin -I../include +ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/et/ebin -I../include -Werror # ---------------------------------------------------- # Special Build Targets @@ -127,15 +128,12 @@ $(EBIN)/et_selector.$(EMULATOR): et_selector.erl ../include/et.hrl $(EBIN)/et_contents_viewer.$(EMULATOR): et_contents_viewer.erl ../include/et.hrl et_internal.hrl -$(EBIN)/et_gs_contents_viewer.$(EMULATOR): et_gs_contents_viewer.erl ../include/et.hrl et_internal.hrl $(EBIN)/et_wx_contents_viewer.$(EMULATOR): et_wx_contents_viewer.erl ../include/et.hrl et_internal.hrl $(EBIN)/et_collector.$(EMULATOR): et_collector.erl ../include/et.hrl et_internal.hrl $(EBIN)/et_viewer.$(EMULATOR): et_viewer.erl ../include/et.hrl et_internal.hrl -$(EBIN)/et_gs_viewer.$(EMULATOR): et_gs_viewer.erl ../include/et.hrl et_internal.hrl - $(EBIN)/et_wx_viewer.$(EMULATOR): et_wx_viewer.erl ../include/et.hrl et_internal.hrl diff --git a/lib/et/src/et.app.src b/lib/et/src/et.app.src index fd203e3e44..7a5928d6ab 100644 --- a/lib/et/src/et.app.src +++ b/lib/et/src/et.app.src @@ -2,18 +2,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% @@ -24,8 +25,6 @@ [ et, et_collector, - et_gs_contents_viewer, - et_gs_viewer, et_selector, et_viewer, et_wx_contents_viewer, @@ -33,5 +32,7 @@ ]}, {registered, [et_collector]}, {applications, [stdlib, kernel]}, - {env, []} + {env, []}, + {runtime_dependencies, ["wx-1.2","stdlib-2.0","runtime_tools-1.10", + "kernel-3.0","erts-8.0"]} ]}. diff --git a/lib/et/src/et.appup.src b/lib/et/src/et.appup.src index b6344a9387..491c039ffe 100644 --- a/lib/et/src/et.appup.src +++ b/lib/et/src/et.appup.src @@ -1,23 +1,22 @@ -%% This is an -*- erlang -*- file. -%% +%% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2009. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Copyright Ericsson AB 2002-2016. All Rights Reserved. %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% - {"%VSN%", - [ ] + [{<<".*">>,[{restart_application, et}]}], + [{<<".*">>,[{restart_application, et}]}] }. - diff --git a/lib/et/src/et.erl b/lib/et/src/et.erl index c9ba4f6816..91c17ffdc9 100644 --- a/lib/et/src/et.erl +++ b/lib/et/src/et.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2012. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% Copyright Ericsson AB 2000-2016. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/et/src/et_collector.erl b/lib/et/src/et_collector.erl index a78b30c419..aba90b0be1 100644 --- a/lib/et/src/et_collector.erl +++ b/lib/et/src/et_collector.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2013. All Rights Reserved. +%% Copyright Ericsson AB 2000-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -26,8 +27,7 @@ -behaviour(gen_server). %% External exports --export([ - start_link/1, +-export([start_link/1, stop/1, report/2, @@ -54,8 +54,7 @@ dict_delete/2, dict_lookup/2, dict_match/2, - multicast/2 - ]). + multicast/2]). %% Internal export -export([monitor_trace_port/2]). @@ -64,6 +63,8 @@ -export([init/1,terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2]). +-compile([{nowarn_deprecated_function,[{erlang,now,0}]}]). + -include("et_internal.hrl"). -include("../include/et.hrl"). @@ -255,7 +256,7 @@ parse_opt(BadList, _S, _Dict, _Clients) -> {error, {bad_option_list, BadList}}. start_clients(CollectorPid, [{Type, Parameters} | T]) -> - start_trace_client(CollectorPid, Type, Parameters), + _ = start_trace_client(CollectorPid, Type, Parameters), start_clients(CollectorPid, T); start_clients(CollectorPid, []) -> {ok, CollectorPid}. @@ -409,8 +410,6 @@ report(TH, TraceOrEvent) when is_record(TH, table_handle) -> report(TH#table_handle.collector_pid, TraceOrEvent) end end; -report(TH, end_of_trace) when is_record(TH, table_handle) -> - {ok, TH}; report(_, Bad) -> exit({bad_event, Bad}). @@ -891,7 +890,7 @@ init([InitialS, Dict]) -> process_flag(trap_exit, true), case InitialS#state.parent_pid of undefined -> - ignore; + ok; Pid when is_pid(Pid) -> link(Pid) end, @@ -913,7 +912,7 @@ init_global(S) -> Spec = trace_spec_wrapper(EventFun, EndFun, {ok, self()}), dbg:tracer(process, Spec), et_selector:change_pattern(S#state.trace_pattern), - net_kernel:monitor_nodes(true), + ok = net_kernel:monitor_nodes(true), lists:foreach(fun(N) -> self() ! {nodeup, N} end, nodes()), S#state{trace_nodes = [node()]}; false -> @@ -1000,7 +999,7 @@ handle_call({save_event_file, FileName, Options}, _From, S) -> %% insert() -> %% case S2#state.file of %% undefined -> - %% ignore; + %% ok; %% F -> %% Fd = F#file.desc, %% ok = disk_log:log(Fd, Event) @@ -1009,7 +1008,7 @@ handle_call({save_event_file, FileName, Options}, _From, S) -> Fun = fun({_, E}, A) -> ok = disk_log:log(Fd, E), A end, Tab = S#state.event_tab, Reply = tab_iterate(Fun, Tab, ets:first(Tab), ok), - disk_log:close(Fd), + ok = disk_log:close(Fd), {Reply, S} %% all -> %% Reply = tab_iterate(WriteFun, Tab, ok), @@ -1032,7 +1031,7 @@ handle_call({save_event_file, FileName, Options}, _From, S) -> handle_call({change_pattern, Pattern}, _From, S) -> Ns = S#state.trace_nodes, - rpc:multicall(Ns, et_selector, change_pattern, [Pattern]), + {_,[]} = rpc:multicall(Ns, et_selector, change_pattern, [Pattern]), Reply = {old_pattern, S#state.trace_pattern}, S2 = S#state{trace_pattern = Pattern}, reply(Reply, S2); @@ -1044,8 +1043,9 @@ handle_call(clear_table, _From, S) -> handle_call(stop, _From, S) -> do_multicast(S#state.subscribers, close), case S#state.trace_global of - true -> rpc:multicall(S#state.trace_nodes, dbg, stop_clear, []); - false -> ignore + true -> {_,[]} = rpc:multicall(S#state.trace_nodes, dbg, stop_clear, []), + ok; + false -> ok end, {stop, shutdown, ok, S}; handle_call(Request, From, S) -> @@ -1238,8 +1238,8 @@ tab_iterate(Fun, Tab, Key, Acc) -> file_open(F) -> Fd = make_ref(), case F#file.file_opt of - write -> file:rename(F#file.name, F#file.name ++ ".OLD"); - append -> ignore + write -> ok = file:rename(F#file.name, F#file.name ++ ".OLD"); + append -> ok end, Args = [{file, F#file.name}, {name, Fd}, {repair, true}, {mode, read_write}], @@ -1277,7 +1277,7 @@ do_multicast([], _Msg) -> opt_unlink(Pid) -> if Pid =:= undefined -> - ignore; + ok; true -> unlink(Pid) end. diff --git a/lib/et/src/et_gs_contents_viewer.erl b/lib/et/src/et_gs_contents_viewer.erl deleted file mode 100644 index 2d414f10b4..0000000000 --- a/lib/et/src/et_gs_contents_viewer.erl +++ /dev/null @@ -1,602 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2000-2012. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%%---------------------------------------------------------------------- -%% Purpose: Displays details of a trace event -%%---------------------------------------------------------------------- - --module(et_gs_contents_viewer). --compile([{nowarn_deprecated_function,{gs,config,2}}, - {nowarn_deprecated_function,{gs,destroy,1}}, - {nowarn_deprecated_function,{gs,editor,2}}, - {nowarn_deprecated_function,{gs,frame,2}}, - {nowarn_deprecated_function,{gs,menu,2}}, - {nowarn_deprecated_function,{gs,menubar,2}}, - {nowarn_deprecated_function,{gs,menubutton,2}}, - {nowarn_deprecated_function,{gs,menuitem,2}}, - {nowarn_deprecated_function,{gs,menuitem,3}}, - {nowarn_deprecated_function,{gs,start,0}}, - {nowarn_deprecated_function,{gs,window,2}}]). - --behaviour(gen_server). - -%% External exports --export([start_link/1, - stop/1]). - -%% gen_server callbacks --export([init/1, terminate/2, code_change/3, - handle_call/3, handle_cast/2, handle_info/2]). - --include("../include/et.hrl"). --include("et_internal.hrl"). - --record(state, {parent_pid, % Pid of parent process - viewer_pid, % Pid of viewer process - event_order, % Field to be used as primary key - event, % The original event - filtered_event, % Event processed by active filter - active_filter, % Name of the active filter - filters, % List of possible filters - win, % GUI: Window object - packer, % GUI: Packer object - width, % GUI: Window width - height}). % GUI: Window height - -%%%---------------------------------------------------------------------- -%%% Client side -%%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% start_link(Options) -> {ok, ContentsPid} | {error, Reason} -%% -%% Start an viewer for the event contents as window in GS -%% -%% Options = [option()] -%% -%% option() = -%% -%% {parent_pid, pid()} | % Pid of parent process -%% {viewer_pid, pid()} | % Pid of viewer process -%% {event_order, event_order()} | % Field to be used as primary key -%% {active_filter, atom()} | % Name of the active filter -%% {filter, atom(), fun()} % A named filter fun -%% -%% event_order() = 'trace_ts' | 'event_ts' -%% ContentsPid = pid() -%% Reason = term() -%%---------------------------------------------------------------------- - -start_link(Options) -> - case parse_opt(Options, default_state()) of - {ok, S} -> - case gen_server:start_link(?MODULE, [S], []) of - {ok, ContentsPid} when S#state.parent_pid =/= self() -> - unlink(ContentsPid), - {ok, ContentsPid}; - Other -> - Other - end; - {error, Reason} -> - {error, Reason} - end. - -default_state() -> - #state{parent_pid = self(), - viewer_pid = undefined, - active_filter = ?DEFAULT_FILTER_NAME, - filters = [?DEFAULT_FILTER], - width = 600, - height = 300}. - -parse_opt([], S) -> - Name = S#state.active_filter, - Filters = S#state.filters, - if - S#state.event =:= undefined -> - {error, {badarg, no_event}}; - is_atom(Name) -> - case lists:keysearch(Name, #filter.name, Filters) of - {value, F} when is_record(F, filter) -> - {ok, S#state{active_filter = Name}}; - false -> - {error, {badarg, {no_such_filter, Name, Filters}}} - end - end; -parse_opt([H | T], S) -> - case H of - {parent_pid, ParentPid} when is_pid(ParentPid) -> - parse_opt(T, S#state{parent_pid = ParentPid}); - {viewer_pid, ViewerPid} when is_pid(ViewerPid) -> - parse_opt(T, S#state{viewer_pid = ViewerPid}); - {event_order, trace_ts} -> - parse_opt(T, S#state{event_order = trace_ts}); - {event_order, event_ts} -> - parse_opt(T, S#state{event_order = event_ts}); - {event, Event} when is_record(Event, event) -> - parse_opt(T, S#state{event = Event}); - {active_filter, Name} when is_atom(Name) -> - parse_opt(T, S#state{active_filter = Name}); - F when is_record(F, filter), - is_atom(F#filter.name), - is_function(F#filter.function) -> - Filters = lists:keydelete(F#filter.name, #filter.name, S#state.filters), - Filters2 = lists:keysort(#filter.name, [F | Filters]), - parse_opt(T, S#state{filters = Filters2}); - {width, Width} when is_integer(Width), Width > 0 -> - parse_opt(T, S#state{width = Width}); - {height, Height} when is_integer(Height), Height > 0 -> - parse_opt(T, S#state{height = Height}); - Bad -> - {error, {bad_option, Bad}} - end; -parse_opt(BadList, _S) -> - {error, {bad_option_list, BadList}}. - -%%---------------------------------------------------------------------- -%% stop(ContentsPid) -> ok -%% -%% Stops a contents viewer process -%% -%% ContentsPid = pid() -%%---------------------------------------------------------------------- - -stop(ContentsPid) -> - unlink(ContentsPid), - call(ContentsPid, stop). - -call(ContentsPid, Request) -> - gen_server:call(ContentsPid, Request, infinity). - -%%%---------------------------------------------------------------------- -%%% Callback functions from gen_server -%%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Func: init/1 -%% Returns: {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%%---------------------------------------------------------------------- - -init([S]) when is_record(S, state) -> - process_flag(trap_exit, true), - S2 = create_window(S), - {ok, S2}. - -%%---------------------------------------------------------------------- -%% Func: handle_call/3 -%% Returns: {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | (terminate/2 is called) -%% {stop, Reason, State} (terminate/2 is called) -%%---------------------------------------------------------------------- - -handle_call(stop, _From, S) -> - unlink(S#state.parent_pid), - {stop, shutdown, ok, S}; -handle_call(Request, From, S) -> - ok = error_logger:format("~p(~p): handle_call(~p, ~p, ~p)~n", - [?MODULE, self(), Request, From, S]), - Reply = {error, {bad_request, Request}}, - {reply, Reply, S}. - -%%---------------------------------------------------------------------- -%% Func: handle_cast/2 -%% Returns: {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} (terminate/2 is called) -%%---------------------------------------------------------------------- - -handle_cast(Msg, S) -> - ok = error_logger:format("~p(~p): handle_cast(~p, ~p)~n", - [?MODULE, self(), Msg, S]), - {noreply, S}. - -%%---------------------------------------------------------------------- -%% Func: handle_info/2 -%% Returns: {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} (terminate/2 is called) -%%---------------------------------------------------------------------- - -handle_info({gs, Button, click, Data, _Other}, S) -> - case Button of - close -> - gs:destroy(S#state.win), - {stop, normal, S}; - save -> - Event = S#state.event, - Bin = list_to_binary(event_to_string(Event, S#state.event_order)), - TimeStamp = - case S#state.event_order of - trace_ts -> Event#event.trace_ts; - event_ts -> Event#event.event_ts - end, - FileName = ["et_contents_viewer_", now_to_string(TimeStamp), ".save"], - file:write_file(lists:flatten(FileName), Bin), - {noreply, S}; - _PopupMenuItem when is_record(Data, filter) -> - F = Data, - ChildState= S#state{active_filter = F#filter.name}, - case gen_server:start_link(?MODULE, [ChildState], []) of - {ok, Pid} when S#state.parent_pid =/= self() -> - unlink(Pid), - {noreply, S}; - _ -> - {noreply, S} - end; - {hide, Actors} -> - send_viewer_event(S, {delete_actors, Actors}), - {noreply, S}; - {show, Actors} -> - send_viewer_event(S, {insert_actors, Actors}), - {noreply, S}; - {mode, Mode} -> - send_viewer_event(S, {mode, Mode}), - {noreply, S}; - Nyi -> - ok = error_logger:format("~p: click ~p ignored (nyi)~n", - [?MODULE, Nyi]), - {noreply, S} - end; -handle_info({gs, _Obj, destroy,_, _}, S) -> - unlink(S#state.parent_pid), - gs:destroy(S#state.win), - {stop, normal, S}; -handle_info({gs, _Obj, keypress, _, [KeySym, _Keycode, _Shift, _Control | _]}, S) -> - case KeySym of - 'c' -> - gs:destroy(S#state.win), - {stop, normal, S}; - - 'f' -> - E = S#state.filtered_event, - From = E#event.from, - send_viewer_event(S, {delete_actors, [From]}), - {noreply, S}; - 't' -> - E = S#state.filtered_event, - To = E#event.to, - send_viewer_event(S, {delete_actors, [To]}), - {noreply, S}; - 'b' -> - E = S#state.filtered_event, - From = E#event.from, - To = E#event.to, - send_viewer_event(S, {delete_actors, [From, To]}), - {noreply, S}; - - 'F' -> - E = S#state.filtered_event, - From = E#event.from, - send_viewer_event(S, {insert_actors, [From]}), - {noreply, S}; - 'T' -> - E = S#state.filtered_event, - To = E#event.to, - send_viewer_event(S, {insert_actors, [To]}), - {noreply, S}; - 'B' -> - E = S#state.filtered_event, - From = E#event.from, - To = E#event.to, - send_viewer_event(S, {insert_actors, [From, To]}), - {noreply, S}; - - 's' -> - E = S#state.filtered_event, - From = E#event.from, - To = E#event.to, - First = et_collector:make_key(S#state.event_order, E), - Mode = {search_actors, forward, First, [From, To]}, - send_viewer_event(S, {mode, Mode}), - {noreply, S}; - 'r' -> - E = S#state.filtered_event, - From = E#event.from, - To = E#event.to, - First = et_collector:make_key(S#state.event_order, E), - Mode = {search_actors, reverse, First, [From, To]}, - send_viewer_event(S, {mode, Mode}), - {noreply, S}; - 'a' -> - send_viewer_event(S, {mode, all}), - {noreply, S}; - - 0 -> - case lists:keysearch(?DEFAULT_FILTER_NAME, #filter.name, S#state.filters) of - {value, F} when is_record(F, filter) -> - ChildState= S#state{active_filter = F#filter.name}, - case gen_server:start_link(?MODULE, [ChildState], []) of - {ok, Pid} when S#state.parent_pid =/= self() -> - unlink(Pid); - _ -> - ignore - end; - false -> - ignore - end, - {noreply, S}; - Int when is_integer(Int), Int > 0, Int =< 9 -> - case catch lists:nth(Int, S#state.filters) of - F when is_record(F, filter) -> - ChildState= S#state{active_filter = F#filter.name}, - case gen_server:start_link(?MODULE, [ChildState], []) of - {ok, Pid} when S#state.parent_pid =/= self() -> - unlink(Pid); - _ -> - ignore - end; - {'EXIT', _} -> - ignore - end, - {noreply, S}; - - 'Shift_L' -> - {noreply, S}; - 'Shift_R' -> - {noreply, S}; - 'Caps_Lock' -> - {noreply, S}; - _ -> - io:format("~p: ignored: ~p~n", [?MODULE, KeySym]), - {noreply, S} - end; -handle_info({gs, _Obj, configure, [], [W, H | _]}, S) -> - gs:config(S#state.packer, [{width, W},{height, H}]), - S2 = S#state{width = W, height = H}, - {noreply, S2}; -handle_info({'EXIT', Pid, Reason}, S) -> - if - Pid =:= S#state.parent_pid -> - unlink(Pid), - {stop, Reason, S}; - true -> - {noreply, S} - end; -handle_info(Info, S) -> - ok = error_logger:format("~p(~p): handle_info(~p, ~p)~n", - [?MODULE, self(), Info, S]), - {noreply, S}. - -%%---------------------------------------------------------------------- -%% Func: terminate/2 -%% Purpose: Shutdown the server -%% Returns: any (ignored by gen_server) -%%---------------------------------------------------------------------- - -terminate(_Reason, _S) -> - ignore. - -%%---------------------------------------------------------------------- -%% Func: code_change/3 -%% Purpose: Convert process state when code is changed -%% Returns: {ok, NewState} -%%---------------------------------------------------------------------- - -code_change(_OldVsn, S, _Extra) -> - {ok, S}. - -%%%---------------------------------------------------------------------- -%%% Handle graphics -%%%---------------------------------------------------------------------- - -create_window(S) -> - H = S#state.height, - W = S#state.width, - Name = S#state.active_filter, - Title = lists:concat([?MODULE, " (filter: ", Name, ")"]), - WinOpt = [{title, Title}, {configure, true}, - {width, W}, {height, H}], - GS = gs:start(), - Win = gs:window(GS, WinOpt), - Bar = gs:menubar(Win, []), - create_file_menu(Bar), - PackerOpt = [{packer_x, [{stretch, 1}]}, - {packer_y, [{stretch, 1}, {fixed, 25}]}, - {x, 0}, {y, 25}], - Packer = gs:frame(Win, PackerOpt), - EditorOpt = [{pack_xy, {1, 1}}, {vscroll, right}, {hscroll, bottom}, - {wrap, none}, - {bg, lightblue}, {font, {courier, 12}}], - Editor = gs:editor(Packer, EditorOpt), - FilteredEvent = config_editor(Editor, S), - S2 = S#state{win = Win, packer = Packer, filtered_event = FilteredEvent}, - create_hide_menu(Bar, S2), - create_search_menu(Bar, S2), - create_filter_menu(Bar, S#state.filters), - gs:config(Packer, [{width, W}, {height, H}]), - gs:config(Win, [{map,true}, {keypress, true}]), - S2. - -create_file_menu(Bar) -> - Button = gs:menubutton(Bar, [{label, {text, "File"}}]), - Menu = gs:menu(Button, []), - gs:menuitem(close, Menu, [{label, {text,"Close (c)"}}]), - gs:menuitem(save, Menu, [{label, {text,"Save"}}]). - -create_filter_menu(Bar, Filters) -> - Button = gs:menubutton(Bar, [{label, {text, "Filters"}}]), - Menu = gs:menu(Button, []), - gs:menuitem(Menu, [{label, {text, "Select Filter"}}, {bg, lightblue}, {enable, false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - Item = fun(F, N) when F#filter.name =:= ?DEFAULT_FILTER_NAME-> - Label = lists:concat([pad_string(F#filter.name, 20), "(0)"]), - gs:menuitem(Menu, [{label, {text, Label}}, {data, F}]), - N + 1; - (F, N) -> - Name = F#filter.name, - Label = lists:concat([pad_string(Name, 20), "(", N, ")"]), - gs:menuitem(Menu, [{label, {text, Label}}, {data, F}]), - N + 1 - end, - Filters2 = lists:keysort(#filter.name, Filters), - lists:foldl(Item, 1, Filters2), - Menu. - -create_hide_menu(Bar, S) -> - Button = gs:menubutton(Bar, [{label, {text, "Hide"}}]), - Menu = gs:menu(Button, []), - E = S#state.filtered_event, - From = E#event.from, - To = E#event.to, - if - S#state.viewer_pid =:= undefined -> - ignore; - From =:= To -> - gs:menuitem(Menu, [{label, {text, "Hide actor in Viewer "}}, {bg, lightblue}, {enable, false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem({hide, [From]}, Menu, [{label, {text,"From=To (f|t|b)"}}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(Menu, [{label, {text, "Show actor in Viewer "}}, {bg, lightblue}, {enable, false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem({show, [From]}, Menu, [{label, {text,"From=To (F|T|B)"}}]); - true -> - gs:menuitem(Menu, [{label, {text, "Hide actor in Viewer "}}, {bg, lightblue}, {enable, false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem({hide, [From]}, Menu, [{label, {text,"From (f)"}}]), - gs:menuitem({hide, [To]}, Menu, [{label, {text,"To (t)"}}]), - gs:menuitem({hide, [From, To]}, Menu, [{label, {text,"Both (b)"}}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(Menu, [{label, {text, "Show actor in Viewer "}}, {bg, lightblue}, {enable, false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem({show, [From]}, Menu, [{label, {text,"From (F)"}}]), - gs:menuitem({show, [To]}, Menu, [{label, {text,"To (T)"}}]), - gs:menuitem({show, [From, To]}, Menu, [{label, {text,"Both (B)"}}]) - end. - -create_search_menu(Bar, S) -> - Button = gs:menubutton(Bar, [{label, {text, "Search"}}]), - Menu = gs:menu(Button, []), - E = S#state.filtered_event, - From = E#event.from, - To = E#event.to, - gs:menuitem(Menu, [{label, {text, "Search in Viewer "}}, - {bg, lightblue}, {enable, false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - if - S#state.viewer_pid =:= undefined -> - S; - From =:= To -> - Key = et_collector:make_key(S#state.event_order, E), - ModeS = {search_actors, forward, Key, [From]}, - ModeR = {search_actors, reverse, Key, [From]}, - gs:menuitem({mode, ModeS}, Menu, [{label, {text,"Forward from this event (s)"}}]), - gs:menuitem({mode, ModeR}, Menu, [{label, {text,"Reverse from this event (r)"}}]); - true -> - Key = et_collector:make_key(S#state.event_order, E), - ModeS = {search_actors, forward, Key, [From, To]}, - ModeR = {search_actors, reverse, Key, [From, To]}, - gs:menuitem({mode, ModeS}, Menu, [{label, {text,"Forward from this event (s)"}}]), - gs:menuitem({mode, ModeR}, Menu, [{label, {text,"Reverse from this event (r)"}}]) - end, - gs:menuitem({mode, all}, Menu, [{label, {text,"Abort search. Display all (a)"}}]). - -config_editor(Editor, S) -> - Event = S#state.event, - Name = S#state.active_filter, - {value, F} = lists:keysearch(Name, #filter.name, S#state.filters), - FilterFun = F#filter.function, - case catch FilterFun(Event) of - true -> - do_config_editor(Editor, Event, lightblue, S#state.event_order); - {true, Event2} when is_record(Event2, event) -> - do_config_editor(Editor, Event2, lightblue, S#state.event_order); - false -> - do_config_editor(Editor, Event, red, S#state.event_order); - Bad -> - Contents = {bad_filter, Name, Bad}, - BadEvent = Event#event{contents = Contents}, - do_config_editor(Editor, BadEvent, red, S#state.event_order) - end. - -do_config_editor(Editor, Event, Colour, TsKey) -> - String = event_to_string(Event, TsKey), - gs:config(Editor, {insert, {'end', String}}), - gs:config(Editor, {enable, false}), - gs:config(Editor, {bg, Colour}), - Event. - -%%%---------------------------------------------------------------------- -%%% String handling -%%%---------------------------------------------------------------------- - -term_to_string(Term) -> - case catch io_lib:format("~s", [Term]) of - {'EXIT', _} -> io_lib:format("~p", [Term]); - GoodString -> GoodString - end. - -now_to_string({Mega, Sec, Micro} = Now) - when is_integer(Mega), is_integer(Sec), is_integer(Micro) -> - {{Y, Mo, D}, {H, Mi, S}} = calendar:now_to_universal_time(Now), - lists:concat([Y, "-", Mo, "-", D, " ", H, ".", Mi, ".", S, ".", Micro]); -now_to_string(Other) -> - term_to_string(Other). - -event_to_string(Event, TsKey) -> - ReportedTs = Event#event.trace_ts, - ParsedTs = Event#event.event_ts, - Deep = - ["DETAIL LEVEL: ", term_to_string(Event#event.detail_level), - "\nLABEL: ", term_to_string(Event#event.label), - case Event#event.from =:= Event#event.to of - true -> - ["\nACTOR: ", term_to_string(Event#event.from)]; - false -> - ["\nFROM: ", term_to_string(Event#event.from), - "\nTO: ", term_to_string(Event#event.to)] - end, - case ReportedTs =:= ParsedTs of - true -> - ["\nPARSED: ", now_to_string(ParsedTs)]; - false -> - case TsKey of - trace_ts -> - ["\nTRACE_TS: ", now_to_string(ReportedTs), - "\nEVENT_TS: ", now_to_string(ParsedTs)]; - event_ts -> - ["\nEVENT_TS: ", now_to_string(ParsedTs), - "\nTRACE_TS: ", now_to_string(ReportedTs)] - end - end, - "\nCONTENTS:\n\n", term_to_string(Event#event.contents)], - lists:flatten(Deep). - -pad_string(Atom, MinLen) when is_atom(Atom) -> - pad_string(atom_to_list(Atom), MinLen); -pad_string(String, MinLen) when is_integer(MinLen), MinLen >= 0 -> - Len = length(String), - case Len >= MinLen of - true -> - String; - false -> - String ++ lists:duplicate(MinLen - Len, $ ) - end. - -send_viewer_event(S, Event) -> - case S#state.viewer_pid of - ViewerPid when is_pid(ViewerPid) -> - ViewerPid ! {et, Event}; - undefined -> - ignore - end. diff --git a/lib/et/src/et_gs_viewer.erl b/lib/et/src/et_gs_viewer.erl deleted file mode 100644 index ce8634d09f..0000000000 --- a/lib/et/src/et_gs_viewer.erl +++ /dev/null @@ -1,1498 +0,0 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. -%% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. -%% -%% %CopyrightEnd% -%% -%%---------------------------------------------------------------------- -%% Purpose: Displays a sequence chart for trace events (messages/actions) -%%---------------------------------------------------------------------- - --module(et_gs_viewer). --compile([{nowarn_deprecated_function,{gs,canvas,2}}, - {nowarn_deprecated_function,{gs,checkbutton,3}}, - {nowarn_deprecated_function,{gs,config,2}}, - {nowarn_deprecated_function,{gs,destroy,1}}, - {nowarn_deprecated_function,{gs,frame,2}}, - {nowarn_deprecated_function,{gs,line,2}}, - {nowarn_deprecated_function,{gs,menu,2}}, - {nowarn_deprecated_function,{gs,menu,3}}, - {nowarn_deprecated_function,{gs,menubar,2}}, - {nowarn_deprecated_function,{gs,menubutton,2}}, - {nowarn_deprecated_function,{gs,menubutton,3}}, - {nowarn_deprecated_function,{gs,menuitem,2}}, - {nowarn_deprecated_function,{gs,menuitem,3}}, - {nowarn_deprecated_function,{gs,scale,2}}, - {nowarn_deprecated_function,{gs,start,0}}, - {nowarn_deprecated_function,{gs,text,2}}, - {nowarn_deprecated_function,{gs,window,2}}]). - --behaviour(gen_server). - -%% External exports --export([start_link/1]). - -%% gen_server callbacks --export([init/1, terminate/2, code_change/3, - handle_call/3, handle_cast/2, handle_info/2]). - --include("../include/et.hrl"). --include("et_internal.hrl"). - --define(unknown, "UNKNOWN"). - --record(state, - {parent_pid, % Pid of parent process - collector_pid, % Pid of collector process - event_order, % Field to be used as primary key - trace_pattern, % Collector trace pattern - active_filter, % Name of the active filter - filters, % List of possible filters - selected_actor, % Actor selected by user - first_event, % Key of first event (regardless of visibility) - last_event, % Key of last event (regardless of visibility) - max_events, % Maximum number of shown events - events, % Queue containg all event keys (regardless of visibility) - max_actors, % Maximum number of shown actors - actors, % List of known actors - refresh_needed, % Refresh is needed in order to show all actors - display_mode, % Display all or only matching actors - detail_level, % Show only events with lesser detail level - hide_actions, % Hide/show events where to == from actor (bool) - hide_unknown, % Hide/show events with unknown actor (bool) - is_suspended, % Suspend viewer updates (bool) - title, % GUI: Window title - win, % GUI: Window object - menubar, % GUI: Menu bar object - packer, % GUI: Packer object - width, % GUI: Window width - height, % GUI: Window height - scale, % GUI: Scaling factor on canvas - font, % GUI: Font to be used on text labels - canvas_width, % GUI: Canvas width - canvas_height, % GUI: Canvas height - canvas, % GUI: Canvas object - y_pos}). % GUI: Current y position on canvas - --record(actor, {name, string}). - --define(initial_x, 10). --define(incr_x, 60). --define(initial_y, 15). --define(incr_y, 15). - -%%%---------------------------------------------------------------------- -%%% Client side -%%%---------------------------------------------------------------------- - -start_link(Options) -> - case parse_opt(Options, default_state(), []) of - {ok, S, CollectorOpt} -> - case S#state.collector_pid of - CollectorPid when is_pid(CollectorPid) -> - case gen_server:start_link(?MODULE, [S], []) of - {ok, Pid} when S#state.parent_pid =/= self() -> - unlink(Pid), - {ok, Pid}; - Other -> - Other - end; - undefined -> - case et_collector:start_link(CollectorOpt) of - {ok, CollectorPid} -> - S2 = S#state{collector_pid = CollectorPid}, - case gen_server:start_link(?MODULE, [S2], []) of - {ok, Pid} when S#state.parent_pid =/= self() -> - unlink(Pid), - {ok, Pid}; - Other -> - Other - end; - {error, Reason} -> - {error, {et_collector, Reason}} - end - end; - {error, Reason} -> - {error, Reason} - end. - -default_state() -> - #state{parent_pid = self(), - collector_pid = undefined, - detail_level = ?detail_level_max, - active_filter = ?DEFAULT_FILTER_NAME, - filters = [?DEFAULT_FILTER], - event_order = trace_ts, - is_suspended = false, - max_events = 100, - first_event = first, - last_event = first, - events = queue_new(), - max_actors = 5, - actors = [create_actor(?unknown)], - selected_actor = ?unknown, - hide_actions = false, - hide_unknown = false, - refresh_needed = false, - display_mode = all, - scale = 2, - canvas_height = 0, - canvas_width = 0, - width = 800, - height = 600}. - -parse_opt([], S, CollectorOpt) -> - {ok, S, [{parent_pid, S#state.parent_pid} | CollectorOpt]}; -parse_opt([H | T], S, CollectorOpt) -> - case H of - {parent_pid, Parent} when Parent =:= undefined -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S#state{parent_pid = Parent}, CollectorOpt2); - {parent_pid, Parent} when is_pid(Parent) -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S#state{parent_pid = Parent}, CollectorOpt2); - {title, Title} -> - parse_opt(T, S#state{title = name_to_string(Title)}, CollectorOpt); - {detail_level, Level} when is_integer(Level), - Level >= ?detail_level_min, - Level =< ?detail_level_max -> - parse_opt(T, S#state{detail_level = Level}, CollectorOpt); - {detail_level, max} -> - parse_opt(T, S#state{detail_level = ?detail_level_max}, CollectorOpt); - {detail_level, min} -> - parse_opt(T, S#state{detail_level = ?detail_level_min}, CollectorOpt); - {is_suspended, true} -> - parse_opt(T, S#state{is_suspended = true}, CollectorOpt); - {is_suspended, false} -> - parse_opt(T, S#state{is_suspended = false}, CollectorOpt); - {scale, Scale} when is_integer(Scale), Scale > 0 -> - parse_opt(T, S#state{scale = Scale}, CollectorOpt); - {width, W} when is_integer(W), W > 0 -> - parse_opt(T, S#state{width = W, canvas_width = W}, CollectorOpt); - {height, WH} when is_integer(WH), WH > 0 -> - parse_opt(T, S#state{height = WH, canvas_height = WH}, CollectorOpt); - {collector_pid, Pid} when is_pid(Pid) -> - parse_opt(T, S#state{collector_pid = Pid}, CollectorOpt); - {collector_pid, undefined} -> - parse_opt(T, S#state{collector_pid = undefined}, CollectorOpt); - {active_filter, Name} when is_atom(Name) -> - parse_opt(T, S#state{active_filter = Name}, CollectorOpt); - {event_order, trace_ts} -> %% BUGBUG: Verify event_order with collector - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S#state{event_order = trace_ts}, CollectorOpt2); - {event_order, event_ts} -> %% BUGBUG: Verify event_order with collector - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S#state{event_order = event_ts}, CollectorOpt2); - {trace_port, _Port} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {trace_max_queue, _Queue} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {trace_pattern, _Pattern} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {trace_global, _Boolean} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {trace_client, _Client} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {dict_insert, {filter, Name}, Fun} -> - if - is_atom(Name), is_function(Fun) -> - F = #filter{name = Name, function = Fun}, - Filters = lists:keydelete(Name, #filter.name, S#state.filters), - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S#state{filters = Filters ++ [F]}, CollectorOpt2); - true -> - {error, {bad_option, H}} - end; - {dict_insert, {subscriber, Pid}, _Val} -> - if - is_pid(Pid) -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - true -> - {error, {bad_option, H}} - end; - {dict_insert, _Key, _Val} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {dict_delete, {filter, Name}} -> - Filters = lists:keydelete(Name, #filter.name, S#state.filters), - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S#state{filters = Filters}, CollectorOpt2); - {dict_delete, _Key} -> - CollectorOpt2 = [H | CollectorOpt], - parse_opt(T, S, CollectorOpt2); - {max_events, Max} when is_integer(Max), Max > 0-> - parse_opt(T, S#state{max_events = Max}, CollectorOpt); - {max_events, Max} when Max =:= infinity -> - parse_opt(T, S#state{max_events = Max}, CollectorOpt); - {max_actors, Max} when is_integer(Max), Max >= 0-> - parse_opt(T, S#state{max_actors = Max}, CollectorOpt); - {max_actors, Max} when Max =:= infinity -> - parse_opt(T, S#state{max_actors = Max}, CollectorOpt); - {actors, ActorNames} when is_list(ActorNames) -> - ActorNames2 = - case lists:member(?unknown, ActorNames) of - false -> [?unknown | ActorNames]; - true -> ActorNames - end, - Actors = [create_actor(Name) || Name <- ActorNames2], - parse_opt(T, S#state{actors = Actors}, CollectorOpt); - {first_event, First} -> - parse_opt(T, S#state{first_event = First}, CollectorOpt); - {hide_unknown, Bool} when Bool =:= false -> - parse_opt(T, S#state{hide_unknown = Bool}, CollectorOpt); - {hide_unknown, Bool} when Bool =:= true -> - parse_opt(T, S#state{hide_unknown = Bool}, CollectorOpt); - {hide_actions, Bool} when Bool =:= false -> - parse_opt(T, S#state{hide_actions = Bool}, CollectorOpt); - {hide_actions, Bool} when Bool =:= true -> - parse_opt(T, S#state{hide_actions = Bool}, CollectorOpt); - {display_mode, Mode = all} -> - parse_opt(T, S#state{display_mode = Mode}, CollectorOpt); - {display_mode, Mode = {search_actors, Dir, _Key, Actors}} when is_list(Actors), Dir =:= forward -> - parse_opt(T, S#state{display_mode = Mode}, CollectorOpt); - {display_mode, Mode = {search_actors, Dir, _Key, Actors}} when is_list(Actors), Dir =:= reverse -> - parse_opt(T, S#state{display_mode = Mode}, CollectorOpt); - - Bad -> - {error, {bad_option, Bad}} - end; -parse_opt(BadList, _S, _CollectorOpt) -> - {error, {bad_option_list, BadList}}. - -do_dict_insert({filter, Name}, Fun, S) when is_atom(Name), is_function(Fun) -> - F = #filter{name = Name, function = Fun}, - Filters = lists:keydelete(Name, #filter.name, S#state.filters), - Filters2 = lists:keysort(#filter.name, [F | Filters]), - gs:destroy(filter_menu), - create_filter_menu(S#state.active_filter, Filters2), - S#state{filters = Filters2}; -do_dict_insert(_Key, _Val, S) -> - %% ok = error_logger:format("~p(~p): handle_info({et, {dict_insert, ~p, ~p}})~n", - %% [?MODULE, self(), Key, Val]), - S. - -do_dict_delete({filter, Name}, S) when is_atom(Name), Name =/= S#state.active_filter -> - Filters = lists:keydelete(Name, #filter.name, S#state.filters), - gs:destroy(filter_menu), - create_filter_menu(S#state.active_filter, Filters), - S#state{filters = Filters}; -do_dict_delete(_Key, S) -> - %% ok = error_logger:format("~p(~p): handle_info({et, {dict_delete, ~p}})~n", - %% [?MODULE, self(), Key]), - S. - -%%%---------------------------------------------------------------------- -%%% Callback functions from gen_server -%%%---------------------------------------------------------------------- - -%%---------------------------------------------------------------------- -%% Func: init/1 -%% Returns: {ok, State} | -%% {ok, State, Timeout} | -%% ignore | -%% {stop, Reason} -%%---------------------------------------------------------------------- - -init([S]) when is_record(S, state) -> - process_flag(trap_exit, true), - InitialTimeout = 0, - case S#state.parent_pid of - undefined -> - ignore; - Pid when is_pid(Pid) -> - link(Pid) - end, - et_collector:dict_insert(S#state.collector_pid, - {subscriber, self()}, - ?MODULE), - {ok, create_main_window(S), InitialTimeout}. - -%%---------------------------------------------------------------------- -%% Func: handle_call/3 -%% Returns: {reply, Reply, State} | -%% {reply, Reply, State, Timeout} | -%% {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, Reply, State} | (terminate/2 is called) -%% {stop, Reason, State} (terminate/2 is called) -%%---------------------------------------------------------------------- - -handle_call(get_collector_pid, _From, S) -> - Reply = S#state.collector_pid, - reply(Reply, S); -handle_call(stop, _From, S) -> - gs:destroy(S#state.win), - {stop, shutdown, ok, S}; -handle_call(Request, From, S) -> - ok = error_logger:format("~p(~p): handle_call(~p, ~p, ~p)~n", - [?MODULE, self(), Request, From, S]), - Reply = {error, {bad_request, Request}}, - reply(Reply, S). - -%%---------------------------------------------------------------------- -%% Func: handle_cast/2 -%% Returns: {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} (terminate/2 is called) -%%---------------------------------------------------------------------- - -handle_cast(Msg, S) -> - ok = error_logger:format("~p(~p): handle_cast(~p, ~p)~n", - [?MODULE, self(), Msg, S]), - noreply(S). - -%%---------------------------------------------------------------------- -%% Func: handle_info/2 -%% Returns: {noreply, State} | -%% {noreply, State, Timeout} | -%% {stop, Reason, State} (terminate/2 is called) -%%---------------------------------------------------------------------- - -handle_info({et, {more_events, _Size}}, S) -> - noreply(S); -handle_info({et, {insert_actors, ActorNames}}, S) when is_list(ActorNames) -> - Fun = fun(N, Actors) -> - case lists:keymember(N, #actor.name, Actors) of - true -> Actors; - false -> Actors ++ [create_actor(N)] - end - end, - Actors = lists:foldl(Fun, S#state.actors, ActorNames), - S2 = refresh_main_window(S#state{actors = Actors}), - noreply(S2); -handle_info({et, {delete_actors, ActorNames}}, S) when is_list(ActorNames)-> - Fun = fun(N, Actors) when N =:= ?unknown -> - Actors; - (N, Actors) -> - lists:keydelete(N, #actor.name, Actors) - end, - New = lists:foldl(Fun, S#state.actors, ActorNames), - S2 = refresh_main_window(S#state{actors = New}), - noreply(S2); -handle_info({et, {dict_insert, Key, Val}}, S) -> - S2 = do_dict_insert(Key, Val, S), - noreply(S2); -handle_info({et, {dict_delete, Key}}, S) -> - S2 = do_dict_delete(Key, S), - noreply(S2); -handle_info({et, first}, S) -> - S2 = scroll_first(S), - noreply(S2); -handle_info({et, prev}, S) -> - S2 = scroll_prev(S), - noreply(S2); -handle_info({et, next}, S) -> - S2 = scroll_next(S), - noreply(S2); -handle_info({et, last}, S) -> - S2 = scroll_last(S), - noreply(S2); -handle_info({et, refresh}, S) -> - S2 = refresh_main_window(S), - noreply(S2); -handle_info({et, {display_mode, Mode}}, S) -> - S2 = change_display_mode(Mode, S), - noreply(S2); -handle_info({et, close}, S) -> - gs:destroy(S#state.win), - {stop, shutdown, S}; -handle_info({gs, Button, click, Data, Other} = Click, S) -> - CollectorPid = S#state.collector_pid, - case Button of - close -> - gs:destroy(S#state.win), - {stop, shutdown, S}; - suspended -> - case Other of - [_Text, _Group, Bool | _] when Bool =:= true -> - S2 = do_suspend(S), - noreply(S2); - [_Text, _Group, Bool | _] when Bool =:= false -> - S2 = do_resume(S), - noreply(S2); - _ -> - click_error(Click, S), - noreply(S) - end; - hide_actions -> - case Other of - [_Text, _Group, Bool | _] when Bool =:= true -> - S2 = refresh_main_window(S#state{hide_actions = Bool}), - noreply(S2); - [_Text, _Group, Bool | _] when Bool =:= false -> - S2 = refresh_main_window(S#state{hide_actions = Bool}), - noreply(S2); - _ -> - click_error(Click, S), - noreply(S) - end; - hide_unknown -> - case Other of - [_Text, _Group, Bool | _] when Bool =:= true -> - S2 = refresh_main_window(S#state{hide_unknown = Bool}), - noreply(S2); - [_Text, _Group, Bool | _] when Bool =:= false -> - S2 = refresh_main_window(S#state{hide_unknown = Bool}), - noreply(S2); - _ -> - click_error(Click, S), - noreply(S) - end; - up -> - S2 = scroll_up(S), - noreply(S2); - down -> - S2 = scroll_down(S), - noreply(S2); - first -> - S2 = scroll_first(S), - noreply(S2); - prev -> - S2 = scroll_prev(S), - noreply(S2); - next -> - S2 = scroll_next(S), - noreply(S2); - last -> - S2 = scroll_last(S), - noreply(S2); - refresh -> - S2 = refresh_main_window(S), - noreply(S2); - {display_mode, Mode} -> - S2 = change_display_mode(Mode, S), - noreply(S2); - close_all -> - close_all(S); - close_all_others -> - close_all_others(S); - first_all -> - et_collector:multicast(CollectorPid, first), - noreply(S); - prev_all -> - et_collector:multicast(CollectorPid, prev), - noreply(S); - next_all -> - et_collector:multicast(CollectorPid, next), - noreply(S); - last_all -> - et_collector:multicast(CollectorPid, last), - noreply(S); - refresh_all -> - et_collector:multicast(CollectorPid, refresh), - noreply(S); - clear_all -> - et_collector:clear_table(CollectorPid), - et_collector:multicast(CollectorPid, refresh), - noreply(S); - load_all -> - et_collector:start_trace_client(CollectorPid, event_file, "et_viewer.log"), - noreply(S); - save_all -> - et_collector:save_event_file(CollectorPid, - "et_viewer.log", - [existing, write, keep]), - noreply(S); - {open_viewer, Scale} -> - Actors = [A#actor.name || A <- S#state.actors], - open_viewer(Scale, S#state.active_filter, Actors, S), - noreply(S); - _Level when Data =:= detail_level, is_integer(hd(Other)), - hd(Other) >= ?detail_level_min, - hd(Other) =< ?detail_level_max -> - S2 = S#state{detail_level = hd(Other)}, - noreply(S2); - _PopupMenuItem when is_record(Data, filter) -> - open_viewer(S#state.scale, Data#filter.name, [?unknown], S), - noreply(S); - _ -> - click_error(Click, S), - noreply(S) - end; -handle_info({gs, _Obj, destroy,_, _}, S) -> - gs:destroy(S#state.win), - {stop, shutdown, S}; -handle_info({gs, _Obj, buttonpress, _, [_Button, X, Y | _]}, S) -> - S3 = - case y_to_n(Y, S) of - actor -> - %% Actor click - case S#state.actors of - [] -> - S; - _ -> - N = x_to_n(X, S), - A = lists:nth(N, S#state.actors), - S#state{selected_actor = A} - end; - {event, N} -> - %% Event click - List = queue_to_list(S#state.events), - S2 = S#state{events = list_to_queue(List)}, - - Key = lists:nth(N, List), - Pid = S#state.collector_pid, - Fun = fun create_contents_window/2, - case et_collector:iterate(Pid, Key, -1) of - Prev when Prev =:= Key -> - et_collector:iterate(Pid, first, 1, Fun, S2); - Prev -> - et_collector:iterate(Pid, Prev, 1, Fun, S2) - end - end, - noreply(S3); -handle_info({gs, _Obj, buttonrelease, _, [_Button, X, Y | _]}, S) -> - S2 = - case y_to_n(Y, S) of - actor -> - %% Actor click - case S#state.actors of - [] -> - S; - Actors -> - N = x_to_n(X, S), - New = lists:nth(N, S#state.actors), - Old = S#state.selected_actor, - case New#actor.name =:= Old#actor.name of - true -> - A = S#state.selected_actor, - toggle_search_for_actor(A#actor.name, S); - false -> - move_actor(Old, New, Actors, S) - end - end; - {event, _N} -> - %% Event click ignored - S - end, - noreply(S2); -handle_info({gs, _Obj, keypress, _, [KeySym, _Keycode, _Shift, _Control | _]} = Key, S) -> - case KeySym of - 'c' -> - close_all_others(S); - 'C' -> - close_all(S); - 'Up' -> - S2 = scroll_up(S), - noreply(S2); - 'Down' -> - S2 = scroll_down(S), - noreply(S2); - 'f' -> - S2 = scroll_first(S), - noreply(S2); - 'p' -> - S2 = scroll_prev(S), - noreply(S2); - 'Prior' -> - S2 = scroll_prev(S), - noreply(S2); - 'n' -> - S2 = scroll_next(S), - noreply(S2); - 'Next' -> - S2 = scroll_next(S), - noreply(S2); - 'l' -> - S2 = scroll_last(S), - noreply(S2); - 'r' -> - S2 = refresh_main_window(S), - noreply(S2); - 'F' -> - et_collector:multicast(S#state.collector_pid, first), - noreply(S); - 'P' -> - et_collector:multicast(S#state.collector_pid, prev), - noreply(S); - 'N' -> - et_collector:multicast(S#state.collector_pid, next), - noreply(S); - 'L' -> - et_collector:multicast(S#state.collector_pid, last), - noreply(S); - 'R' -> - et_collector:multicast(S#state.collector_pid, refresh), - noreply(S); - - 'a' -> - S2 = S#state{display_mode = all}, - S3 = refresh_main_window(S2), - noreply(S3); - - 'equal' -> - Scale = S#state.scale, - Actors = [A#actor.name || A <- S#state.actors], - open_viewer(Scale, S#state.active_filter, Actors, S), - noreply(S); - 'plus' -> - Scale = S#state.scale + 1, - Actors = [A#actor.name || A <- S#state.actors], - open_viewer(Scale, S#state.active_filter, Actors, S), - noreply(S); - 'minus' -> - case S#state.scale of - 1 -> - gs:config(S#state.canvas, beep); - Scale -> - Actors = [A#actor.name || A <- S#state.actors], - open_viewer(Scale - 1, S#state.active_filter, Actors, S) - end, - noreply(S); - 0 -> - case lists:keysearch(?DEFAULT_FILTER_NAME, #filter.name, S#state.filters) of - {value, F} when is_record(F, filter) -> - open_viewer(S#state.scale, F#filter.name, [?unknown], S); - false -> - gs:config(S#state.canvas, beep) - end, - noreply(S); - Int when is_integer(Int), Int > 0, Int =< 9 -> - case catch lists:nth(Int, S#state.filters) of - F when is_record(F, filter) -> - open_viewer(S#state.scale, F#filter.name, [?unknown], S); - {'EXIT', _} -> - gs:config(S#state.canvas, beep) - end, - noreply(S); - - 'Shift_L' -> - noreply(S); - 'Shift_R' -> - noreply(S); - 'Caps_Lock' -> - noreply(S); - - _ -> - click_error(Key, S), - noreply(S) - end; -handle_info({gs, _Obj,configure, [], [W, H | _]}, S) -> - gs:config(S#state.packer, [{width, W}, {height, H}]), - S2 = S#state{width = W, height = H}, - noreply(S2); -handle_info(timeout, S) -> - Try = - case S#state.display_mode of - {search_actors, reverse, _, _} -> - -10; - _ -> - 10 - end, - if - S#state.is_suspended =:= true -> - {noreply, S, infinity}; - S#state.max_events =:= infinity -> - display_more_events(Try, S); - true -> - Needed = S#state.max_events - queue_length(S#state.events), - if - Needed =< 0 -> {noreply, S, infinity}; - Needed > 10 -> display_more_events(Try, S); - Needed =< 10 -> display_more_events(Needed, S) - end - end; - -handle_info({'EXIT', Pid, Reason}, S) -> - if - Pid =:= S#state.collector_pid -> - unlink(Pid), - gs:destroy(S#state.win), - {stop, Reason, S}; - Pid =:= S#state.parent_pid -> - unlink(Pid), - gs:destroy(S#state.win), - {stop, Reason, S}; - true -> - noreply(S) - end; -handle_info(Info, S) -> - ok = error_logger:format("~p(~p): handle_info(~p, ~p)~n", - [?MODULE, self(), Info, S]), - noreply(S). - -%%---------------------------------------------------------------------- -%% Func: terminate/2 -%% Purpose: Shutdown the server -%% Returns: any (ignored by gen_server) -%%---------------------------------------------------------------------- - -terminate(_Reason, _S) -> - ignore. - -%%---------------------------------------------------------------------- -%% Func: code_change/3 -%% Purpose: Convert process state when code is changed -%% Returns: {ok, NewState} -%%---------------------------------------------------------------------- - -code_change(_OldVsn, S, _Extra) -> - {ok, S}. - -%%%---------------------------------------------------------------------- -%%% Handle suspend/resume -%%%---------------------------------------------------------------------- - -reply(Reply, S) -> - case queue_length(S#state.events) of - _ when S#state.is_suspended =:= true -> - {reply, Reply, S, infinity}; - _ when S#state.max_events =:= infinity -> - {reply, Reply, S, 500}; - N when N >= S#state.max_events -> - {reply, Reply, S, infinity}; - _ -> - {reply, Reply, S, 0} - end. - -noreply(S) -> - case queue_length(S#state.events) of - _ when S#state.is_suspended =:= true -> - {noreply, S, infinity}; - _ when S#state.max_events =:= infinity -> - {noreply, S, 500}; - N when N >= S#state.max_events -> - {noreply, S, infinity}; - _ -> - {noreply, S, 0} - end. - -do_suspend(S) -> - config_suspend(S#state{is_suspended = true}). - -do_resume(S) -> - config_suspend(S#state{is_suspended = false}). - -config_suspend(S) -> - Suspended = S#state.is_suspended, - gs:config(refresh, [{enable, not Suspended}]), - gs:config(refresh_all, [{enable, not Suspended}]), - gs:config(clear_all, [{enable, not Suspended}]), - S. - -refresh_main_window(S) -> - Pid = S#state.collector_pid, - Key = S#state.first_event, - case et_collector:iterate(Pid, Key, -1) of - Prev when Prev =:= Key -> - scroll_first(S); - _Prev -> - S2 = S#state{last_event = S#state.first_event}, - clear_canvas(S2) - end. - -scroll_first(S) -> - S2 = S#state{first_event = first, last_event = first}, - clear_canvas(S2). - -scroll_prev(S) -> - Try = - case S#state.max_events of - infinity -> -10; - Max -> -Max - end, - Key = et_collector:iterate(S#state.collector_pid, S#state.first_event, Try), - S2 = S#state{first_event = Key, last_event = Key}, - clear_canvas(S2). - -scroll_next(S) -> - S2 = S#state{first_event = S#state.last_event}, - clear_canvas(S2). - -scroll_up(S) -> - Key = et_collector:iterate(S#state.collector_pid, S#state.first_event, -5), - S2 = S#state{first_event = Key, last_event = Key}, - clear_canvas(S2). - -scroll_down(S) -> - Key = et_collector:iterate(S#state.collector_pid, S#state.first_event, 5), - S2 = S#state{first_event = Key, last_event = Key}, - clear_canvas(S2). - -scroll_last(S) -> - S2 = S#state{first_event = last, last_event = last}, - clear_canvas(S2). - -change_display_mode(Mode, S) -> - case Mode of - all -> - S2 = S#state{display_mode = Mode}, - refresh_main_window(S2); - {search_actors, _Dir, _Key, []} -> - S2 = S#state{display_mode = all}, - refresh_main_window(S2); - {search_actors, _Dir, Key, Actors} when is_list(Actors) -> - Pid = S#state.collector_pid, - Prev = et_collector:iterate(Pid, Key, -1), - S2 = S#state{first_event = Prev, - last_event = Prev, - display_mode = Mode}, - clear_canvas(S2) - end. - -close_all(S) -> - et_collector:multicast(S#state.collector_pid, close), - timer:sleep(timer:seconds(1)), - spawn(et_collector, stop, [S#state.collector_pid]), - gs:destroy(S#state.win), - {stop, shutdown, S}. - -close_all_others(S) -> - Fun = - fun({{subscriber, Pid}, _}) -> - if - Pid =:= self() -> - ignore; - true -> - unlink(Pid), - Pid ! {et, close} - end - end, - All = et_collector:dict_match(S#state.collector_pid, - {{subscriber, '_'}, '_'}), - lists:foreach(Fun, All), - noreply(S). - -click_error(Click, S) -> - gs:config(S#state.canvas, beep), - io:format("~p: ignored: ~p~n", [?MODULE, Click]). - -%%%---------------------------------------------------------------------- -%%% Clone viewer -%%%---------------------------------------------------------------------- - -open_viewer(Scale, FilterName, Actors, S) -> - Filters = [{dict_insert, {filter, F#filter.name}, F#filter.function} - || F <- S#state.filters], - Options = - [{parent_pid, S#state.parent_pid}, - {title, S#state.title}, - {collector_pid, S#state.collector_pid}, - {is_suspended, S#state.is_suspended}, - {detail_level, S#state.detail_level}, - {active_filter, FilterName}, - {event_order, S#state.event_order}, - {first_event, S#state.first_event}, - {max_events, S#state.max_events}, - {max_actors, S#state.max_actors}, - {hide_actions, S#state.hide_actions}, - {hide_unknown, S#state.hide_unknown}, - {is_suspended, S#state.is_suspended}, - {actors, Actors}, - {scale, Scale}, - {width, S#state.width}, - {height, S#state.height} | Filters], - case start_link(Options) of - {ok, ViewerPid} -> - unlink(ViewerPid), - ok; - {error, Reason} -> - ok = error_logger:format("~p: Failed to start a new window: ~p~n", - [?MODULE, Reason]) - end. - -%%%---------------------------------------------------------------------- -%%% Handle graphics -%%%---------------------------------------------------------------------- - -create_main_window(S) -> - Font = select_font(S#state.scale), - GS = gs:start(), - Name = name_to_string(S#state.active_filter), - Title = case S#state.title of - undefined -> atom_to_list(?MODULE); - Explicit -> name_to_string(Explicit) - end, - WinOpt = [{title, Title ++ " (filter: " ++ Name ++ ")"}, - {configure, true}, - {width, S#state.width}, - {height, S#state.height}], - Win = gs:window(GS, WinOpt), - Bar = gs:menubar(Win, []), - - create_file_menu(Bar), - create_viewer_menu(Bar), - create_collector_menu(Bar), - gs:menubutton(filter_button, Bar, [{label, {text, "Filter"}}]), - create_filter_menu(S#state.active_filter, S#state.filters), - create_help_menu(Bar), - - config_suspend(S), - - PackerOpt = [{packer_x, [{fixed, 5}, {fixed, 40}, {fixed, 40}, - {stretch, 1}, {fixed, 5}]}, - {packer_y, [{fixed, 30}, {fixed, 30}, - {stretch, 1}, {fixed, 30}]}, - {x, 0}, {y, 30}], - Packer = gs:frame(Win, PackerOpt), - gs:checkbutton(suspended, Packer, [{label,{text,"Freeze"}}, - {x, 10}, {y, 0}, - {width, 120}, {align, w}, - {select, S#state.is_suspended}]), - gs:checkbutton(hide_actions, Packer, [{label,{text,"Hide From=To"}}, - {x, 10}, {y, 20}, - {width, 120}, {align, w}, - {select, S#state.hide_actions}]), - gs:checkbutton(hide_unknown, Packer, [{label,{text,"Hide Unknown"}}, - {x, 10}, {y, 40}, - {width, 120}, {align, w}, - {select, S#state.hide_unknown}]), - gs:scale(Packer, [{text,"Detail Level"}, - {range, {?detail_level_min, ?detail_level_max}}, - {orient, horizontal}, - {x, 150}, {y, 0}, {height, 65}, {width, 200}, - {pos, S#state.detail_level}, {data, detail_level}]), - CanvasW = calc_canvas_width(S), - CanvasH = calc_canvas_height(S), - CanOpt = [{pack_xy, {{2, 4}, 3}}, {vscroll, right}, {hscroll, bottom}, - {scrollregion, {2, 2, CanvasW, CanvasH}}], - Canvas = gs:canvas(Packer, CanOpt), - gs:config(Canvas, [{buttonpress, true}, {buttonrelease, true}]), - gs:config(Packer, [{width, S#state.width}, {height, S#state.height}]), - gs:config(Win, [{map, true}, {keypress, true}]), - S2 = S#state{title = Title, - win = Win, font = Font, packer = Packer, - canvas_width = CanvasW, canvas_height = CanvasH, - canvas = Canvas, - y_pos = ?initial_y * S#state.scale}, - draw_all_actors(S2). - -select_font(Scale) when is_integer(Scale) -> - case Scale of - 1 -> {courier, 7}; - 2 -> {courier, 10}; - 3 -> {courier, 12}; - 4 -> {courier, 14}; - S -> {courier, S * 4} - end. - -create_file_menu(Bar) -> - Button = gs:menubutton(Bar, [{label, {text, "File"}}]), - Menu = gs:menu(Button, []), - gs:menuitem(close_all, Menu, [{label, {text, "Close Collector and all Viewers (C) "}}]), - gs:menuitem(close_all_others, Menu, [{label, {text, "Close other Viewers, but keep Collector (c)"}}]), - gs:menuitem(close, Menu, [{label, {text, "Close this Viewer, but keep Collector"}}]), - gs:menuitem(Menu, [{itemtype, separator}]), - - gs:menuitem(clear_all, Menu, [{label, {text, "Clear Collector"}}]), - gs:menuitem(load_all, Menu, [{label, {text, "Load Collector from the file \"et_viewer.log\""}}]), - gs:menuitem(save_all, Menu, [{label, {text, "Save Collector to the file \"et_viewer.log\""}}]). - -create_viewer_menu(Bar) -> - Button = gs:menubutton(Bar, [{label, {text, "Viewer"}}]), - Menu = gs:menu(Button, []), - gs:menuitem(Menu, [{label, {text, "Scroll this Viewer"}}, {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(first, Menu, [{label, {text, "First (f)"}}]), - gs:menuitem(prev, Menu, [{label, {text, "Prev (p)"}}]), - gs:menuitem(next, Menu, [{label, {text, "Next (n)"}}]), - gs:menuitem(last, Menu, [{label, {text, "Last (l)"}}]), - gs:menuitem(refresh, Menu, [{label, {text, "Refresh (r)"}}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(up, Menu, [{label, {text, "Up 5 (Up)"}}]), - gs:menuitem(down, Menu, [{label, {text, "Down 5 (Down)"}}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(Menu, [{label, {text, "Search in this Viewer"}}, {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem({mode, all}, Menu, [{label, {text, "Abort search. Display all (a)"}}]). - -create_collector_menu(Bar) -> - Button = gs:menubutton(Bar, [{label, {text, "Collector"}}]), - Menu = gs:menu(Button, []), - gs:menuitem(Menu, [{label, {text, "Scroll all Viewers"}}, {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(first_all, Menu, [{label, {text, "First (F)"}}]), - gs:menuitem(prev_all, Menu, [{label, {text, "Prev (P)"}}]), - gs:menuitem(next_all, Menu, [{label, {text, "Next (N)"}}]), - gs:menuitem(last_all, Menu, [{label, {text, "Last (L)"}}]), - gs:menuitem(refresh_all, Menu, [{label, {text, "Refresh (R)"}}]). - -create_filter_menu(ActiveFilterName, Filters) -> - Menu = gs:menu(filter_menu, filter_button, []), - Item = fun(F, N) when F#filter.name =:= collector -> - Label = lists:concat([pad_string(F#filter.name, 20), "(0)"]), - gs:menuitem(Menu, [{label, {text, Label}}, {data, F}]), - N + 1; - (F, N) -> - Label = lists:concat([pad_string(F#filter.name, 20), "(", N, ")"]), - gs:menuitem(Menu, [{label, {text, Label}}, {data, F}]), - N + 1 - end, - gs:menuitem(Menu, [{label, {text, "Same Filter New Scale"}}, {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - {value, Filter} = lists:keysearch(ActiveFilterName, #filter.name, Filters), - Same = lists:concat([pad_string(ActiveFilterName, 20), "(=)"]), - Larger = lists:concat([pad_string(ActiveFilterName, 20), "(+)"]), - Smaller = lists:concat([pad_string(ActiveFilterName, 20), "(-)"]), - gs:menuitem(Menu, [{label, {text, Same}}, {data, Filter}]), - gs:menuitem(Menu, [{label, {text, Smaller}}, {data, Filter}]), - gs:menuitem(Menu, [{label, {text, Larger}}, {data, Filter}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(Menu, [{label, {text, "New Filter Same Scale"}}, {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - lists:foldl(Item, 1, Filters). - -create_help_menu(Bar) -> - Button = gs:menubutton(Bar, [{label, {text, "Help"}}]), - Menu = gs:menu(Button, []), - gs:menuitem(Menu, [{label, {text, "Display details of an event"}}, - {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{label, {text, " Single click on the name tag or the arrow (Mouse-1)"}}, - {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(Menu, [{label, {text, "Toggle actor search"}}, - {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{label, {text, " Single click on the name tag (Mouse-1)"}}, - {enable,false}]), - gs:menuitem(Menu, [{itemtype, separator}]), - gs:menuitem(Menu, [{label, {text, "Move actor"}}, - {bg, lightblue}, {enable,false}]), - gs:menuitem(Menu, [{label, {text, " se drag and drop on name tag (Mouse-1)"}}, - {enable,false}]). - -clear_canvas(S) -> - gs:destroy(S#state.canvas), - CanvasW = calc_canvas_width(S), - CanvasH = calc_canvas_height(S), - CanOpt = [{pack_xy, {{2, 4}, 3}}, {vscroll, right}, {hscroll, bottom}, - {scrollregion, {2, 2, CanvasW, CanvasH}}], - Canvas = gs:canvas(S#state.packer, CanOpt), - gs:config(S#state.packer, [{width, S#state.width}, {height, S#state.height}]), - gs:config(Canvas, [{buttonpress, true}, {buttonrelease, true}]), - S2 = S#state{refresh_needed = false, - y_pos = ?initial_y * S#state.scale, - canvas = Canvas, - canvas_width = CanvasW, - canvas_height = CanvasH, - events = queue_new()}, - draw_all_actors(S2). - -calc_canvas_width(S) -> - Min = calc_min_actors(S), - CanvasW = ((2 * ?initial_x) + (Min * ?incr_x)) * S#state.scale, - lists:max([CanvasW, S#state.width - (15 * S#state.scale), S#state.canvas_width]). - -calc_canvas_height(S) -> - Min = calc_min_events(S), - CanvasH = ((2 * ?initial_y) + (Min * ?incr_y)) * S#state.scale, - lists:max([CanvasH, S#state.height - (4 * 30), S#state.canvas_height]). - -calc_min_actors(S) -> - Max = S#state.max_actors, - N = length(S#state.actors), - if - Max =:= infinity -> - N * 2; - Max < N -> - N; - true -> - Max - end. - -calc_min_events(S) -> - Max = S#state.max_events, - N = queue_length(S#state.events), - if - Max =:= infinity -> - N * 2; - Max < N -> - N; - true -> - Max - end. - -display_more_events(Try, S) -> - Name = S#state.active_filter, - {value, F} = lists:keysearch(Name, #filter.name, S#state.filters), - FilterFun = F#filter.function, - Fun = fun(Event, State) -> - case catch FilterFun(Event) of - true -> - State2 = ensure_key(Event, State), - opt_display_event(Event, State2); - {true, Event2} -> - State2 = ensure_key(Event2, State), - opt_display_event(Event2, State2); - false -> - ensure_key(Event, State); - Bad -> - Contents = {bad_filter, Name, Bad, Event}, - Event2 = Event#event{contents = Contents, - from = bad_filter, - to = bad_filter}, - State2 = ensure_key(Event2, State), - opt_display_event(Event2, State2) - end - end, - Pid = S#state.collector_pid, - S2 = et_collector:iterate(Pid, S#state.last_event, Try, Fun, S), - case queue_length(S2#state.events) - queue_length(S#state.events) of - Diff when Diff =:= Try -> - %% Got as much as requested, look for more - %% io:format("Done: ~p~n", [{Try, Diff}]), - {noreply, S2, 0}; - _Diff when S2#state.first_event =:= S#state.first_event, - S2#state.last_event =:= S#state.last_event -> - %% Got lesser than requested, wait a while before looking for more - %% io:format("More: ~p~n", [{Try, Diff}]), - {noreply, S2, 500}; - _Diff -> - %% Got lesser than requested, look for more - %% io:format("More2: ~p~n", [{Try, Diff}]), - {noreply, S2, 0} - end. - -ensure_key(E, S) when is_record(E, event), is_record(S, state) -> - Key = et_collector:make_key(S#state.event_order, E), - case S#state.first_event of - first -> - S#state{first_event = Key, last_event = Key}; - last -> - S#state{first_event = Key, last_event = Key}; - _ -> - S#state{last_event = Key} - end. - -opt_display_event(E, S) -> - case S#state.display_mode of - all -> - display_event(E, S); - {search_actors, _Dir, _FirstKey, Actors} -> - %% Key = S#state.last_event, - From = select_actor_name(E#event.from, S), - case lists:member(From, Actors) of - true -> - display_event(E, S); - false -> - To = select_actor_name(E#event.to, S), - case lists:member(To, Actors) of - true -> - display_event(E, S); - false -> - S - end - end - end. - -select_actor_name(Name, S) -> - case lists:keymember(Name, #actor.name, S#state.actors) of - true -> Name; - false -> ?unknown - end. - -display_event(E, S) when E#event.detail_level < S#state.detail_level -> - {FromRefresh, From} = ensure_actor(E#event.from, S), - {FromName, FromPos, S2} = From, - {ToRefresh, To} = ensure_actor(E#event.to, S2), - {ToName, ToPos, S3} = To, - if - FromRefresh =/= false, ToRefresh =/= false -> - Key = S#state.last_event, - refresh_beep(S), - S3#state{refresh_needed = true, - events = queue_in(Key, S3#state.events)}; - FromName =:= ToName -> - case S#state.hide_actions of - true -> - S3; - false -> - Label = name_to_string(E#event.label), - draw_named_arrow(Label, FromName, FromPos, ToName, ToPos, S3) - end; - true -> - Label = name_to_string(E#event.label), - draw_named_arrow(Label, FromName, FromPos, ToName, ToPos, S3) - end; -display_event(_, S) -> - S. - -draw_named_arrow(Label, FromName, FromPos, ToName, ToPos, S) -> - Key = S#state.last_event, - case S#state.y_pos + (?incr_y * S#state.scale) of - _ when S#state.hide_unknown =:= true, FromName =:= ?unknown -> - S; - _ when S#state.hide_unknown =:= true, ToName =:= ?unknown -> - S; - Y when Y > S#state.canvas_height -> - refresh_beep(S), - S#state{refresh_needed = true, - events = queue_in(Key, S#state.events)}; - Y -> - S2 = S#state{y_pos = Y, events = queue_in(Key, S#state.events)}, - S3 = draw_arrow(FromPos, ToPos, S2), - draw_label(Label, FromName, ToName, FromPos, ToPos, S3) - end. - -refresh_beep(S) -> - case S#state.refresh_needed of - false -> - gs:config(S#state.canvas, beep), - gs:config(S#state.canvas, beep), - gs:config(S#state.canvas, beep); - true -> - ignore - end. - -draw_arrow(Pos, Pos, S) -> - S; -draw_arrow(FromPos, ToPos, S) -> - Y = S#state.y_pos, - CanOpts = [{coords, [{FromPos , Y}, {ToPos, Y}]}, - {arrow, last},{width, 1}, {fg, black}], - gs:line(S#state.canvas, CanOpts), - S. - -draw_label(Label, FromName, ToName, FromPos, ToPos, S) -> - Colour = - if - FromName =:= ?unknown, - ToName =:= ?unknown -> blue; %turquoise; - FromName =:= ?unknown -> orange; - ToName =:= ?unknown -> orange; - FromPos =:= ToPos -> blue; - true -> red - end, - Scale = S#state.scale, - X = lists:min([FromPos, ToPos]) + (6 * Scale), - Y = S#state.y_pos, - write_text(Label, X, Y, Colour, S), - S. - -draw_all_actors(State) -> - Scale = State#state.scale, - Fun = fun(A, X) -> - draw_actor(A, X, State), - X + (?incr_x * Scale) - end, - lists:foldl(Fun, ?initial_x * Scale, State#state.actors), - State. - -%% Returns: {NeedsRefreshBool, {ActorPos, NewsS, NewActors}} -ensure_actor(Name, S) -> - do_ensure_actor(Name, S, S#state.actors, 0). - -do_ensure_actor(Name, S, [H | _], N) when H#actor.name =:= Name -> - Pos = (?initial_x + (N * ?incr_x)) * S#state.scale, - {false, {Name, Pos, S}}; -do_ensure_actor(Name, S, [_ | T], N) -> - do_ensure_actor(Name, S, T, N + 1); -do_ensure_actor(Name, S, [], N) -> - %% A brand new actor, let's see if it does fit - Pos = (?initial_x + (N * ?incr_x)) * S#state.scale, - MaxActors = S#state.max_actors, - if - is_integer(MaxActors), N > MaxActors -> - %% Failed on max_actors limit, put into unknown - %% Assume that unknown always is in actor list - ensure_actor(?unknown, S); - Pos > (S#state.canvas_width - ((?initial_x - 15) * S#state.scale)) -> - %% New actor does not fit in canvas, refresh needed - A = create_actor(Name), - draw_actor(A, Pos, S), - {true, {Name, Pos, S#state{actors = S#state.actors ++ [A]}}}; - true -> - %% New actor fits in canvas. Draw the new actor. - A = create_actor(Name), - draw_actor(A, Pos, S), - {false, {Name, Pos, S#state{actors = S#state.actors ++ [A]}}} - end. - -draw_actor(A, LineX, S) -> - Scale = S#state.scale, - TextX = LineX - (5 * Scale), - TextY = ?initial_y * Scale, - LineTopY = TextY + ((?incr_y / 2) * Scale), - LineBotY = S#state.canvas_height - ((?incr_y / 2) * Scale), - Colour = case A#actor.name of - ?unknown -> orange; - _ -> red - end, - write_text(A#actor.string, TextX, TextY, Colour, S), - LineOpt = [{coords, [{LineX, LineTopY}, {LineX, LineBotY}]}, - {width, 1}, {fg, Colour}], - gs:line(S#state.canvas, LineOpt). - -toggle_search_for_actor(ActorName,S) -> - case S#state.display_mode of - all -> - io:format("~p: search for: ~p ++ ~p~n", [?MODULE, [], [ActorName]]), - %% Search for this actor - Key = S#state.first_event, - Actors = [ActorName], - Mode = {search_actors, forward, Key, Actors}, - change_display_mode(Mode, S); - {search_actors, Dir, Key, Actors}-> - Actors2 = - case lists:member(ActorName, Actors) of - true -> - io:format("~p: search for: ~p -- ~p~n", [?MODULE, Actors, [ActorName]]), - %% Remove actor from search list - Actors -- [ActorName]; - false -> - io:format("~p: search for: ~p ++ ~p~n", [?MODULE, Actors, [ActorName]]), - %% Add actor from search list - [ActorName | Actors] - end, - Mode2 = {search_actors, Dir, Key, Actors2}, - change_display_mode(Mode2, S) - end. - -move_actor(From, To, Actors, S) -> - Pos = #actor.name, - ToName = To#actor.name, - FromName = From#actor.name, - ToIx = actor_index(ToName, Pos, Actors), - FromIx = actor_index(FromName, Pos, Actors), - if - FromIx =/= 0, ToIx =/= 0, ToIx > FromIx -> - Actors2 = lists:keydelete(FromName, Pos, Actors), - Actors3 = insert_actor_after(From, To, Actors2), - S2 = S#state{actors = Actors3}, - refresh_main_window(S2); - FromIx =/= 0, ToIx =/= 0 -> - Actors2 = lists:keydelete(FromName, Pos, Actors), - Actors3 = insert_actor_before(From, To, Actors2), - S2 = S#state{actors = Actors3}, - refresh_main_window(S2); - true -> - %% Ignore - S - end. - -insert_actor_after(From, To, [H | T]) -> - case To#actor.name =:= H#actor.name of - true -> [H, From | T]; - false -> [H | insert_actor_after(From, To, T)] - end; -insert_actor_after(_From, _To, []) -> - []. - -insert_actor_before(From, To, [H | T]) -> - case To#actor.name =:= H#actor.name of - true -> [From, H | T]; - false -> [H | insert_actor_before(From, To, T)] - end; -insert_actor_before(_From, _To, []) -> - []. - -actor_index(_Key, _Pos, []) -> - 0; -actor_index(Key, Pos, [H | T]) -> - case Key =:= element(Pos, H) of - false -> actor_index(Key, Pos, T) + 1; - true -> 1 - end. - -y_to_n(Y, S) -> - Y2 = ((Y / S#state.scale) - ?initial_y + (?incr_y / 2)), - N = round(Y2 / ?incr_y - 0.2), - MaxN = queue_length(S#state.events), - if - N =< 0 -> actor; - N > MaxN -> actor; - true -> {event, N} - end. - -x_to_n(X, S) -> - Scale = S#state.scale, - Len = length(S#state.actors), - X2 = X - (?initial_x * Scale), - N = X2 / (?incr_x * Scale), - N2 = trunc(N + 1.5), - if - N2 > Len -> Len; - N2 < 1 -> 1; - true -> N2 - end. - -write_text(Text, X, Y, Colour, S) -> - Opt = [{coords, [{X, Y - (?incr_y * S#state.scale / 2)}]}, - {font, S#state.font}, {fg, Colour}, {text, Text}], - gs:text(S#state.canvas, Opt). - -create_contents_window(Event, S) -> - Options = [{viewer_pid, self()}, - {event, Event}, - {event_order, S#state.event_order}, - {active_filter, S#state.active_filter} - | S#state.filters], - case et_gs_contents_viewer:start_link(Options) of - {ok, _Pid} -> - S; - {error, Reason} -> - ok = error_logger:format("~p(~p): create_contents_window(~p) ->~n ~p~n", - [?MODULE, self(), Options, Reason]), - S - end. - -%%%---------------------------------------------------------------------- -%%% String padding of actors -%%%---------------------------------------------------------------------- - -create_actor(Name) -> - String = name_to_string(Name), - PaddedString = pad_string(String, 8), - #actor{name = Name, string = PaddedString}. - -name_to_string(Name) -> - case catch io_lib:format("~s", [Name]) of - {'EXIT', _} -> lists:flatten(io_lib:format("~w", [Name])); - GoodString -> lists:flatten(GoodString) - end. - -pad_string(Atom, MinLen) when is_atom(Atom) -> - pad_string(atom_to_list(Atom), MinLen); -pad_string(String, MinLen) when is_integer(MinLen), MinLen >= 0 -> - Len = length(String), - case Len >= MinLen of - true -> - String; - false -> - String ++ lists:duplicate(MinLen - Len, $ ) - end. - -%%%---------------------------------------------------------------------- -%%% Queue management -%%%---------------------------------------------------------------------- - -queue_new() -> - {0, [], []}. - -queue_in(X, {Size, In, Out}) -> - {Size + 1, [X | In], Out}. - -%% queue_out(Q) -> -%% case Q of -%% {Size, In, [H | Out]} -> {{value, H}, {Size - 1, In, Out}}; -%% {Size, [], []} -> {empty, {Size, [], []}}; -%% {Size, In, _} -> queue_out({Size, [], lists:reverse(In)}) -%% end. - -queue_to_list({_Size, [], Out}) -> - Out; -queue_to_list({_Size, In, Out}) -> - Out ++ lists:reverse(In). - -queue_length({Size, _In, _Out}) -> - Size. - -list_to_queue(List) when is_list(List) -> - {length(List), [], List}. diff --git a/lib/et/src/et_internal.hrl b/lib/et/src/et_internal.hrl index 419d35afcd..fdcd6f3dcc 100644 --- a/lib/et/src/et_internal.hrl +++ b/lib/et/src/et_internal.hrl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2002-2010. All Rights Reserved. +%% Copyright Ericsson AB 2002-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% diff --git a/lib/et/src/et_selector.erl b/lib/et/src/et_selector.erl index c8e9c907b2..a0297c21d1 100644 --- a/lib/et/src/et_selector.erl +++ b/lib/et/src/et_selector.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2001-2010. All Rights Reserved. +%% Copyright Ericsson AB 2001-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -22,11 +23,11 @@ -module(et_selector). --export([ - make_pattern/1, +-export([make_pattern/1, change_pattern/1, - parse_event/2 - ]). + parse_event/2]). + +-compile([{nowarn_deprecated_function,[{erlang,now,0}]}]). -include("../include/et.hrl"). @@ -532,7 +533,7 @@ parse_event(Mod, Trace, ParsedTS, ReportedTS, From, Label, Contents) -> {from, From}, {to, From}, {mfa, MFA}]}}; % MFA | 0 - gc_start -> + gc_minor_start -> DetailLevel = 80, [GcKeyValueList] = Contents, {true, #event{detail_level = DetailLevel, @@ -546,7 +547,7 @@ parse_event(Mod, Trace, ParsedTS, ReportedTS, From, Label, Contents) -> {from, From}, {to, From}, {gc_items, GcKeyValueList}]}}; - gc_end -> + gc_minor_end -> DetailLevel = 85, [GcKeyValueList] = Contents, {true, #event{detail_level = DetailLevel, @@ -556,10 +557,38 @@ parse_event(Mod, Trace, ParsedTS, ReportedTS, From, Label, Contents) -> to = From, label = Label, contents = [{label, Label}, - {detail_level, DetailLevel}, - {from, From}, - {to, From}, - {gc_items, GcKeyValueList}]}}; + {detail_level, DetailLevel}, + {from, From}, + {to, From}, + {gc_items, GcKeyValueList}]}}; + gc_major_start -> + DetailLevel = 80, + [GcKeyValueList] = Contents, + {true, #event{detail_level = DetailLevel, + trace_ts = ReportedTS, + event_ts = ParsedTS, + from = From, + to = From, + label = Label, + contents = [{label, Label}, + {detail_level, DetailLevel}, + {from, From}, + {to, From}, + {gc_items, GcKeyValueList}]}}; + gc_major_end -> + DetailLevel = 85, + [GcKeyValueList] = Contents, + {true, #event{detail_level = DetailLevel, + trace_ts = ReportedTS, + event_ts = ParsedTS, + from = From, + to = From, + label = Label, + contents = [{label, Label}, + {detail_level, DetailLevel}, + {from, From}, + {to, From}, + {gc_items, GcKeyValueList}]}}; _ -> error_logger:format("~p(~p): Ignoring unknown trace type -> ~p~n~n", [?MODULE, ?LINE, Trace]), diff --git a/lib/et/src/et_viewer.erl b/lib/et/src/et_viewer.erl index d9bd01f8d0..3928764c7f 100644 --- a/lib/et/src/et_viewer.erl +++ b/lib/et/src/et_viewer.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2010. All Rights Reserved. +%% Copyright Ericsson AB 2000-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -76,7 +77,7 @@ start() -> %% start(Options) -> {ok, ViewerPid} | {error, Reason} %%---------------------------------------------------------------------- -start(GUI) when GUI =:= wx; GUI =:= gs; GUI =:= default -> +start(GUI) when GUI =:= wx; GUI =:= default -> start_link([{trace_global, true}], GUI); start(Options) -> start_link([{parent_pid, undefined} | Options], default). @@ -139,7 +140,7 @@ start(Options, GUI) -> %% and returns false | true | {true, NewEvent}. %%---------------------------------------------------------------------- -start_link(GUI) when GUI =:= wx; GUI =:= gs; GUI =:= default -> +start_link(GUI) when GUI =:= wx; GUI =:= default -> start_link([{trace_global, true}], GUI); start_link(Options) -> start_link(Options, default). @@ -148,22 +149,11 @@ start_link(Options, GUI) -> case GUI of wx -> et_wx_viewer:start_link(Options); - gs -> - et_gs_viewer:start_link(Options); default -> start_link(Options, which_gui()) end. - -which_gui() -> - try - wx:new(), - wx:destroy(), - wx - catch _:_ -> - gs - end. - +which_gui() -> wx. get_collector_pid(ViewerPid) -> call(ViewerPid, get_collector_pid). diff --git a/lib/et/src/et_wx_contents_viewer.erl b/lib/et/src/et_wx_contents_viewer.erl index b559da8807..247dd4c7ba 100644 --- a/lib/et/src/et_wx_contents_viewer.erl +++ b/lib/et/src/et_wx_contents_viewer.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2012. All Rights Reserved. +%% Copyright Ericsson AB 2000-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -88,7 +89,7 @@ start_link(Options) -> S#state.parent_pid =/= self() -> unlink(Pid); true -> - ignore + ok end, {ok, Pid} catch @@ -241,11 +242,12 @@ handle_event(#wx{id = Id, S) -> case proplists:get_value(Id, S#state.menu_data) of undefined -> - ignore; + ok; Data when is_record(Data, filter) -> F = Data, - ChildState= S#state{active_filter = F#filter.name}, - wx_object:start_link(?MODULE, [ChildState], []); + ChildState = S#state{active_filter = F#filter.name}, + _ = wx_object:start_link(?MODULE, [ChildState], []), + ok; {hide, Actors} -> send_viewer_event(S, {delete_actors, Actors}); {show, Actors} -> @@ -266,7 +268,7 @@ handle_event(#wx{id = Id, TimeStamp = case S#state.event_order of trace_ts -> Event#event.trace_ts; - event_ts -> Event#event.event_ts + event_ts -> Event#event.event_ts end, FileName = lists:flatten(["et_contents_viewer_", now_to_string(TimeStamp), ".txt"]), Style = ?wxFD_SAVE bor ?wxFD_OVERWRITE_PROMPT, @@ -274,7 +276,7 @@ handle_event(#wx{id = Id, case select_file(S#state.frame, Msg, filename:absname(FileName), Style) of {ok, FileName2} -> Bin = list_to_binary(event_to_string(Event, S#state.event_order)), - file:write_file(FileName2, Bin); + ok = file:write_file(FileName2, Bin); cancel -> ok end, @@ -350,19 +352,21 @@ handle_event(#wx{event = #wxKey{rawCode = KeyCode}}, S) -> $0 -> case lists:keysearch(?DEFAULT_FILTER_NAME, #filter.name, S#state.filters) of {value, F} when is_record(F, filter) -> - ChildState= S#state{active_filter = F#filter.name}, - wx_object:start_link(?MODULE, [ChildState], []); + ChildState = S#state{active_filter = F#filter.name}, + _ = wx_object:start_link(?MODULE, [ChildState], []), + ok; false -> - ignore + ok end, {noreply, S}; Int when is_integer(Int), Int > $0, Int =< $9 -> case catch lists:nth(Int-$0, S#state.filters) of F when is_record(F, filter) -> - ChildState= S#state{active_filter = F#filter.name}, - wx_object:start_link(?MODULE, [ChildState], []); + ChildState = S#state{active_filter = F#filter.name}, + _ = wx_object:start_link(?MODULE, [ChildState], []), + ok; {'EXIT', _} -> - ignore + ok end, {noreply, S}; @@ -442,11 +446,11 @@ create_window(S) -> Title = lists:concat([?MODULE, " (filter: ", Name, ")"]), WinOpt = [{size, {W,H}}], Frame = wxFrame:new(wx:null(), ?wxID_ANY, Title, WinOpt), - wxFrame:createStatusBar(Frame), + _ = wxFrame:createStatusBar(Frame), Panel = wxPanel:new(Frame, []), Bar = wxMenuBar:new(), - wxFrame:setMenuBar(Frame,Bar), + _ = wxFrame:setMenuBar(Frame,Bar), create_file_menu(Bar), Editor = wxTextCtrl:new(Panel, ?wxID_ANY, [{style, 0 bor ?wxDEFAULT @@ -456,21 +460,21 @@ create_window(S) -> bor ?wxTE_DONTWRAP}]), Font = wxFont:new(10, ?wxFONTFAMILY_TELETYPE, ?wxNORMAL, ?wxNORMAL,[]), TextAttr = wxTextAttr:new(?wxBLACK, [{font, Font}]), - wxTextCtrl:setDefaultStyle(Editor, TextAttr), + _ = wxTextCtrl:setDefaultStyle(Editor, TextAttr), Sizer = wxBoxSizer:new(?wxHORIZONTAL), - wxSizer:add(Sizer, Editor, [{flag, ?wxEXPAND}, {proportion, 1}]), + _ = wxSizer:add(Sizer, Editor, [{flag, ?wxEXPAND}, {proportion, 1}]), FilteredEvent = config_editor(Editor, S), S2 = S#state{win = Frame, panel = Panel, filtered_event = FilteredEvent}, HideData = create_hide_menu(Bar, S2), SearchData = create_search_menu(Bar, S2), FilterData = create_filter_menu(Bar, S#state.filters), - wxFrame:connect(Frame, command_menu_selected, []), - wxFrame:connect(Frame, key_up), - wxFrame:connect(Frame, close_window, [{skip,true}]), - wxFrame:setFocus(Frame), - wxPanel:setSizer(Panel, Sizer), - wxSizer:fit(Sizer, Panel), - wxFrame:show(Frame), + _ = wxFrame:connect(Frame, command_menu_selected, []), + _ = wxFrame:connect(Frame, key_up), + _ = wxFrame:connect(Frame, close_window, [{skip,true}]), + _ = wxFrame:setFocus(Frame), + _ = wxPanel:setSizer(Panel, Sizer), + _ = wxSizer:fit(Sizer, Panel), + _ = wxFrame:show(Frame), S2#state{menu_data = HideData++SearchData++FilterData, editor = Editor, frame = Frame}. menuitem(Menu, Id, Text, UserData) -> @@ -479,16 +483,17 @@ menuitem(Menu, Id, Text, UserData) -> create_file_menu(Bar) -> Menu = wxMenu:new([]), - wxMenu:append(Menu, ?wxID_SAVE, "Save"), - wxMenu:append(Menu, ?wxID_PRINT,"Print"), - wxMenu:appendSeparator(Menu), - wxMenu:append(Menu, ?wxID_EXIT, "Close"), - wxMenuBar:append(Bar, Menu, "File"). + _ = wxMenu:append(Menu, ?wxID_SAVE, "Save"), + _ = wxMenu:append(Menu, ?wxID_PRINT,"Print"), + _ = wxMenu:appendSeparator(Menu), + _ = wxMenu:append(Menu, ?wxID_EXIT, "Close"), + _ = wxMenuBar:append(Bar, Menu, "File"), + ok. create_filter_menu(Bar, Filters) -> Menu = wxMenu:new([]), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Select Filter"), [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Select Filter"), [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Item = fun(F, {N,Acc}) when F#filter.name =:= ?DEFAULT_FILTER_NAME-> Label = lists:concat([pad_string(F#filter.name, 20, $\ , right), "(0)"]), MenuItem = menuitem(Menu, ?wxID_ANY, Label, F), @@ -501,7 +506,7 @@ create_filter_menu(Bar, Filters) -> end, Filters2 = lists:keysort(#filter.name, Filters), {_,MenuData} = lists:foldl(Item, {1, []}, Filters2), - wxMenuBar:append(Bar, Menu, "Filters"), + _ = wxMenuBar:append(Bar, Menu, "Filters"), MenuData. create_hide_menu(Bar, S) -> @@ -514,33 +519,33 @@ create_hide_menu(Bar, S) -> S#state.viewer_pid =:= undefined -> ignore; From =:= To -> - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Hide = menuitem(Menu, ?wxID_ANY, "From=To (f|t|b)", {hide, [From]}), - wxMenu:appendSeparator(Menu), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Show = menuitem(Menu, ?wxID_ANY, "From=To (F|T|B)", {show, [From]}), [Show,Hide]; true -> - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Hide actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Hide = [menuitem(Menu, ?wxID_ANY, "From (f)", {hide, [From]}), menuitem(Menu, ?wxID_ANY, "To (t)", {hide, [To]}), menuitem(Menu, ?wxID_ANY, "Both (b)", {hide, [From, To]})], - wxMenu:appendSeparator(Menu), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Show actor in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), Show = [menuitem(Menu, ?wxID_ANY, "From (F)", {show, [From]}), menuitem(Menu, ?wxID_ANY, "To (T)", {show, [To]}), menuitem(Menu, ?wxID_ANY, "Both (B)", {show, [From, To]})], Show++Hide end, - wxMenuBar:append(Bar, Menu, "Hide"), + _ = wxMenuBar:append(Bar, Menu, "Hide"), MenuData. create_search_menu(Bar, S) -> @@ -548,9 +553,9 @@ create_search_menu(Bar, S) -> E = S#state.filtered_event, From = E#event.from, To = E#event.to, - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Search in Viewer "), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Search in Viewer "), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), MenuData = if S#state.viewer_pid =:= undefined -> @@ -570,7 +575,7 @@ create_search_menu(Bar, S) -> menuitem(Menu, ?wxID_ANY, "Reverse from this event (r)", {mode, ModeR}), menuitem(Menu, ?wxID_ANY, "Abort search. Display all (a)", {mode, all})] end, - wxMenuBar:append(Bar, Menu, "Search"), + _ = wxMenuBar:append(Bar, Menu, "Search"), MenuData. config_editor(Editor, S) -> @@ -667,9 +672,10 @@ pad_string(String, MinLen, Char, Dir) when is_integer(MinLen), MinLen >= 0 -> send_viewer_event(S, Event) -> case S#state.viewer_pid of ViewerPid when is_pid(ViewerPid) -> - ViewerPid ! {et, Event}; + ViewerPid ! {et, Event}, + ok; undefined -> - ignore + ok end. select_file(Frame, Message, DefaultFile, Style) -> diff --git a/lib/et/src/et_wx_viewer.erl b/lib/et/src/et_wx_viewer.erl index 386f8fc86b..9613299e6b 100644 --- a/lib/et/src/et_wx_viewer.erl +++ b/lib/et/src/et_wx_viewer.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2000-2011. All Rights Reserved. +%% Copyright Ericsson AB 2000-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% %% @@ -319,8 +320,8 @@ init([S]) when is_record(S, state) -> undefined -> ok; ParentPid -> link(ParentPid) end, - wx:new(), - wx:debug(S#state.wx_debug), + _ = wx:new(), + _ = wx:debug(S#state.wx_debug), et_collector:dict_insert(S#state.collector_pid, {subscriber, self()}, ?MODULE), @@ -531,26 +532,25 @@ handle_info(#wx{id=Id, event = #wxCommand{type = command_menu_selected}}, S=#sta load_all -> Style = ?wxFD_OPEN bor ?wxFD_OVERWRITE_PROMPT, Msg = "Select a file to load events from", - S2 = - case select_file(S#state.frame, Msg, S#state.event_file, Style) of - {ok, NewFile} -> - et_collector:start_trace_client(CollectorPid, event_file, NewFile), - S#state{event_file = NewFile}; - cancel -> - S - end, + S2 = case select_file(S#state.frame, Msg, S#state.event_file, Style) of + {ok, NewFile} -> + _ = et_collector:start_trace_client(CollectorPid, event_file, NewFile), + S#state{event_file = NewFile}; + cancel -> + S + end, noreply(S2); save_all -> Style = ?wxFD_SAVE bor ?wxFD_OVERWRITE_PROMPT, Msg = "Select a file to save events to", - S2 = - case select_file(S#state.frame, Msg, S#state.event_file, Style) of - {ok, NewFile} -> - et_collector:save_event_file(CollectorPid, NewFile, [existing, write, keep]), - S#state{event_file = NewFile}; - cancel -> - S - end, + S2 = case select_file(S#state.frame, Msg, S#state.event_file, Style) of + {ok, NewFile} -> + ok = et_collector:save_event_file(CollectorPid, NewFile, + [existing, write, keep]), + S#state{event_file = NewFile}; + cancel -> + S + end, noreply(S2); print_setup -> S2 = print_setup(S), @@ -786,7 +786,7 @@ handle_info(#wx{event = #wxKey{keyCode = KeyCode, shiftDown = SD}}, S) -> noreply(S) end; handle_info(#wx{event = #wxScroll{type = scroll_changed}} = Wx, S) -> - get_latest_scroll(Wx), + _ = get_latest_scroll(Wx), Pos = wxScrollBar:getThumbPosition(S#state.scroll_bar), {_, LineTopY, LineBotY} = calc_y(S), Range = LineBotY - LineTopY, @@ -1106,7 +1106,7 @@ pick_n([Head | Tail], N, Acc) when N > 0 -> pick_n(Tail, N - 1, [Head | Acc]). close_all(S) -> - close_all_others(S), + _ = close_all_others(S), wxFrame:destroy(S#state.frame), opt_unlink(S#state.parent_pid), {stop, shutdown, S}. @@ -1114,12 +1114,12 @@ close_all(S) -> close_all_others(S) -> Fun = fun({{subscriber, Pid}, _}) -> - if - Pid =:= self() -> - ignore; + if Pid =:= self() -> + ok; true -> unlink(Pid), - Pid ! {et, close} + Pid ! {et, close}, + ok end end, All = et_collector:dict_match(S#state.collector_pid, @@ -1207,9 +1207,9 @@ create_main_window(S) -> CheckBoxData = [{wxCheckBox:getId(HideActions), hide_actions}, {wxCheckBox:getId(HideActors), hide_actors}], wxPanel:connect(Panel, command_checkbox_clicked), - wxSizer:add(CheckSizer, HideActions), - wxSizer:add(CheckSizer,HideActors), - wxSizer:add(OptSizer, CheckSizer, [{border, 10}, {flag, ?wxALL}]), + _ = wxSizer:add(CheckSizer, HideActions), + _ = wxSizer:add(CheckSizer,HideActors), + _ = wxSizer:add(OptSizer, CheckSizer, [{border, 10}, {flag, ?wxALL}]), DetailLevelBox = wxStaticBoxSizer:new(?wxHORIZONTAL, Panel, [{label, "Detail level"}]), @@ -1221,22 +1221,21 @@ create_main_window(S) -> {size, {200,-1}}]), wxStatusBar:setStatusText(StatusBar, where_text(S)), wxFrame:connect(Frame, command_slider_updated), - wxSizer:add(DetailLevelBox, DetailLevel), - wxSizer:add(OptSizer, DetailLevelBox, [{border, 10}, {flag, ?wxALL}]), - wxSizer:addStretchSpacer(OptSizer), - wxSizer:add(MainSizer, OptSizer), - wxSizer:add(MainSizer, - wxStaticLine:new(Panel, [{style, ?wxLI_HORIZONTAL}]), - [{flag, ?wxEXPAND}]), + _ = wxSizer:add(DetailLevelBox, DetailLevel), + _ = wxSizer:add(OptSizer, DetailLevelBox, [{border, 10}, {flag, ?wxALL}]), + _ = wxSizer:addStretchSpacer(OptSizer), + _ = wxSizer:add(MainSizer, OptSizer), + _ = wxSizer:add(MainSizer, wxStaticLine:new(Panel, [{style, ?wxLI_HORIZONTAL}]), + [{flag, ?wxEXPAND}]), CanvasSizer = wxBoxSizer:new(?wxHORIZONTAL), Canvas = wxPanel:new(Panel, [{style, ?wxFULL_REPAINT_ON_RESIZE}]), {CanvasW,CanvasH} = wxPanel:getSize(Canvas), ScrollBar = wxScrollBar:new(Panel, ?wxID_ANY, [{style, ?wxSB_VERTICAL}]), - wxSizer:add(CanvasSizer, Canvas, [{flag, ?wxEXPAND}, {proportion, 1}]), - wxSizer:add(CanvasSizer, ScrollBar, [{flag, ?wxEXPAND}]), - wxSizer:add(MainSizer, CanvasSizer, [{flag, ?wxEXPAND}, {proportion, 1}]), + _ = wxSizer:add(CanvasSizer, Canvas, [{flag, ?wxEXPAND}, {proportion, 1}]), + _ = wxSizer:add(CanvasSizer, ScrollBar, [{flag, ?wxEXPAND}]), + _ = wxSizer:add(MainSizer, CanvasSizer, [{flag, ?wxEXPAND}, {proportion, 1}]), wxPanel:connect(Canvas, left_down), wxPanel:connect(Canvas, left_up), wxPanel:connect(Canvas, right_up), @@ -1336,8 +1335,7 @@ menuitem(Menu, Id, Text, UserData) -> create_file_menu(Bar) -> Menu = wxMenu:new([]), - Data = [ - menuitem(Menu, ?wxID_ANY, "Clear all events in the Collector", clear_all), + Data = [menuitem(Menu, ?wxID_ANY, "Clear all events in the Collector", clear_all), menuitem(Menu, ?wxID_ANY, "Load events to the Collector from file", load_all), menuitem(Menu, ?wxID_ANY, "Save all events in the Collector to file", save_all), @@ -1347,51 +1345,44 @@ create_file_menu(Bar) -> menuitem(Menu, ?wxID_ANY, "Close this Viewer", close), menuitem(Menu, ?wxID_ANY, "Close all other Viewers, but this (c)", close_all_others), - menuitem(Menu, ?wxID_ANY, "Close all Viewers and the Collector) (C) ", close_all) - ], - wxMenu:insertSeparator(Menu, 3), - wxMenu:insertSeparator(Menu, 7), + menuitem(Menu, ?wxID_ANY, "Close all Viewers and the Collector) (C) ", close_all)], + _ = wxMenu:insertSeparator(Menu, 3), + _ = wxMenu:insertSeparator(Menu, 7), wxMenuBar:append(Bar, Menu, "File"), Data. create_viewer_menu(Bar) -> Menu = wxMenu:new([]), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll this Viewer"), - [{enable, false}]), - wxMenu:appendSeparator(Menu), - D1 = [ - menuitem(Menu, ?wxID_ANY, "First (f)", first), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll this Viewer"), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), + D1 = [menuitem(Menu, ?wxID_ANY, "First (f)", first), menuitem(Menu, ?wxID_ANY, "Last (l)", last), menuitem(Menu, ?wxID_ANY, "Prev (p)", prev), menuitem(Menu, ?wxID_ANY, "Next (n)", next), - menuitem(Menu, ?wxID_ANY, "Refresh (r)", refresh) - ], - wxMenu:appendSeparator(Menu), - D2 = [ - menuitem(Menu, ?wxID_ANY, "Up 5 (Up)", up), - menuitem(Menu, ?wxID_ANY, "Down 5 (Down)", down) - ], - wxMenu:appendSeparator(Menu), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Actor visibility in this Viewer"), - [{enable, false}]), - wxMenu:appendSeparator(Menu), + menuitem(Menu, ?wxID_ANY, "Refresh (r)", refresh)], + _ = wxMenu:appendSeparator(Menu), + D2 = [menuitem(Menu, ?wxID_ANY, "Up 5 (Up)", up), + menuitem(Menu, ?wxID_ANY, "Down 5 (Down)", down)], + _ = wxMenu:appendSeparator(Menu), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Actor visibility in this Viewer"), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), D3 = [menuitem(Menu, ?wxID_ANY, "Display all actors (a)", display_all)], - wxMenuBar:append(Bar, Menu, "Viewer"), + _ = wxMenuBar:append(Bar, Menu, "Viewer"), [D1,D2,D3]. create_collector_menu(Bar) -> Menu = wxMenu:new([]), - wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll all Viewers"), - [{enable, false}]), - wxMenu:appendSeparator(Menu), - Data = [ - menuitem(Menu, ?wxID_ANY, "First (F)", first_all), + _ = wxMenuItem:enable(wxMenu:append(Menu, ?wxID_ANY, "Scroll all Viewers"), + [{enable, false}]), + _ = wxMenu:appendSeparator(Menu), + Data = [menuitem(Menu, ?wxID_ANY, "First (F)", first_all), menuitem(Menu, ?wxID_ANY, "Last (L)", last_all), menuitem(Menu, ?wxID_ANY, "Prev (P)", prev_all), menuitem(Menu, ?wxID_ANY, "Next (N)", next_all), - menuitem(Menu, ?wxID_ANY, "Refresh (R)", refresh_all) - ], - wxMenuBar:append(Bar, Menu, "Collector"), + menuitem(Menu, ?wxID_ANY, "Refresh (R)", refresh_all)], + _ = wxMenuBar:append(Bar, Menu, "Collector"), Data. create_filter_menu(S=#state{filter_menu = {Menu,Data}}, ActiveFilterName, Filters) -> @@ -1420,21 +1411,19 @@ create_filter_menu(S=#state{filter_menu = {Menu,Data}}, ActiveFilterName, Filter Same = lists:concat([pad_string(ActiveFilterName, 20), "(=) same scale"]), Larger = lists:concat([pad_string(ActiveFilterName, 20), "(+) bigger scale"]), Smaller = lists:concat([pad_string(ActiveFilterName, 20), "(-) smaller scale"]), - D2 = [ - menuitem(Menu, ?wxID_ANY, Same, {data, Filter, 0}), + D2 = [menuitem(Menu, ?wxID_ANY, Same, {data, Filter, 0}), menuitem(Menu, ?wxID_ANY, Smaller, {data, Filter, -1}), menuitem(Menu, ?wxID_ANY, Larger, {data, Filter, 1}), wxMenu:appendSeparator(Menu), I2 = wxMenu:append(Menu, ?wxID_ANY, "New Filter Same Scale"), - wxMenu:appendSeparator(Menu) - ], - wxMenuItem:enable(I2, [{enable,false}]), + wxMenu:appendSeparator(Menu)], + _ = wxMenuItem:enable(I2, [{enable,false}]), {_,D3} = lists:foldl(Item, {1,[]}, Filters), S#state{filter_menu = {Menu, lists:flatten([D1,D2,D3])}}. create_help_menu(Bar) -> Menu = wxMenu:new([]), - menuitem(Menu, ?wxID_HELP, "Info", help), + _ = menuitem(Menu, ?wxID_HELP, "Info", help), wxMenuBar:append(Bar, Menu, "Help"). clear_canvas(S) -> diff --git a/lib/et/src/modules.mk b/lib/et/src/modules.mk index 8d6c0902fb..4d538fae44 100644 --- a/lib/et/src/modules.mk +++ b/lib/et/src/modules.mk @@ -1,26 +1,25 @@ #-*-makefile-*- ; force emacs to enter makefile-mode # %CopyrightBegin% # -# Copyright Ericsson AB 2001-2010. All Rights Reserved. +# Copyright Ericsson AB 2001-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% MODULES = \ et \ et_collector \ - et_gs_contents_viewer \ - et_gs_viewer \ et_selector \ et_viewer \ et_wx_contents_viewer \ diff --git a/lib/et/subdirs.mk b/lib/et/subdirs.mk index d6382463e3..fb7fb8dbc9 100644 --- a/lib/et/subdirs.mk +++ b/lib/et/subdirs.mk @@ -1,18 +1,19 @@ #-*-makefile-*- ; force emacs to enter makefile-mode # %CopyrightBegin% # -# Copyright Ericsson AB 2002-2009. All Rights Reserved. +# Copyright Ericsson AB 2002-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% diff --git a/lib/et/test/Makefile b/lib/et/test/Makefile index 3817079b5f..45ea2c2ce0 100644 --- a/lib/et/test/Makefile +++ b/lib/et/test/Makefile @@ -1,18 +1,19 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2009-2012. All Rights Reserved. +# Copyright Ericsson AB 2009-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% @@ -25,6 +26,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk MODULES= \ ett \ + et_SUITE \ et_wx_SUITE \ et_test_lib diff --git a/lib/et/test/et_SUITE.erl b/lib/et/test/et_SUITE.erl new file mode 100644 index 0000000000..199aff43a8 --- /dev/null +++ b/lib/et/test/et_SUITE.erl @@ -0,0 +1,35 @@ +%% ``Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% The Initial Developer of the Original Code is Ericsson Utvecklings AB. +%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings +%% AB. All Rights Reserved.'' +%% +-module(et_SUITE). + +-export([suite/0, all/0]). +-export([app/1, appup/1]). +-include_lib("common_test/include/ct.hrl"). + +suite() -> + [{ct_hooks, [ts_install_cth]}]. + +all() -> + [app, appup]. + +%% Test that the et app file is ok +app(Config) when is_list(Config) -> + ok = ?t:app_test(et). + +%% Test that the et appup file is ok +appup(Config) when is_list(Config) -> + ok = ?t:appup_test(et). diff --git a/lib/et/test/et_test_lib.erl b/lib/et/test/et_test_lib.erl index c1bfeb9fc0..df2c308b28 100644 --- a/lib/et/test/et_test_lib.erl +++ b/lib/et/test/et_test_lib.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% Copyright Ericsson AB 2009-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% diff --git a/lib/et/test/et_test_lib.hrl b/lib/et/test/et_test_lib.hrl index 0d75318d99..ee1a72d991 100644 --- a/lib/et/test/et_test_lib.hrl +++ b/lib/et/test/et_test_lib.hrl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% Copyright Ericsson AB 2009-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% diff --git a/lib/et/test/et_wx_SUITE.erl b/lib/et/test/et_wx_SUITE.erl index b5f98f8616..6475b6706b 100644 --- a/lib/et/test/et_wx_SUITE.erl +++ b/lib/et/test/et_wx_SUITE.erl @@ -1,28 +1,28 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% Copyright Ericsson AB 2009-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% -module(et_wx_SUITE). --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2, - init_per_suite/1, end_per_suite/1, - init_per_testcase/2, end_per_testcase/2]). - --compile(export_all). +-export([all/0, suite/0, + init_per_testcase/2, end_per_testcase/2, + init_per_suite/1, end_per_suite/1]). +-export([start_all_windows/1]). -include("et_test_lib.hrl"). @@ -39,21 +39,13 @@ end_per_testcase(Func,Config) -> et_test_lib:end_per_testcase(Func,Config). %% SUITE specification -suite() -> [{ct_hooks,[ts_install_cth]}]. + +suite() -> + [{ct_hooks,[ts_install_cth]}]. all() -> [start_all_windows]. -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. - - %% The test cases %% Display all windows and see if something crashes diff --git a/lib/et/test/ett b/lib/et/test/ett index da2443df61..c5b89ea367 100755 --- a/lib/et/test/ett +++ b/lib/et/test/ett @@ -1,18 +1,19 @@ #! /bin/sh -f # %CopyrightBegin% # -# Copyright Ericsson AB 2009-2010. All Rights Reserved. +# Copyright Ericsson AB 2009-2016. All Rights Reserved. # -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # # %CopyrightEnd% diff --git a/lib/et/test/ett.erl b/lib/et/test/ett.erl index 1896e65842..b1b769b7ac 100644 --- a/lib/et/test/ett.erl +++ b/lib/et/test/ett.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2010. All Rights Reserved. +%% Copyright Ericsson AB 2009-2016. All Rights Reserved. %% -%% The contents of this file are subject to the Erlang Public License, -%% Version 1.1, (the "License"); you may not use this file except in -%% compliance with the License. You should have received a copy of the -%% Erlang Public License along with this software. If not, it can be -%% retrieved online at http://www.erlang.org/. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at %% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and limitations -%% under the License. +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% diff --git a/lib/et/vsn.mk b/lib/et/vsn.mk index 40cdc2b298..a37fec083b 100644 --- a/lib/et/vsn.mk +++ b/lib/et/vsn.mk @@ -1 +1 @@ -ET_VSN = 1.4.4.4 +ET_VSN = 1.6 |