1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21-module(tracer_test).
22
23%%%
24%%% Test tracer
25%%%
26
27-export([enabled/3, trace/5]).
28-export([load/1, load/2]).
29-on_load(load/0).
30
31enabled(_, _, _) ->
32    erlang:nif_error(nif_not_loaded).
33
34trace(_, _, _, _, _) ->
35    erlang:nif_error(nif_not_loaded).
36
37load() ->
38    case whereis(tracer_test_config) of
39        undefined ->
40            ok;
41        Pid ->
42            Pid ! {get, self()},
43            receive
44                {Conf, Postfix} ->
45                    load(Conf, Postfix);
46                Conf ->
47                    load(Conf)
48            end
49    end.
50
51load(DataDir) ->
52    load(DataDir, "").
53load(DataDir, Postfix) ->
54    SoFile = atom_to_list(?MODULE) ++ Postfix,
55    erlang:load_nif(filename:join(DataDir, SoFile) , 0).
56