String toString( long mask ) { return Long.toString(sum(mask)); }
String toString( long mask ) { return Long.toString(sum(mask)); }
public long estimate_sum( long mask ) { // For short tables, just do the work if( _t.length <= 64 ) return sum(mask); // For bigger tables, periodically freshen a cached value long millis = System.currentTimeMillis(); if( _fuzzy_time != millis ) { // Time marches on? _fuzzy_sum_cache = sum(mask); // Get sum the hard way _fuzzy_time = millis; // Indicate freshness of cached value } return _fuzzy_sum_cache; // Return cached sum }
/** Same as {@link #get}, included for completeness. */ public long longValue() { return _cat.sum(0); }
/** Same as {@link #get}, included for completeness. */ public long longValue() { return _cat.sum(0); }
/** Same as {@link #get}, included for completeness. */ public int intValue() { return (int)_cat.sum(0); } /** Same as {@link #get}, included for completeness. */
public long estimate_sum( long mask ) { // For short tables, just do the work if( _t.length <= 64 ) return sum(mask); // For bigger tables, periodically freshen a cached value long millis = System.currentTimeMillis(); if( _fuzzy_time != millis ) { // Time marches on? _fuzzy_sum_cache = sum(mask); // Get sum the hard way _fuzzy_time = millis; // Indicate freshness of cached value } return _fuzzy_sum_cache; // Return cached sum }
public long sum( long mask ) { long sum = _sum_cache; if( sum != Long.MIN_VALUE ) return sum; sum = _next == null ? 0 : _next.sum(mask); // Recursively get cached sum long[] t = _t; for( int i=0; i<t.length; i++ ) sum += t[i]&(~mask); _sum_cache = sum; // Cache includes recursive counts return sum; }
/** * Current value of the counter. Since other threads are updating furiously * the value is only approximate, but it includes all counts made by the * current thread. Requires a pass over the internally striped counters. */ public long get() { return _cat.sum(0); } /** Same as {@link #get}, included for completeness. */
/** Same as {@link #get}, included for completeness. */ public int intValue() { return (int)_cat.sum(0); } /** Same as {@link #get}, included for completeness. */
public long sum( long mask ) { long sum = _sum_cache; if( sum != Long.MIN_VALUE ) return sum; sum = _next == null ? 0 : _next.sum(mask); // Recursively get cached sum long[] t = _t; for( int i=0; i<t.length; i++ ) sum += t[i]&(~mask); _sum_cache = sum; // Cache includes recursive counts return sum; }
/** * Current value of the counter. Since other threads are updating furiously * the value is only approximate, but it includes all counts made by the * current thread. Requires a pass over the internally striped counters. */ public long get() { return _cat.sum(0); } /** Same as {@link #get}, included for completeness. */