Commits

Anonymous committed a0efebe

Added start/size variant of partitioned_sequential_int.

Comments (0)

Files changed (1)

src/basho_bench_keygen.erl

     Ref = make_ref(),
     fun() -> Key = sequential_int_generator(Ref, MaxKey), integer_to_list(Key) end;
 new({partitioned_sequential_int, MaxKey}, Id) ->
+    new({partitioned_sequential_int, 0, MaxKey}, Id);
+new({partitioned_sequential_int, StartKey, NumKeys}, Id) ->
     Workers = basho_bench_config:get(concurrent),
-    MaxValue = MaxKey div Workers,
-    MinValue = MaxValue * (Id - 1),
+    Range = NumKeys div Workers,
+    MinValue = StartKey + Range * (Id - 1),
+    MaxValue = StartKey + Range * Id,
     Ref = make_ref(),
+    ?DEBUG("ID ~p generating range ~p to ~p\n", [Id, MinValue, MaxValue]),
     fun() -> sequential_int_generator(Ref,MaxValue) + MinValue end;
 new({partitioned_sequential_int_bin, MaxKey}, Id) ->
     Gen = new({partitioned_sequential_int, MaxKey}, Id),
     fun() -> <<(Gen()):32/native>> end;
+new({partitioned_sequential_int_bin, StartKey, NumKeys}, Id) ->
+    Gen = new({partitioned_sequential_int, StartKey, NumKeys}, Id),
+    fun() -> <<(Gen()):32/native>> end;
 new({partitioned_sequential_int_str, MaxKey}, Id) ->
     Gen = new({partitioned_sequential_int, MaxKey}, Id),
     fun() -> integer_to_list(Gen()) end;
+new({partitioned_sequential_int_str, StartKey, NumKeys}, Id) ->
+    Gen = new({partitioned_sequential_int, StartKey, NumKeys}, Id),
+    fun() -> integer_to_list(Gen()) end;
 new({uniform_int_bin, MaxKey}, _Id) ->
     fun() -> Key = random:uniform(MaxKey), <<Key:32/native>> end;
 new({uniform_int_str, MaxKey}, _Id) ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.