From 5df411f3da595ee790c3d006a628d08f02d93f7a Mon Sep 17 00:00:00 2001 From: Thomas Lopatic <thomas@lopatic.de> Date: Fri, 3 Jul 2015 18:10:51 +0200 Subject: [PATCH] Execute correct number of operations, even if not a multiple of thread count. --- core/src/main/java/com/yahoo/ycsb/Client.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/yahoo/ycsb/Client.java b/core/src/main/java/com/yahoo/ycsb/Client.java index 5b2c827e..bcf33c2e 100644 --- a/core/src/main/java/com/yahoo/ycsb/Client.java +++ b/core/src/main/java/com/yahoo/ycsb/Client.java @@ -743,7 +743,15 @@ public class Client } - Thread t=new ClientThread(db,dotransactions,workload,threadid,threadcount,props,opcount/threadcount, targetperthreadperms); + int threadopcount = opcount/threadcount; + + // ensure correct number of operations, in case opcount is not a multiple of threadcount + if (threadid<opcount%threadcount) + { + ++threadopcount; + } + + Thread t=new ClientThread(db,dotransactions,workload,threadid,threadcount,props,threadopcount, targetperthreadperms); threads.add(t); //t.start(); -- GitLab