public String toString( ) { return Long.toString(sum()); }
public long estimate_sum( ) { // For short tables, just do the work if( _t.length <= 64 ) return sum(); // For bigger tables, periodically freshen a cached value long millis = System.currentTimeMillis(); if( _fuzzy_time != millis ) { // Time marches on? _fuzzy_sum_cache = sum(); // Get sum the hard way _fuzzy_time = millis; // Indicate freshness of cached value } return _fuzzy_sum_cache; // Return cached sum }
public String toString( ) { return Long.toString(sum()); }
/** Same as {@link #get}, included for completeness. */ public long longValue() { return _cat.sum(); }
/** Same as {@link #get}, included for completeness. */ public int intValue() { return (int)_cat.sum(); } /** Same as {@link #get}, included for completeness. */
public long sum( ) { long sum = _next == null ? 0 : _next.sum(); // Recursively get cached sum final long[] t = _t; for( long cnt : t ) sum += cnt; 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(); } /** Same as {@link #get}, included for completeness. */
public long estimate_sum( ) { // For short tables, just do the work if( _t.length <= 64 ) return sum(); // For bigger tables, periodically freshen a cached value long millis = System.currentTimeMillis(); if( _fuzzy_time != millis ) { // Time marches on? _fuzzy_sum_cache = sum(); // 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 int intValue() { return (int)_cat.sum(); } /** Same as {@link #get}, included for completeness. */
/** Same as {@link #get}, included for completeness. */ public long longValue() { return _cat.sum(); }
public long sum( ) { long sum = _next == null ? 0 : _next.sum(); // Recursively get cached sum final long[] t = _t; for( long cnt : t ) sum += cnt; 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(); } /** Same as {@link #get}, included for completeness. */