@@ -23,6 +23,7 @@ function returnArg (name, def) {
2323}
2424var num_clients = returnArg ( 'clients' , 1 ) ;
2525var run_time = returnArg ( 'time' , 2500 ) ; // ms
26+ var pipeline = returnArg ( 'pipeline' , 1 ) ; // number of concurrent commands
2627var versions_logged = false ;
2728var client_options = {
2829 parser : returnArg ( 'parser' , 'hiredis' ) ,
@@ -41,17 +42,18 @@ function lpad (input, len, chr) {
4142
4243metrics . Histogram . prototype . print_line = function ( ) {
4344 var obj = this . printObj ( ) ;
44- return lpad ( ( obj . min / 1e6 ) . toFixed ( 2 ) , 6 ) + '/' + lpad ( ( obj . max / 1e6 ) . toFixed ( 2 ) , 6 ) + '/' + lpad ( ( obj . mean / 1e6 ) . toFixed ( 2 ) , 6 ) ;
45+ return lpad ( ( obj . mean / 1e6 ) . toFixed ( 2 ) , 6 ) + '/' + lpad ( ( obj . max / 1e6 ) . toFixed ( 2 ) , 6 ) ;
4546} ;
4647
4748function Test ( args ) {
4849 this . args = args ;
50+ this . args . pipeline = + pipeline ;
4951 this . callback = null ;
5052 this . clients = [ ] ;
5153 this . clients_ready = 0 ;
5254 this . commands_sent = 0 ;
5355 this . commands_completed = 0 ;
54- this . max_pipeline = this . args . pipeline || 50 ;
56+ this . max_pipeline = + pipeline ;
5557 this . batch_pipeline = this . args . batch || 0 ;
5658 this . client_options = args . client_options || { } ;
5759 this . client_options . parser = client_options . parser ;
@@ -206,7 +208,7 @@ Test.prototype.print_stats = function () {
206208 var duration = Date . now ( ) - this . test_start ;
207209 totalTime += duration ;
208210
209- console . log ( 'min /max/avg : ' + this . command_latency . print_line ( ) + ' ' + lpad ( duration , 6 ) + 'ms total, ' +
211+ console . log ( 'avg /max: ' + this . command_latency . print_line ( ) + lpad ( duration , 5 ) + 'ms total, ' +
210212 lpad ( Math . round ( this . commands_completed / ( duration / 1000 ) ) , 7 ) + ' ops/sec' ) ;
211213} ;
212214
@@ -217,55 +219,55 @@ large_buf = new Buffer(large_str);
217219very_large_str = ( new Array ( ( 4 * 1024 * 1024 ) + 1 ) . join ( '-' ) ) ;
218220very_large_buf = new Buffer ( very_large_str ) ;
219221
220- tests . push ( new Test ( { descr : 'PING' , command : 'ping' , args : [ ] , pipeline : 1 } ) ) ;
222+ tests . push ( new Test ( { descr : 'PING' , command : 'ping' , args : [ ] } ) ) ;
221223tests . push ( new Test ( { descr : 'PING' , command : 'ping' , args : [ ] , batch : 50 } ) ) ;
222224
223- tests . push ( new Test ( { descr : 'SET 4B str' , command : 'set' , args : [ 'foo_rand000000000000' , small_str ] , pipeline : 1 } ) ) ;
225+ tests . push ( new Test ( { descr : 'SET 4B str' , command : 'set' , args : [ 'foo_rand000000000000' , small_str ] } ) ) ;
224226tests . push ( new Test ( { descr : 'SET 4B str' , command : 'set' , args : [ 'foo_rand000000000000' , small_str ] , batch : 50 } ) ) ;
225227
226- tests . push ( new Test ( { descr : 'SET 4B buf' , command : 'set' , args : [ 'foo_rand000000000000' , small_buf ] , pipeline : 1 } ) ) ;
228+ tests . push ( new Test ( { descr : 'SET 4B buf' , command : 'set' , args : [ 'foo_rand000000000000' , small_buf ] } ) ) ;
227229tests . push ( new Test ( { descr : 'SET 4B buf' , command : 'set' , args : [ 'foo_rand000000000000' , small_buf ] , batch : 50 } ) ) ;
228230
229- tests . push ( new Test ( { descr : 'GET 4B str' , command : 'get' , args : [ 'foo_rand000000000000' ] , pipeline : 1 } ) ) ;
231+ tests . push ( new Test ( { descr : 'GET 4B str' , command : 'get' , args : [ 'foo_rand000000000000' ] } ) ) ;
230232tests . push ( new Test ( { descr : 'GET 4B str' , command : 'get' , args : [ 'foo_rand000000000000' ] , batch : 50 } ) ) ;
231233
232- tests . push ( new Test ( { descr : 'GET 4B buf' , command : 'get' , args : [ 'foo_rand000000000000' ] , pipeline : 1 , client_opts : { return_buffers : true } } ) ) ;
234+ tests . push ( new Test ( { descr : 'GET 4B buf' , command : 'get' , args : [ 'foo_rand000000000000' ] , client_opts : { return_buffers : true } } ) ) ;
233235tests . push ( new Test ( { descr : 'GET 4B buf' , command : 'get' , args : [ 'foo_rand000000000000' ] , batch : 50 , client_opts : { return_buffers : true } } ) ) ;
234236
235- tests . push ( new Test ( { descr : 'SET 4KiB str' , command : 'set' , args : [ 'foo_rand000000000001' , large_str ] , pipeline : 1 } ) ) ;
237+ tests . push ( new Test ( { descr : 'SET 4KiB str' , command : 'set' , args : [ 'foo_rand000000000001' , large_str ] } ) ) ;
236238tests . push ( new Test ( { descr : 'SET 4KiB str' , command : 'set' , args : [ 'foo_rand000000000001' , large_str ] , batch : 50 } ) ) ;
237239
238- tests . push ( new Test ( { descr : 'SET 4KiB buf' , command : 'set' , args : [ 'foo_rand000000000001' , large_buf ] , pipeline : 1 } ) ) ;
240+ tests . push ( new Test ( { descr : 'SET 4KiB buf' , command : 'set' , args : [ 'foo_rand000000000001' , large_buf ] } ) ) ;
239241tests . push ( new Test ( { descr : 'SET 4KiB buf' , command : 'set' , args : [ 'foo_rand000000000001' , large_buf ] , batch : 50 } ) ) ;
240242
241- tests . push ( new Test ( { descr : 'GET 4KiB str' , command : 'get' , args : [ 'foo_rand000000000001' ] , pipeline : 1 } ) ) ;
243+ tests . push ( new Test ( { descr : 'GET 4KiB str' , command : 'get' , args : [ 'foo_rand000000000001' ] } ) ) ;
242244tests . push ( new Test ( { descr : 'GET 4KiB str' , command : 'get' , args : [ 'foo_rand000000000001' ] , batch : 50 } ) ) ;
243245
244- tests . push ( new Test ( { descr : 'GET 4KiB buf' , command : 'get' , args : [ 'foo_rand000000000001' ] , pipeline : 1 , client_opts : { return_buffers : true } } ) ) ;
246+ tests . push ( new Test ( { descr : 'GET 4KiB buf' , command : 'get' , args : [ 'foo_rand000000000001' ] , client_opts : { return_buffers : true } } ) ) ;
245247tests . push ( new Test ( { descr : 'GET 4KiB buf' , command : 'get' , args : [ 'foo_rand000000000001' ] , batch : 50 , client_opts : { return_buffers : true } } ) ) ;
246248
247- tests . push ( new Test ( { descr : 'INCR' , command : 'incr' , args : [ 'counter_rand000000000000' ] , pipeline : 1 } ) ) ;
249+ tests . push ( new Test ( { descr : 'INCR' , command : 'incr' , args : [ 'counter_rand000000000000' ] } ) ) ;
248250tests . push ( new Test ( { descr : 'INCR' , command : 'incr' , args : [ 'counter_rand000000000000' ] , batch : 50 } ) ) ;
249251
250- tests . push ( new Test ( { descr : 'LPUSH' , command : 'lpush' , args : [ 'mylist' , small_str ] , pipeline : 1 } ) ) ;
252+ tests . push ( new Test ( { descr : 'LPUSH' , command : 'lpush' , args : [ 'mylist' , small_str ] } ) ) ;
251253tests . push ( new Test ( { descr : 'LPUSH' , command : 'lpush' , args : [ 'mylist' , small_str ] , batch : 50 } ) ) ;
252254
253- tests . push ( new Test ( { descr : 'LRANGE 10' , command : 'lrange' , args : [ 'mylist' , '0' , '9' ] , pipeline : 1 } ) ) ;
255+ tests . push ( new Test ( { descr : 'LRANGE 10' , command : 'lrange' , args : [ 'mylist' , '0' , '9' ] } ) ) ;
254256tests . push ( new Test ( { descr : 'LRANGE 10' , command : 'lrange' , args : [ 'mylist' , '0' , '9' ] , batch : 50 } ) ) ;
255257
256- tests . push ( new Test ( { descr : 'LRANGE 100' , command : 'lrange' , args : [ 'mylist' , '0' , '99' ] , pipeline : 1 } ) ) ;
258+ tests . push ( new Test ( { descr : 'LRANGE 100' , command : 'lrange' , args : [ 'mylist' , '0' , '99' ] } ) ) ;
257259tests . push ( new Test ( { descr : 'LRANGE 100' , command : 'lrange' , args : [ 'mylist' , '0' , '99' ] , batch : 50 } ) ) ;
258260
259- tests . push ( new Test ( { descr : 'SET 4MiB str' , command : 'set' , args : [ 'foo_rand000000000002' , very_large_str ] , pipeline : 1 } ) ) ;
261+ tests . push ( new Test ( { descr : 'SET 4MiB str' , command : 'set' , args : [ 'foo_rand000000000002' , very_large_str ] } ) ) ;
260262tests . push ( new Test ( { descr : 'SET 4MiB str' , command : 'set' , args : [ 'foo_rand000000000002' , very_large_str ] , batch : 20 } ) ) ;
261263
262- tests . push ( new Test ( { descr : 'SET 4MiB buf' , command : 'set' , args : [ 'foo_rand000000000002' , very_large_buf ] , pipeline : 1 } ) ) ;
264+ tests . push ( new Test ( { descr : 'SET 4MiB buf' , command : 'set' , args : [ 'foo_rand000000000002' , very_large_buf ] } ) ) ;
263265tests . push ( new Test ( { descr : 'SET 4MiB buf' , command : 'set' , args : [ 'foo_rand000000000002' , very_large_buf ] , batch : 20 } ) ) ;
264266
265- tests . push ( new Test ( { descr : 'GET 4MiB str' , command : 'get' , args : [ 'foo_rand000000000002' ] , pipeline : 1 } ) ) ;
267+ tests . push ( new Test ( { descr : 'GET 4MiB str' , command : 'get' , args : [ 'foo_rand000000000002' ] } ) ) ;
266268tests . push ( new Test ( { descr : 'GET 4MiB str' , command : 'get' , args : [ 'foo_rand000000000002' ] , batch : 20 } ) ) ;
267269
268- tests . push ( new Test ( { descr : 'GET 4MiB buf' , command : 'get' , args : [ 'foo_rand000000000002' ] , pipeline : 1 , client_opts : { return_buffers : true } } ) ) ;
270+ tests . push ( new Test ( { descr : 'GET 4MiB buf' , command : 'get' , args : [ 'foo_rand000000000002' ] , client_opts : { return_buffers : true } } ) ) ;
269271tests . push ( new Test ( { descr : 'GET 4MiB buf' , command : 'get' , args : [ 'foo_rand000000000002' ] , batch : 20 , client_opts : { return_buffers : true } } ) ) ;
270272
271273function next ( ) {
0 commit comments