@Test public void createHLLCPerformance(){ int cardinality = 3_000_000; HLLCounter hllc = generateTestCounter(2009, cardinality); final int testCount = 30000; HLLCounter hllc2 = null; long start = System.currentTimeMillis(); for (int i = 0; i < testCount; i++){ hllc2 = new HLLCounter(hllc); } long totalTime = System.currentTimeMillis() - start; System.out.println("constructor of HLLCounter cost time : " + totalTime); long estimate = hllc2.getCountEstimate(); assertTrue(estimate > 0.9 * cardinality && estimate < 1.1 * cardinality); System.out.println("estimate is " + estimate); }
public long getCountEstimate() { return new HLLCSnapshot(this).getCountEstimate(); }
HLLCounter implements Serializable, Comparable<HLLCounter> { public long getCountEstimate() { return new HLLCSnapshot(this).getCountEstimate(); } }
HLLCounter implements Serializable, Comparable<HLLCounter> { public long getCountEstimate() { return new HLLCSnapshot(this).getCountEstimate(); } HLLCounter();  HLLCounter(int p);  HLLCounter(int p, HashFunction hashFunc);  HLLCounter(HLLCounter another);  HLLCounter(int p, RegisterType type);   HLLCounter(int p, RegisterType type, HashFunction hashFunc); }
HLLCounter implements Serializable, Comparable<HLLCounter> { public long getCountEstimate() { return new HLLCSnapshot(this).getCountEstimate(); } HLLCounter();  HLLCounter(int p);  HLLCounter(int p, HashFunction hashFunc);  HLLCounter(HLLCounter another);  HLLCounter(int p, RegisterType type);   HLLCounter(int p, RegisterType type, HashFunction hashFunc); boolean isDense(int size); void add(int value); void add(String value); void add(byte[] value); void add(byte[] value, int offset, int length); void addHashDirectly(long hash); void merge(HLLCounter another); long getCountEstimate(); int getPrecision(); double getErrorRate(); @Override String toString(); static void main(String[] args); Register getRegister(); void clear(); void writeRegisters(final ByteBuffer out); void readRegisters(ByteBuffer in); int peekLength(ByteBuffer in); int maxLength(); int getRegisterIndexSize(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(HLLCounter o); static void writeUnsigned(int num, int size, ByteBuffer out); static int readUnsigned(ByteBuffer in, int size); RegisterType getRegisterType(); }
HLLCounter implements Serializable, Comparable<HLLCounter> { public long getCountEstimate() { return new HLLCSnapshot(this).getCountEstimate(); } HLLCounter();  HLLCounter(int p);  HLLCounter(int p, HashFunction hashFunc);  HLLCounter(HLLCounter another);  HLLCounter(int p, RegisterType type);   HLLCounter(int p, RegisterType type, HashFunction hashFunc); boolean isDense(int size); void add(int value); void add(String value); void add(byte[] value); void add(byte[] value, int offset, int length); void addHashDirectly(long hash); void merge(HLLCounter another); long getCountEstimate(); int getPrecision(); double getErrorRate(); @Override String toString(); static void main(String[] args); Register getRegister(); void clear(); void writeRegisters(final ByteBuffer out); void readRegisters(ByteBuffer in); int peekLength(ByteBuffer in); int maxLength(); int getRegisterIndexSize(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(HLLCounter o); static void writeUnsigned(int num, int size, ByteBuffer out); static int readUnsigned(ByteBuffer in, int size); RegisterType getRegisterType();  }