Skip to content

Commit

Permalink
Use standard IEC units for KB/s, KiB/s, MB/s, MiB/s. See http://en.wi…
Browse files Browse the repository at this point in the history
…kipedia.org/wiki/Mebibyte for more information.
  • Loading branch information
Earl Campbell Ruby committed Jan 2, 2015
1 parent 5d8a68a commit f7ab668
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ results:
byte_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph byte/sec -i tests/current

kbyte_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph Kbyte/sec -i tests/current
kb_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph KB/sec -i tests/current

mbyte_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph Mbyte/sec -i tests/current
kib_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph KiB/sec -i tests/current

mb_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph MB/sec -i tests/current

mib_sec-results:
Rscript --vanilla priv/summary.r --ylabel1stgraph MiB/sec -i tests/current

TARGETS := $(shell ls tests/ | grep -v current)
JOBS := $(addprefix job,${TARGETS})
Expand Down
4 changes: 2 additions & 2 deletions examples/cs.config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
{cs_request_timeout, 999999000}.
% If using the cs_measurement_units option, you need to change
% any R graph's labels of the Y axis, e.g. basho_bench's Makefile target
% "make mbyte_sec-results"
{cs_measurement_units, mbyte_sec}.
% "make mb_sec-results"
{cs_measurement_units, mb_sec}.

{key_generator, {int_to_str, {partitioned_sequential_int, 1000}}}.
%{key_generator, {int_to_str, {uniform_int, 1000}}}.
Expand Down
18 changes: 11 additions & 7 deletions src/basho_bench_driver_cs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,19 @@ new(ID) ->
Disconnect = basho_bench_config:get(cs_disconnect_frequency, infinity),
erlang:put(disconnect_freq, Disconnect),

%% Get our measurement units: op/sec, Byte/sec, KByte/sec, MByte/sec
%% Get our measurement units: ops/sec, Byte/sec, KB/sec, KiB/sec, MB/sec, MiB/sec.
%% Throw a run-time exception if the config file has cs_measurement_units set
%% to an unrecognized value.
{RF_name, ReportFun} =
%% We need to be really careful with these custom units things.
%% Use floats for everything.
%% Use standard IEC units for KB/s, KiB/s, MB/s, MiB/s.
%% See http://en.wikipedia.org/wiki/Mebibyte for more information.
case (catch basho_bench_config:get(cs_measurement_units)) of
N = byte_sec -> {N, fun(X) -> X / 1 end};
N = kbyte_sec -> {N, fun(X) -> X / 1024 end};
N = mbyte_sec -> {N, fun(X) -> X / (1024 * 1024) end};
_ -> {op_sec, fun(_) -> 1.0 end}
N = ops_sec -> {N, fun(X) -> 1.0 end};
N = byte_sec -> {N, fun(X) -> X / 1 end};
N = kb_sec -> {N, fun(X) -> X / 1000 end};
N = kib_sec -> {N, fun(X) -> X / 1024 end};
N = mb_sec -> {N, fun(X) -> X / (1000 * 1000) end};
N = mib_sec -> {N, fun(X) -> X / (1024 * 1024) end};
end,
if ID == 1 ->
application:start(ibrowse),
Expand Down

0 comments on commit f7ab668

Please sign in to comment.