aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime_tools/src
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2012-07-06 12:24:11 +0200
committerHenrik Nord <[email protected]>2012-07-06 12:24:14 +0200
commit0eed86218c2f9e1dfadb25b0ec993d207e43d25e (patch)
tree7262fa692803b1f473f152b077dd8b3b62266845 /lib/runtime_tools/src
parent5a4fb5082647c0a6b68b546709120679b9d17b86 (diff)
parent78b3cb736d3ca387acc15b82d0cc470537a9378b (diff)
downloadotp-0eed86218c2f9e1dfadb25b0ec993d207e43d25e.tar.gz
otp-0eed86218c2f9e1dfadb25b0ec993d207e43d25e.tar.bz2
otp-0eed86218c2f9e1dfadb25b0ec993d207e43d25e.zip
Merge branch 'slf/dyntrace-comment-and-func-cleanup' into maint
* slf/dyntrace-comment-and-func-cleanup: dyntrace.erl comment cleanup and unused function removal OTP-10141
Diffstat (limited to 'lib/runtime_tools/src')
-rw-r--r--lib/runtime_tools/src/dyntrace.erl55
1 files changed, 9 insertions, 46 deletions
diff --git a/lib/runtime_tools/src/dyntrace.erl b/lib/runtime_tools/src/dyntrace.erl
index 388c7679b9..3146a44350 100644
--- a/lib/runtime_tools/src/dyntrace.erl
+++ b/lib/runtime_tools/src/dyntrace.erl
@@ -6,23 +6,22 @@
%%% work on any operating system platform where user-space DTrace/Systemtap
%%% (and in the future LttNG UST) probes are supported.
%%%
-%%% Use the `dyntrace:init()' function to load the NIF shared library and
-%%% to initialize library's private state.
-%%%
%%% It is recommended that you use the `dyntrace:p()' function to add
%%% Dynamic trace probes to your Erlang code. This function can accept up to
%%% four integer arguments and four string arguments; the integer
-%%% argument(s) must come before any string argument. For example:
+%%% argument(s) must come before any string argument.
+%%%
+%%% If using DTrace, enable the dynamic trace probe using the 'dtrace'
+%%% command, for example:
+%%%
+%%% dtrace -s /your/path/to/lib/runtime_tools-1.8.7/examples/user-probe.d
+%%%
+%%% Then, back at the Erlang shell, try this example:
%%% ```
%%% 1> dyntrace:put_tag("GGOOOAAALL!!!!!").
%%% true
-%%% 2> dyntrace:init().
-%%% ok
-%%%
-%%% % % % If using dtrace, enable the Dynamic trace probe using the 'dtrace'
-%%% % % % command.
%%%
-%%% 3> dyntrace:p(7, 8, 9, "one", "four").
+%%% 2> dyntrace:p(7, 8, 9, "one", "four").
%%% true
%%% '''
%%%
@@ -41,7 +40,6 @@
p/0, p/1, p/2, p/3, p/4, p/5, p/6, p/7, p/8]).
-export([put_tag/1, get_tag/0, get_tag_data/0, spread_tag/1, restore_tag/1]).
--export([scaff/0]). % Development only
-export([user_trace_i4s4/9]). % Know what you're doing!
-on_load(on_load/0).
@@ -242,38 +240,3 @@ restore_tag(T) ->
erlang:dt_restore_tag(T).
-%% Scaffolding to write tedious code: quick brute force and not 100% correct.
-
-scaff_int_args(N) ->
- L = lists:sublist(["I1", "I2", "I3", "I4"], N),
- [string:join(L, ", ")].
-
-scaff_int_guards(N) ->
- L = lists:sublist(["is_integer(I1)", "is_integer(I2)", "is_integer(I3)",
- "is_integer(I4)"], N),
- lists:flatten(string:join(L, ", ")).
-
-scaff_char_args(N) ->
- L = lists:sublist(["S1", "S2", "S3", "S4"], N),
- [string:join(L, ", ")].
-
-scaff_fill(N) ->
- [string:join(lists:duplicate(N, "undef"), ", ")].
-
-scaff() ->
- L = [begin
- IntArgs = scaff_int_args(N_int),
- IntGuards = scaff_int_guards(N_int),
- IntFill = scaff_fill(4 - N_int),
- CharArgs = scaff_char_args(N_char),
- CharFill = scaff_fill(4 - N_char),
- InArgs = string:join(IntArgs ++ CharArgs, ", "),
- OutArgs = string:join(IntArgs ++ IntFill ++ CharArgs ++ CharFill,
- ", "),
- {N_int + N_char,
- lists:flatten([io_lib:format("p(~s) when ~s ->\n",
- [InArgs, IntGuards]),
- io_lib:format(" user_trace_int(~s);\n", [OutArgs])
- ])}
- end || N_int <- [0,1,2,3,4], N_char <- [0,1,2,3,4]],
- [io:format("%%~p\n~s", [N, Str]) || {N, Str} <- lists:sort(L)].