loadWords(args[8]);
} else {
loadWords(null);
}
final Iface client = BlurClient.getClient(args[0]);
final String table = args[1];
final boolean wal = Boolean.parseBoolean(args[2]);
final int numberOfColumns = Integer.parseInt(args[3]);
final int numberRecordsPerRow = Integer.parseInt(args[4]);
final int numberOfFamilies = Integer.parseInt(args[5]);
final int numberOfWords = Integer.parseInt(args[6]);
final long timeBetweenReporting = TimeUnit.SECONDS.toMillis(Integer.parseInt(args[7]));
final long start = System.currentTimeMillis();
long s = start;
long recordCountTotal = 0;
long rowCount = 0;
int batchSize = 100;
List<RowMutation> batch = new ArrayList<RowMutation>();
long recordCount = 0;
long totalTime = 0;
long calls = 0;
while (true) {
long now = System.currentTimeMillis();
if (s + timeBetweenReporting < now) {
double avgSeconds = (now - start) / 1000.0;
double seconds = (now - s) / 1000.0;
double avgRate = recordCountTotal / avgSeconds;
double rate = recordCount / seconds;
double latency = (totalTime / 1000000.0) / calls;
System.out.println(System.currentTimeMillis() + "," + recordCountTotal + "," + rowCount + "," + latency + "," + rate + "," + avgRate);
s = now;
recordCount = 0;
totalTime = 0;
calls = 0;
}
RowMutation mutation = new RowMutation();
mutation.setTable(table);
String rowId = getRowId();
mutation.setRowId(rowId);
mutation.setWal(wal);
mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
for (int j = 0; j < numberRecordsPerRow; j++) {
mutation.addToRecordMutations(getRecordMutation(numberOfColumns, numberOfFamilies, numberOfWords));
}
batch.add(mutation);
if (batch.size() >= batchSize) {
long sm = System.nanoTime();
client.mutateBatch(batch);
long em = System.nanoTime();
calls++;
totalTime += (em - sm);
batch.clear();
}