anchor.diff:      {comment, C}.
   
   norm(T, Ref) ->
  -    io_lib:format("~.2f", [T/Ref]).
  +    io_lib:format("~.2f", [Ref/T]).
  +
  +-define(MAX_TIME_SECS, 3).   % s
  +-define(MAX_TIME, 1000 * ?MAX_TIME_SECS). % ms
  +-define(CALLS_PER_LOOP, 5).
   
   do_tests(Test, ParamSet) ->
       {Client, ServerMod} = bench(Test),
  -    {Parallelism, N, Message} = bench_params(ParamSet),
  -    Fun = create_clients(N, Message, ServerMod, Client, Parallelism),
  -    Time = run_test(Fun),
  -    TimesPerTest = 5,
  -    PerSecond = Parallelism * TimesPerTest * round((1000 * N) / Time),
  +    {Parallelism, Message} = bench_params(ParamSet),
  +    Fun = create_clients(Message, ServerMod, Client, Parallelism),
  +    {TotalLoops, AllPidTime} = run_test(Fun),
  +    PerSecond = ?CALLS_PER_LOOP * round((1000 * TotalLoops) / AllPidTime),
       ct_event:notify(#event{name = benchmark_data,
                              data = [{suite,"stdlib_gen_server"},
                                      {value,PerSecond}]}),
  -    Time.
  -
  -simple_client(0, _, _P) ->
  -    ok;
  +    PerSecond.
  +
  +-define(COUNTER, n).
  +
   simple_client(N, M, P) ->
  +    put(?COUNTER, N),
       _ = simple_server:reply(P, M),
       _ = simple_server:reply(P, M),
       _ = simple_server:reply(P, M),
       _ = simple_server:reply(P, M),
       _ = simple_server:reply(P, M),
  -    simple_client(N-1, M, P).
  -
  -simple_client_timer(0, _, _P) ->
  -    ok;
  +    simple_client(N+1, M, P).
  +
   simple_client_timer(N, M, P) ->
  +    put(?COUNTER, N),
       _ = simple_server_timer:reply(P, M),
       _ = simple_server_timer:reply(P, M),
       _ = simple_server_timer:reply(P, M),
       _ = simple_server_timer:reply(P, M),
       _ = simple_server_timer:reply(P, M),
  -    simple_client_timer(N-1, M, P).
  -
  -simple_client_mon(0, _, _P) ->
  -    ok;
  +    simple_client_timer(N+1, M, P).
  +
   simple_client_mon(N, M, P) ->
  +    put(?COUNTER, N),
       _ = simple_server_mon:reply(P, M),
       _ = simple_server_mon:reply(P, M),
       _ = simple_server_mon:reply(P, M),
       _ = simple_server_mon:reply(P, M),
       _ = simple_server_mon:reply(P, M),
  -    simple_client_mon(N-1, M, P).
  -
  -simple_client_timer_mon(0, _, _P) ->
  -    ok;
  +    simple_client_mon(N+1, M, P).
  +
   simple_client_timer_mon(N, M, P) ->
  +    put(?COUNTER, N),
       _ = simple_server_timer_mon:reply(P, M),
       _ = simple_server_timer_mon:reply(P, M),
       _ = simple_server_timer_mon:reply(P, M),
       _ = simple_server_timer_mon:reply(P, M),
       _ = simple_server_timer_mon:reply(P, M),
  -    simple_client_timer_mon(N-1, M, P).
  -
  -generic_client(0, _, _P) ->
  -    ok;
  +    simple_client_timer_mon(N+1, M, P).
  +
   generic_client(N, M, P) ->
  +    put(?COUNTER, N),
       _ = generic_server:reply(P, M),
       _ = generic_server:reply(P, M),
       _ = generic_server:reply(P, M),
       _ = generic_server:reply(P, M),
       _ = generic_server:reply(P, M),
  -    generic_client(N-1, M, P).
  -
  -generic_timer_client(0, _, _P) ->
  -    ok;
  +    generic_client(N+1, M, P).
  +
   generic_timer_client(N, M, P) ->
  +    put(?COUNTER, N),
       _ = generic_server_timer:reply(P, M),
       _ = generic_server_timer:reply(P, M),
       _ = generic_server_timer:reply(P, M),
       _ = generic_server_timer:reply(P, M),
       _ = generic_server_timer:reply(P, M),
  -    generic_timer_client(N-1, M, P).
  +    generic_timer_client(N+1, M, P).
   
   bench(simple) ->
       {fun simple_client/3, simple_server};
  
positive.code:     SimpleTimerMon = norm(SimpleTimerMon0, Simple0),
      Generic = norm(Generic0, Simple0),
      GenericTimer = norm(GenericTimer0, Simple0),
      {Parallelism, _N, Message} = bench_params(Kind),
      Wordsize = erlang:system_info(wordsize),
      MSize = Wordsize * erts_debug:flat_size(Message),
      What = io_lib:format("#parallel gen_server instances: ~.4w, "
  
negative.code:         _ -> 1
      end.
  
  create_clients(M, ServerMod, Client, Parallel) ->
      fun() ->
              State = term,
              ServerPid = ServerMod:start(State),
              PidRefs = [spawn_monitor(fun() -> Client(0, M, ServerPid) end) ||
                            _ <- lists:seq(1, Parallel)],
              timer:sleep(?MAX_TIME),
              try
                  AllPidsN = collect(PidRefs, []),
                  TotalLoops = lists:sum(AllPidsN),
                  TotalLoops
              after
                  ok = ServerMod:stop(ServerPid)
              end
      end.
  
  collect([], Result) ->
      Result;
  collect([{Pid, Ref}|PidRefs], Result) ->
      N = case erlang:process_info(Pid, dictionary) of
              {dictionary, Dict} ->
                  {?COUNTER, N0} = lists:keyfind(?COUNTER, 1, Dict),
                  N0;
              undefined -> % Process did not start in ?MAX_TIME_SECS.
                  0
          end,
      exit(Pid, kill),
      receive {'DOWN', Ref, _, _, _} -> ok end,
      collect(PidRefs, [N|Result]).
  
  run_test(Test) ->
      {T1, _} = statistics(runtime),
      Result = Test(),
      {T2, _} = statistics(runtime),
      {Result, T2 - T1}.
  