anchor.diff:          _ -> 1
       end.
   
  -create_clients(N, M, ServerMod, Client, Parallel) ->
  +create_clients(M, ServerMod, Client, Parallel) ->
       fun() ->
               State = term,
               ServerPid = ServerMod:start(State),
  -            PidRefs = [spawn_monitor(fun() -> Client(N, M, ServerPid) end) ||
  +            PidRefs = [spawn_monitor(fun() -> Client(0, M, ServerPid) end) ||
                             _ <- lists:seq(1, Parallel)],
  -            _ = [receive {'DOWN', Ref, _, _, _} -> ok end ||
  -                    {_Pid, Ref} <- PidRefs],
  -            ok = ServerMod:stop(ServerPid)
  +            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),
  -    Test(),
  +    Result = Test(),
       {T2, _} = statistics(runtime),
  -    T2 - T1.
  +    {Result, T2 - T1}.
  
positive.code: %%
  %% %CopyrightBegin%
  %%
  %% Copyright Ericsson AB 2012-2017. All Rights Reserved.
  %%
  %% Licensed under the Apache License, Version 2.0 (the "License");
  %% you may not use this file except in compliance with the License.
  
negative.code:     {comment, C}.
  
  norm(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, 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}]}),
      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(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(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(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(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(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).
  
  bench(simple) ->
      {fun simple_client/3, simple_server};
  