anchor.diff:      {noreply, S};
   handle_info({'EXIT', _, Reason}, #state{ reply = FromTag } = S) ->
   
  -    set_process_trace(false, S#state.rootset),
  -    set_pattern_trace(false, S#state.pattern),
  +    _  = set_process_trace(false, S#state.rootset, S#state.trace_opts),
  +    ok = set_pattern_trace(false, S#state.pattern),
   
       gen_server:reply(FromTag, {error, Reason}),
       {noreply, S#state{
  -	profiling = false,
  -	rootset   = [],
  -	pattern   = {'_','_','_'}
  +	profiling  = false,
  +	rootset    = [],
  +	trace_opts = [],
  +	pattern    = ?default_pattern
       }};
   
   % check if Pid is spawned process?
   handle_info({_Pid, {answer, Result}}, #state{ reply = {From,_} = FromTag} = S) ->
   
  -    set_pattern_trace(pause, S#state.pattern),
  -
  -    Bpd = collect_bpd(),
  -
  -    set_process_trace(false, S#state.rootset),
  -    set_pattern_trace(false, S#state.pattern),
  +    ok   = set_pattern_trace(pause, S#state.pattern),
  +    Bpd  = collect_bpd(),
  +    _    = set_process_trace(false, S#state.rootset, S#state.trace_opts),
  +    ok   = set_pattern_trace(false, S#state.pattern),
   
       catch unlink(From),
       gen_server:reply(FromTag, {ok, Result}),
       {noreply, S#state{
  -	profiling = false,
  -	rootset   = [],
  -	pattern   = {'_','_','_'},
  -	bpd       = Bpd
  +	profiling  = false,
  +	rootset    = [],
  +	trace_opts = [],
  +	pattern    = ?default_pattern,
  +	bpd        = Bpd
       }}.
   
   %% -------------------------------------------------------------------- %%
  
positive.code: 
  %% profile
  
  handle_call({profile, _Rootset, _Pattern, _M,_F,_A}, _From, #state{ profiling = true } = S) ->
      {reply, {error, already_profiling}, S};
  
  handle_call({profile, Rootset, Pattern, M,F,A}, From, #state{fd = Fd } = S) ->
  
      set_pattern_trace(false, S#state.pattern),
      set_process_trace(false, S#state.rootset),
  
      Pid = setup_profiling(M,F,A),
      case set_process_trace(true, [Pid|Rootset]) of
  	true ->
  	    set_pattern_trace(true, Pattern),
  	    T0 = now(),
  	    execute_profiling(Pid),
  	    {noreply, #state{
  		    profiling = true,
  		    rootset   = [Pid|Rootset],
  		    start_ts  = T0,
  		    reply     = From,
  		    fd        = Fd,
  		    pattern   = Pattern
  		}};
  	false ->
  	    exit(Pid, eprof_kill),
  	    {reply, error, #state{ fd = Fd}}
      end;
  
  handle_call({profile, _Rootset, _Pattern}, _From, #state{ profiling = true } = S) ->
      {reply, {error, already_profiling}, S};
  
  handle_call({profile, Rootset, Pattern}, From, #state{ fd = Fd } = S) ->
  
      set_pattern_trace(false, S#state.pattern),
      set_process_trace(false, S#state.rootset),
  
      case set_process_trace(true, Rootset) of
  	true ->
  	    T0 = now(),
  	    set_pattern_trace(true, Pattern),
  	    {reply, profiling, #state{
  		    profiling = true,
  		    rootset   = Rootset,
  		    start_ts  = T0,
  		    reply     = From,
  		    fd        = Fd,
  		    pattern   = Pattern
  		}};
  	false ->
  	    {reply, error, #state{ fd = Fd }}
      end;
  
  handle_call(stop_profiling, _From, #state{ profiling = false } = S) ->
      {reply, profiling_already_stopped, S};
  
  handle_call(stop_profiling, _From, #state{ profiling = true } = S) ->
  
      set_pattern_trace(pause, S#state.pattern),
  
      Bpd = collect_bpd(),
  
      set_process_trace(false, S#state.rootset),
      set_pattern_trace(false, S#state.pattern),
  
      {reply, profiling_stopped, S#state{
  	profiling = false,
  	rootset   = [],
  	pattern   = {'_','_','_'},
  	bpd       = Bpd
      }};
  
  %% logfile
  
negative.code:     end.
  
  execute_profiling(Pid) ->
      Pid ! {self(), execute},
      ok.
  
  
  get_trace_options([]) ->
      [call];
  get_trace_options([{set_on_spawn, true}|Opts]) ->
      [set_on_spawn | get_trace_options(Opts)];
  get_trace_options([set_on_spawn|Opts]) ->
      [set_on_spawn | get_trace_options(Opts)];
  get_trace_options([_|Opts]) ->
      get_trace_options(Opts).
  
  
  set_pattern_trace(Flag, Pattern) ->
      erlang:system_flag(multi_scheduling, block),
  