diff options
author | Lukas Larsson <[email protected]> | 2016-02-23 17:08:42 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-04-15 15:07:10 +0200 |
commit | ecd20cf55ffcc45632825863ea8f0c7442553a0d (patch) | |
tree | 061ffb81ca9db4201e8e8b60f19880d5c19c6b56 | |
parent | d89da98527e1a0855fef06cd27839416dfb6efd1 (diff) | |
download | otp-ecd20cf55ffcc45632825863ea8f0c7442553a0d.tar.gz otp-ecd20cf55ffcc45632825863ea8f0c7442553a0d.tar.bz2 otp-ecd20cf55ffcc45632825863ea8f0c7442553a0d.zip |
erts: Add tracing examples in match spec docs
-rw-r--r-- | erts/doc/src/match_spec.xml | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/erts/doc/src/match_spec.xml b/erts/doc/src/match_spec.xml index b49e1483aa..3944f24f84 100644 --- a/erts/doc/src/match_spec.xml +++ b/erts/doc/src/match_spec.xml @@ -528,7 +528,7 @@ </section> <section> - <title>Examples</title> + <title>ETS Examples</title> <p>Match an argument list of three where the first and third arguments are equal:</p> <code type="none"><![CDATA[ @@ -619,5 +619,44 @@ <p>The function <c><![CDATA[ets:test_ms/2]]></c> can be useful for testing complicated ets matches.</p> </section> + <section> + <title>Tracing Examples</title> + <p>Only generate trace message if trace control word is set to 1:</p> + <code type="none"><![CDATA[ +[{'_', + [{'==',{get_tcw},{const, 1}}], + []}] + ]]></code> + <p>Only generate trace message if there is a seq trace token:</p> + <code type="none"><![CDATA[ +[{'_', + [{'==',{is_seq_trace},{const, 1}}], + []}] + ]]></code> + <p>Remove 'silent' trace flag when first argument is 'verbose' + and add it when it is 'silent':</p> + <code type="none"><![CDATA[ +[{'$1', + [{'==',{hd, '$1'},verbose}], + [{trace, [silent],[]}]}, + {'$1', + [{'==',{hd, '$1'},silent}], + [{trace, [],[silent]}]}] + ]]></code> + <p>Add return_trace message if function is of arity 3:</p> + <code type="none"><![CDATA[ +[{'$1', + [{'==',{length, '$1'},3}], + [{return_trace}]}, + {'_',[],[]}] + ]]></code> + <p>Only generate trace message if function is of arity 3 and first argument is 'trace':</p> + <code type="none"><![CDATA[ +[{['trace','$2','$3'], + [], + []}, + {'_',[],[]}] + ]]></code> + </section> </chapter> |