anchor.diff:  
   all() ->
       [call_trace, return_trace, send, receive_trace,
  -     process_events, schedule, fake_schedule,
  -     fake_schedule_after_register,
  -     fake_schedule_after_getting_linked,
  -     fake_schedule_after_getting_unlinked, gc,
  +     process_events, schedule, gc,
        default_tracer, tracer_port_crash].
   
   %% Test sending call trace messages to a port.
  
positive.code:     expect({trace_ts,Receiver,in,{?MODULE,receiver,0},ts}),
      expect({trace_ts,Receiver,out,{?MODULE,receiver,0},ts}),
  
      ok.
  
  run_fake_sched_test(Fun, Config) when is_function(Fun), is_list(Config) ->
      case catch erlang:system_info(smp_support) of
          true ->
              {skipped,
               "No need for faked schedule out/in trace messages "
               "when smp support is enabled"};
          _ ->
              Fun(Config)
      end.
  
  %% Tests time compensating fake out/in scheduling.
  fake_schedule(Config) when is_list(Config) ->
      run_fake_sched_test(fun fake_schedule_test/1, Config).
  
  fake_schedule_test(Config) when is_list(Config) ->
      Tracer = start_tracer(Config),
      Port = get(tracer_port),
      General = fun_spawn(fun general/0),
      %%
      trac(General, true, [send, running]),
      %%
      %% Test that fake out/in scheduling is not generated unless
      %% both 'running' and 'timestamp' is active.
      [] = erlang:port_control(Port, $h, []),
      General ! nop,
      expect({trace, General, in, {?MODULE, general, 0}}),
      expect({trace, General, out, {?MODULE, general, 0}}),
      expect(),
      %%
      trac(General, false, [running]),
      trac(General, true, [timestamp]),
      %%
      Ref1 = make_ref(),
      Msg1 = {Port, {data, term_to_binary(Ref1)}},
      [] = erlang:port_control(Port, $h, []),
      General ! {send, Tracer, Msg1},
      expect({trace_ts, General, send, Msg1, Tracer, ts}),
      expect(Ref1),
      expect(),
      %%
      trac(General, true, [running]),
      %%
      %% Test that fake out/in scheduling can be generated by the driver
      Ref2 = make_ref(),
      Msg2 = {Port, {data, term_to_binary(Ref2)}},
      [] = erlang:port_control(Port, $h, []),
      General ! {send, Tracer, Msg2},
      {_,_,_,_,Ts} = 
      expect({trace_ts, General, in, {?MODULE, general, 0}, ts}),
      expect({trace_ts, General, out, 0, Ts}),
      expect({trace_ts, General, in, 0, ts}),
      expect({trace_ts, General, send, Msg2, Tracer, ts}),
      expect(Ref2),
      expect({trace_ts, General, out, {?MODULE, general, 0}, ts}),
      expect(),
      %%
      %% Test that fake out/in scheduling is not generated after an
      %% 'out' scheduling event
      Ref3 = make_ref(),
      Msg3 = {Port, {data, term_to_binary(Ref3)}},
      General ! {apply, {erlang, port_control, [Port, $h, []]}},
      expect({trace_ts, General, in, {?MODULE, general, 0}, ts}),
      expect({trace_ts, General, out, {?MODULE, general, 0}, ts}),
      General ! {send, Tracer, Msg3},
      expect({trace_ts, General, in, {?MODULE, general, 0}, ts}),
      expect({trace_ts, General, send, Msg3, Tracer, ts}),
      expect(Ref3),
      expect({trace_ts, General, out, {?MODULE, general, 0}, ts}),
      expect(),
      %%
      ok.
  
  %% Tests fake out/in scheduling contents.
  fake_schedule_after_register(Config) when is_list(Config) ->
      run_fake_sched_test(fun fake_schedule_after_register_test/1, Config).
  
  fake_schedule_after_register_test(Config) when is_list(Config) ->
      start_tracer(Config),
      Port = get(tracer_port),
      G1 = fun_spawn(fun general/0),
      G2 = fun_spawn(fun general/0),
      %%
      trac(G1, true, [running, timestamp, procs]),
      trac(G2, true, [running, timestamp]),
      %%
      %% Test fake out/in scheduling after certain messages
      erlang:yield(),
      G2 ! {apply, {erlang, port_control, [Port, $h, []]}},
      G2 ! {apply, {erlang, register, [fake_schedule_after_register, G1]}},
      expect({trace_ts, G2, in, {?MODULE, general, 0}, ts}),
      {_,_,_,_,Ts} = 
      expect({trace_ts, G1, register, fake_schedule_after_register, ts}),
      expect({trace_ts, G2, out, 0, Ts}),
      expect({trace_ts, G2, in, 0, ts}),
      expect({trace_ts, G2, out, {?MODULE, general, 0}, ts}),
      expect(),
      %%
      ok.
  
  %% Tests fake out/in scheduling contents.
  fake_schedule_after_getting_linked(Config) when is_list(Config) ->
      run_fake_sched_test(fun fake_schedule_after_getting_linked_test/1,
                          Config).
  
  fake_schedule_after_getting_linked_test(Config) when is_list(Config) ->
      start_tracer(Config),
      Port = get(tracer_port),
      G1 = fun_spawn(fun general/0),
      G2 = fun_spawn(fun general/0),
      %%
      trac(G1, true, [running, timestamp, procs]),
      trac(G2, true, [running, timestamp]),
      %%
      %% Test fake out/in scheduling after certain messages
      erlang:yield(),
      G2 ! {apply, {erlang, port_control, [Port, $h, []]}},
      G2 ! {apply, {erlang, link, [G1]}},
      expect({trace_ts, G2, in, {?MODULE, general, 0}, ts}),
      {_,_,_,_,Ts} = 
      expect({trace_ts, G1, getting_linked, G2, ts}),
      expect({trace_ts, G2, out, 0, Ts}),
      expect({trace_ts, G2, in, 0, ts}),
      expect({trace_ts, G2, out, {?MODULE, general, 0}, ts}),
      expect(),
      %%
      ok.
  
  %% Tests fake out/in scheduling contents.
  fake_schedule_after_getting_unlinked(Config) when is_list(Config) ->
      run_fake_sched_test(fun fake_schedule_after_getting_unlinked_test/1,
                          Config).
  
  fake_schedule_after_getting_unlinked_test(Config) when is_list(Config) ->
      start_tracer(Config),
      Port = get(tracer_port),
      G1 = fun_spawn(fun general/0),
      G2 = fun_spawn(fun general/0),
      %%
      trac(G1, true, [running, procs]),
      trac(G2, true, [running, timestamp]),
      %%
      %% Test fake out/in scheduling after certain messages
      erlang:yield(),
      G2 ! {apply, {erlang, link, [G1]}},
      G2 ! {apply, {erlang, port_control, [Port, $h, []]}},
      G2 ! {apply, {erlang, unlink, [G1]}},
      expect({trace_ts, G2, in, {?MODULE, general, 0}, ts}),
      expect({trace, G1, getting_linked, G2}),
      expect({trace, G1, getting_unlinked, G2}),
      expect({trace_ts, G2, out, 0, ts}),
      expect({trace_ts, G2, in, 0, ts}),
      expect({trace_ts, G2, out, {?MODULE, general, 0}, ts}),
      expect(),
      %%
      ok.
  
  %% Test sending garbage collection events to a port.
  
negative.code: 	 receive_trace/1,
  	 process_events/1,
  	 schedule/1,
  	 gc/1,
  	 default_tracer/1,
  	 tracer_port_crash/1]).
  