anchor.diff:  	    error(timeout)
       end.
   
  -update_h(N, Name, Sleep, ReadInt, ReadInt0, Acc) when N > 0 ->
  -    {T,true} = timer:tc(?MODULE,update,[Name, 1, true]),
  +update_h(N, Name, Sleep, ReadInt, ReadInt0, Hist, Acc) when N > 0 ->
  +    {T,true} = timer:tc(?MODULE,update,[Name, N div 7, true]),
       Acc1 = [T|Acc],
       {R, ReadInt1, Acc2} =
   	if ReadInt =< 0 ->
   		{[trim_(bear:get_statistics(Acc1)),
  -		  trim(timer:tc(?MODULE,get_histogram_statistics, [Name]))],
  +		  trim(timer:tc(?MODULE,get_histogram_statistics,
  +				[Name, Hist]))],
   		 ReadInt0, []};
   	   true ->
   		{[], ReadInt - 1, Acc1}
   	end,
       timer:sleep(Sleep),
  -    R ++ update_h(N-1, Name, Sleep, ReadInt1, ReadInt0, Acc2);
  -update_h(_, Name, _, _, _, Acc) ->
  +    R ++ update_h(N-1, Name, Sleep, ReadInt1, ReadInt0, Hist, Acc2);
  +update_h(_, Name, _, _, _, Hist, Acc) ->
       [trim_(bear:get_statistics(Acc)),
  -     trim(timer:tc(?MODULE, get_histogram_statistics, [Name]))].
  +     trim(timer:tc(?MODULE, get_histogram_statistics, [Name, Hist]))].
   
   trim({T,H}) ->
       {T, trim_(H)}.
   
   trim_(Hist) ->
       [{K,V} || {K,V} <- Hist,
  -	      lists:member(K, [min,max,median])].
  +	      lists:member(K, [min,max,median,percentile])].
   
   update(N, Value, true) ->
       call(N, {update, Value});
  
positive.code:     [trim_(bear:get_statistics(Acc)),
       trim(timer:tc(folsom_metrics, get_histogram_statistics, [Name]))].
  
  
  new_h(Name, W) ->
      Me = self(),
  
negative.code: 	catch folsom_metrics:delete_metric(Name)
      end.
  
  folsom_update(W, Ps, N) ->
      reset(folsom),
      ok = folsom_metrics:new_histogram(Name = folsom_slide, slide, W),
      try  {T,_} = timer:tc(?MODULE, folsom_update_p, [Name, Ps, N]),
  	 T
      after
  	catch folsom_metrics:delete_metric(Name)
      end.
  
  reset(App) ->
      application:stop(App),
      application:start(App).
  
  my_slide(W, Int) ->
      my_slide(W, Int, full).
  
  my_slide(W, Int, Hist) when Hist==full; Hist==mini ->
      reset(exometer),
      true = new_h(Name = my_slide, W),
      try
  	update_h(_N = W * 10 * 5, Name, _Sleep = 10, _ReadInt = Int,  Int,
  		 Hist, [])
      after
  	unlink(whereis(Name)),
  	exit(whereis(Name), kill)
      end.
  
  my_slide_update(W, Ps, N) ->
      reset(exometer),
      true = new_h(Name = my_slide, W),
      try {T, _} = timer:tc(?MODULE, my_slide_update_p, [Name, Ps, N]),
          T
      after
  	unlink(whereis(Name)),
  	exit(whereis(Name), kill)
      end.
  
  
  