From 36e9d73aa08930ddf3e3587addfb9a647a41b3e7 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson The same as
- Sets trace pattern for message sending.
+ Must be combined with
+ Argument A list of match specifications. The matching is done
+ on the list Enables tracing for all sent messages (from Disables tracing for all sent messages.
+ Any match specification is removed. Argument The return value is always Example; only trace messages to a specific process Only trace messages matching Only trace messages sent to the sender itself: Only trace messages sent to other nodes: A match specification for Sets trace pattern for message receiving.
+ Must be combined with
+ Argument A list of match specifications. The matching is done
+ on the list Enables tracing for all received messages (to Disables tracing for all sent messages.
+ Any match specification is removed. Argument The return value is always Example; only trace messages from a specific process Only trace messages matching Only trace messages from other nodes: A match specification for Enables or disables call tracing for
- one or more functions. Must be combined with
+ Enables or disables call tracing for one or more functions.
+ Must be combined with
+> erlang:trace_pattern(send, [{[Pid, '_'],[],[]}], []).
+1
+
+> erlang:trace_pattern(send, [{['_', {reply,'_'}],[],[]}], []).
+1
+
+> erlang:trace_pattern(send, [{['$1', '_'],[{'=:=','$1',{self}}],[]}], []).
+1
+
+> erlang:trace_pattern(send, [{['$1', '_'],[{'=/=',{node,'$1'},{node}}],[]}], []).
+1
+
+> erlang:trace_pattern('receive', [{['_',Pid, '_'],[],[]}], []).
+1
+
+> erlang:trace_pattern('receive', [{['_','_', {reply,'_'}],[],[]}], []).
+1
+
+> erlang:trace_pattern('receive', [{['$1', '_', '_'],[{'=/=','$1',{node}}],[]}], []).
+1
+
Conceptually, call tracing works as follows. Inside the Erlang Virtual Machine, a set of processes and a set of functions are to be traced. If a traced process diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 20a64e81b4..d09958032b 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -2381,7 +2381,7 @@ tl(_List) -> [{[term()] | '_' ,[term()],[term()]}]. -spec erlang:trace_pattern(MFA, MatchSpec) -> non_neg_integer() when - MFA :: trace_pattern_mfa(), + MFA :: trace_pattern_mfa() | send | 'receive', MatchSpec :: (MatchSpecList :: trace_match_spec()) | boolean() | restart @@ -2403,7 +2403,13 @@ trace_pattern(MFA, MatchSpec) -> call_count | call_time. --spec erlang:trace_pattern(MFA, MatchSpec, FlagList) -> non_neg_integer() when +-spec erlang:trace_pattern(send, MatchSpec, []) -> non_neg_integer() when + MatchSpec :: (MatchSpecList :: trace_match_spec()) + | boolean(); + ('receive', MatchSpec, []) -> non_neg_integer() when + MatchSpec :: (MatchSpecList :: trace_match_spec()) + | boolean(); + (MFA, MatchSpec, FlagList) -> non_neg_integer() when MFA :: trace_pattern_mfa(), MatchSpec :: (MatchSpecList :: trace_match_spec()) | boolean() -- cgit v1.2.3