4343 * <p>Given such highly-skewed distributions, using this map is far more efficient space-wise than
4444 * the alternative of dedicating an HLL sketch per key. Based on our use cases, after
4545 * subtracting the space required for key storage, the average bytes per key required for unique
46- * count estimation ({@link #getAverageSketchMemoryPerKey ()}) is about 10.
46+ * count estimation ({@link #getAverageSketchBytesPerKey ()}) is about 10.
4747 *
4848 * <p>Internally, this map is implemented as a hierarchy of internal hash maps with progressively
4949 * increasing storage allocated for unique count estimation. As a key acquires more identifiers it
@@ -209,11 +209,11 @@ public int getActiveEntries() {
209209 * Returns total bytes used by all internal maps
210210 * @return total bytes used by all internal maps
211211 */
212- public long getMemoryUsageBytes () {
212+ public long getTotalUsageBytes () {
213213 long total = 0 ;
214214 for (int i = 0 ; i < maps_ .length ; i ++) {
215215 if (maps_ [i ] != null ) {
216- total += maps_ [i ].getMemoryUsageBytes ();
216+ total += maps_ [i ].getTotalUsageBytes ();
217217 }
218218 }
219219 return total ;
@@ -223,7 +223,7 @@ public long getMemoryUsageBytes() {
223223 * Returns total bytes used for key storage
224224 * @return total bytes used for key storage
225225 */
226- public long getKeyMemoryUsageBytes () {
226+ public long getKeyUsageBytes () {
227227 long total = 0 ;
228228 for (int i = 0 ; i < maps_ .length ; i ++) {
229229 if (maps_ [i ] != null ) {
@@ -234,11 +234,11 @@ public long getKeyMemoryUsageBytes() {
234234 }
235235
236236 /**
237- * Returns the average memory storage per key that is dedicated to sketching the unique counts.
238- * @return the average memory storage per key that is dedicated to sketching the unique counts.
237+ * Returns the average bytes storage per key that is dedicated to sketching the unique counts.
238+ * @return the average bytes storage per key that is dedicated to sketching the unique counts.
239239 */
240- public double getAverageSketchMemoryPerKey () {
241- return (double ) (getMemoryUsageBytes () - getKeyMemoryUsageBytes ()) / getActiveEntries ();
240+ public double getAverageSketchBytesPerKey () {
241+ return (double ) (getTotalUsageBytes () - getKeyUsageBytes ()) / getActiveEntries ();
242242 }
243243
244244 /**
@@ -280,16 +280,16 @@ Map getHllMap() {
280280 @ Override
281281 public String toString () {
282282 final long totKeys = getActiveEntries ();
283- final long totMem = getMemoryUsageBytes ();
284- final long keyMem = getKeyMemoryUsageBytes ();
285- final double avgValMemPerKey = getAverageSketchMemoryPerKey ();
283+ final long totBytes = getTotalUsageBytes ();
284+ final long keyBytes = getKeyUsageBytes ();
285+ final double avgValBytesPerKey = getAverageSketchBytesPerKey ();
286286
287287 final String ksb = Map .fmtLong (keySizeBytes_ );
288288 final String alvls = Map .fmtLong (getActiveMaps ());
289289 final String tKeys = Map .fmtLong (totKeys );
290- final String tMem = Map .fmtLong (totMem );
291- final String kMem = Map .fmtLong (keyMem );
292- final String avgValMem = Map .fmtDouble (avgValMemPerKey );
290+ final String tBytes = Map .fmtLong (totBytes );
291+ final String kBytes = Map .fmtLong (keyBytes );
292+ final String avgValBytes = Map .fmtDouble (avgValBytesPerKey );
293293
294294
295295 final StringBuilder sb = new StringBuilder ();
@@ -298,9 +298,9 @@ public String toString() {
298298 sb .append (" Key Size Bytes : " ).append (ksb ).append (LS );
299299 sb .append (" Active Map Levels : " ).append (alvls ).append (LS );
300300 sb .append (" Total keys : " ).append (tKeys ).append (LS );
301- sb .append (" Total Memory Bytes : " ).append (tMem ).append (LS );
302- sb .append (" Total Key Memory Bytes : " ).append (kMem ).append (LS );
303- sb .append (" Avg Sketch Memory Bytes/Key: " ).append (avgValMem ).append (LS );
301+ sb .append (" Total Usage Bytes : " ).append (tBytes ).append (LS );
302+ sb .append (" Total Key Usage Bytes : " ).append (kBytes ).append (LS );
303+ sb .append (" Avg Sketch Usage Bytes/Key : " ).append (avgValBytes ).append (LS );
304304 sb .append (LS );
305305 for (int i = 0 ; i < maps_ .length ; i ++) {
306306 final Map cMap = maps_ [i ];
0 commit comments