.entrySize(24)
.generatedKeyType(true)
.generatedValueType(true).file(file).kClass(LongValue.class).vClass(LongValue.class).create();
// add keys
LongValue key = DataValueClasses.newInstance(LongValue.class);
LongValue value = DataValueClasses.newInstance(LongValue.class);
for (long i = 0; i < KEYS; i++) {
key.setValue(i);
value.setValue(0);
countersMap.put(key, value);
}
System.out.println("Keys created");
// Monitor monitor = new Monitor();
LongValue value2 = DataValueClasses.newDirectReference(LongValue.class);
for (int t = 0; t < 5; t++) {
for (int rate : new int[]{2 * 1000 * 1000, 1000 * 1000, 500 * 1000/*, 250 * 1000, 100 * 1000, 50 * 1000*/}) {
Histogram times = new Histogram();
int u = 0;
long start = System.nanoTime();
long delay = 1000 * 1000 * 1000L / rate;
long next = start + delay;
for (long j = 0; j < RUN_TIME * rate; j += KEYS) {
int stride = Math.max(1, KEYS / (RUN_TIME * rate));
// the timed part
for (int i = 0; i < KEYS && u < RUN_TIME * rate; i += stride) {
// busy wait for next time.
while (System.nanoTime() < next - 12) ;
// monitor.sample = System.nanoTime();
long start0 = next;
// start the update.
key.setValue(i);
LongValue using = countersMap.getUsing(key, value2);
if (using == null)
assertNotNull(using);
value2.addAtomicValue(1);
// calculate the time using the time it should have started, not when it was able.