use of org.apache.datasketches.theta.ConcurrentHeapQuickSelectSketchTest.SharedLocal in project sketches-core by DataSketches.
the class ConcurrentDirectQuickSelectSketchTest method checkEstModeMemoryArr.
@Test
public void checkEstModeMemoryArr() {
int lgK = 12;
int k = 1 << lgK;
boolean useMem = true;
SharedLocal sl = new SharedLocal(lgK, lgK, useMem);
UpdateSketch shared = sl.shared;
UpdateSketch local = sl.local;
assertTrue(local.isEmpty());
int u = 3 * k;
for (int i = 0; i < u; i++) {
local.update(i);
}
waitForBgPropagationToComplete(shared);
double est = local.getEstimate();
assertTrue((est < (u * 1.05)) && (est > (u * 0.95)));
assertTrue(shared.getRetainedEntries(false) >= k);
}
Aggregations