Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make value gen size warning aware of new config

If the input size is smaller than the value generator size then a
warning is logged.  Now that there are multiple input configs make
sure to log the correct one.
  • Loading branch information...
commit 7dd24d979909ca6237722040d264557db9d9e5eb 1 parent 51f9a0f
@rzezeski rzezeski authored
Showing with 9 additions and 7 deletions.
  1. +2 −0  include/basho_bench.hrl
  2. +7 −7 src/basho_bench_valgen.erl
View
2  include/basho_bench.hrl
@@ -11,3 +11,5 @@
-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))).
+-define(VAL_GEN_BLOB_CFG, value_generator_blob_file).
+-define(VAL_GEN_SRC_SIZE, value_generator_source_size).
View
14 src/basho_bench_valgen.erl
@@ -67,29 +67,29 @@ dimension(_Other, _) ->
%% ====================================================================
init_source(Id) ->
- init_source(Id, basho_bench_config:get(value_generator_blob_file, undefined)).
+ init_source(Id, basho_bench_config:get(?VAL_GEN_BLOB_CFG, undefined)).
init_source(Id, undefined) ->
if Id == 1 -> ?DEBUG("random source\n", []);
true -> ok
end,
- SourceSz = basho_bench_config:get(value_generator_source_size, 1048576),
- {SourceSz, crypto:rand_bytes(SourceSz)};
+ SourceSz = basho_bench_config:get(?VAL_GEN_SRC_SIZE, 1048576),
+ {?VAL_GEN_SRC_SIZE, SourceSz, crypto:rand_bytes(SourceSz)};
init_source(Id, Path) ->
{Path, {ok, Bin}} = {Path, file:read_file(Path)},
if Id == 1 -> ?DEBUG("path source ~p ~p\n", [size(Bin), Path]);
true -> ok
end,
- {size(Bin), Bin}.
+ {?VAL_GEN_BLOB_CFG, size(Bin), Bin}.
-data_block({SourceSz, Source}, BlockSize) ->
+data_block({SourceCfg, SourceSz, Source}, BlockSize) ->
case SourceSz - BlockSize > 0 of
true ->
Offset = random:uniform(SourceSz - BlockSize),
<<_:Offset/bytes, Slice:BlockSize/bytes, _Rest/binary>> = Source,
Slice;
false ->
- ?WARN("value_generator_source_size is too small; it needs a value > ~p.\n",
- [BlockSize]),
+ ?WARN("~p is too small ~p < ~p\n",
+ [SourceCfg, SourceSz, BlockSize]),
Source
end.
Please sign in to comment.
Something went wrong with that request. Please try again.