anchor.diff:  -export([start1/0]).
   
   %% Internal exports
  --export([do_measure_codec/8, do_measure_codec_loop/7]).
  +-export([do_measure_codec/7, do_measure_codec_loop/7]).
   -export([flex_scanner_handler/1]).
   
   
  
positive.code:        is_atom(Func) andalso
         is_list(Conf) andalso
         is_integer(MCount) andalso (MCount > 0) ->
      Self = self(),
      Pid  = spawn_link(?MODULE, do_measure_codec, 
                        [Factor, Self, Codec, Func, Conf, Version, Bin, MCount]),
      receive
  	{measure_result, Pid, Func, Res} ->
  	    {ok, Res};
  	{error, Pid, Error} ->
  	    {error, Error};
  	Else ->
  	    {error, {unexpected_result, Else}}
      after ?MEASURE_TIMEOUT ->
  	    Info = 
  		case (catch process_info(Pid)) of
  		    I when is_list(I) ->
  			exit(Pid, kill),
  			I;
  		    _ ->
  
negative.code:     Res = timer:tc(?MODULE, do_measure_codec_loop, 
  		   [Codec, Func, Conf, Version, M, MCount, dummy]),
      case Res of
  	{Time, {ok, _}} when is_integer(Time) andalso (Time > 0) ->
  	    %% OK so far, now calculate the count:
              %% For some reason we get a 'badarith' on some platforms
              %% here. Since this is just the warmup we can try-catch.
              try round(?MEASURE_COUNT_TIME/(Time/MCount)) of
                  Count ->
                      {ok, Count}
              catch
                  _:_:_ ->
                      {error, {failed_calculated_count, Time, MCount}}
              end;
  	{Time, Error} ->
  	    {error, {warmup_failed, Time, Error}}
      end.
  