anchor.diff:  prop_get_fsm() ->
       application:set_env(riak_cs, lfs_block_size, 1048576),
       ?FORALL(State, #state{content_length=?LET(X, riak_cs_gen:bounded_content_length(), X * 10)},
  -        ?FORALL(Cmds, eqc_statem:more_commands(10, commands(?MODULE, {start, State})),
  -                begin
  -                    {H,{_F, NewState},Res} = run_commands(?MODULE, Cmds),
  -                    stop_fsm(NewState#state.fsm_pid),
  -                    ?WHENFAIL(io:format("history is ~p ~n", [[StateRecord#state{last_chunk=last_chunk_substitute} || {{_StateName, StateRecord}, _Results}<- H]]), equals(ok, Res))
  -                end)).
  +    ?FORALL(Cmds, eqc_statem:more_commands(10, commands(?MODULE, {start, State})),
  +            begin
  +                {H, {_F, FinalState}, Res} = run_commands(?MODULE, Cmds),
  +                #state{fsm_pid=FsmPid, content_length=ContentLength,
  +                       total_blocks=TotalBlocks, counter=Counter} = FinalState,
  +                stop_fsm(FsmPid),
  +                %% Collect stats how much percentages of blocks are consumed.
  +                ConsumedPercentage =
  +                    case TotalBlocks of
  +                        undefined -> no_consumption;
  +                        _ -> min(100, trunc(100*(Counter)/TotalBlocks))
  +                    end,
  +                collect(with_title(consumed_percentage), ConsumedPercentage,
  +                collect(with_title(content_length_mm), ContentLength/1000000,
  +                collect(with_title(command_length), length(Cmds),
  +                        ?WHENFAIL(io:format("history is ~p ~n", [[S || {S, _Rs} <- H]]),
  +                                  equals(ok, Res)))))
  +            end)).
   
   %%====================================================================
   %% Generators
  
positive.code:          waiting_chunk/1,
           stop/1]).
  
  %% Helpers
  %% TODO: export!
  -export([]).
  
  -define(QC_OUT(P),
          eqc:on_output(fun(Str, Args) ->
                                io:format(user, Str, Args) end, P)).
  -define(TEST_ITERATIONS, 500).
  
  -record(state, {fsm_pid :: pid(), %% real pid}
                  content_length :: integer(), %% not symbolic
                  total_blocks :: integer(), %% not symbolic
                  last_chunk :: binary(), %% not symbolic
                  counter=0 :: integer()}). %% not symbolic
  
  %%====================================================================
  %% Eunit tests
  
negative.code: stop(_S) ->
      [].
  
  precondition(start, waiting_chunk, _S, _C) ->
      true;
  precondition(waiting_chunk, waiting_chunk,
               #state{counter=Counter, total_blocks=TotalBlocks}, _C) ->
      Counter =< TotalBlocks;
  precondition(waiting_chunk, stop,
               #state{counter=Counter, total_blocks=TotalBlocks}, _C) ->
      Counter =:= TotalBlocks + 1.
  
  postcondition(start, waiting_chunk, _State, _C, _R) ->
      true;
  postcondition(waiting_chunk, waiting_chunk, #state{counter=Counter}, _C, Response) ->
      validate_waiting_chunk_response(Counter, Response);
  postcondition(waiting_chunk, stop, #state{counter=Counter, total_blocks=TotalBlocks}, _C, _R) ->
      Counter =:= TotalBlocks + 1.
  
  %%====================================================================
  %% Helpers
  %%====================================================================
  
  validate_waiting_chunk_response(Counter, {chunk, Chunk}) ->
      <<CounterInChunk:32/little, _/binary>> = Chunk,
      Counter =:= CounterInChunk;
  validate_waiting_chunk_response(_Counter, {done, Chunk}) ->
      Chunk =:= <<>>.
  
  block_size() ->
      riak_cs_lfs_utils:block_size().
  
  -endif.
  