public <T extends Average> T add(long num) { super.add(num); min=Math.min(min, num); max=Math.max(max, num); return (T)this; }
/** Merges this average with another one */ public <T extends Average> T merge(T other) { if(Util.productGreaterThan(count, (long)Math.ceil(avg), Long.MAX_VALUE) || Util.productGreaterThan(other.count(), (long)Math.ceil(other.average()), Long.MAX_VALUE)) { // the above computation is not correct as the sum of the 2 products can still lead to overflow // a non-weighted avg avg=avg + other.average() / 2.0; } else { // compute the new average weighted by count long total_count=count + other.count(); avg=(count * avg + other.count() * other.average()) / total_count; count=total_count/2; } return (T)this; }
public void resetStats() { num_msgs_sent=num_msgs_received=num_single_msgs_received=num_batches_received=num_bytes_sent=num_bytes_received=0; num_oob_msgs_received=num_incoming_msgs_received=num_internal_msgs_received=num_single_msgs_sent=num_single_msgs_sent_instead_of_batch=num_batches_sent=0; avg_batch_size.clear(); }
public double getAverageBlockTime() {return avg_block_time.getAverage() / 1000000.0;} // in ms
public <T extends Average> T merge(T other) { super.merge(other); if(other instanceof AverageMinMax) { AverageMinMax o=(AverageMinMax)other; this.min=Math.min(min, o.min()); this.max=Math.max(max, o.max()); } return (T)this; }
public void writeTo(DataOutput out) throws Exception { super.writeTo(out); Bits.writeLong(min, out); Bits.writeLong(max, out); }
public void readFrom(DataInput in) throws Exception { super.readFrom(in); min=Bits.readLong(in); max=Bits.readLong(in); }
public void init() throws Exception { super.init(); avg=new Average(); }
public double getAverageBlockTime() {return avg_block_time.getAverage() / 1000000.0;} // in ms
public <T extends Average> T merge(T other) { super.merge(other); if(other instanceof AverageMinMax) { AverageMinMax o=(AverageMinMax)other; this.min=Math.min(min, o.min()); this.max=Math.max(max, o.max()); } return (T)this; }
public void writeTo(DataOutput out) throws Exception { super.writeTo(out); Bits.writeLong(min, out); Bits.writeLong(max, out); }
public void readFrom(DataInput in) throws Exception { super.readFrom(in); min=Bits.readLong(in); max=Bits.readLong(in); }
public void init() throws Exception { super.init(); avg=new Average(); }
public void resetStats() { num_msgs_sent=num_msgs_received=num_single_msgs_received=num_batches_received=num_bytes_sent=num_bytes_received=0; num_oob_msgs_received=num_incoming_msgs_received=num_internal_msgs_received=num_single_msgs_sent=num_single_msgs_sent_instead_of_batch=num_batches_sent=0; avg_batch_size.clear(); }
public <T extends Average> T add(long num) { super.add(num); min=Math.min(min, num); max=Math.max(max, num); return (T)this; }
public double getAverageBlockTime() {return avg_block_time.getAverage() / 1000000.0;} // in ms
/** Merges this average with another one */ public <T extends Average> T merge(T other) { if(Util.productGreaterThan(count, (long)Math.ceil(avg), Long.MAX_VALUE) || Util.productGreaterThan(other.count(), (long)Math.ceil(other.average()), Long.MAX_VALUE)) { // the above computation is not correct as the sum of the 2 products can still lead to overflow // a non-weighted avg avg=avg + other.average() / 2.0; } else { // compute the new average weighted by count long total_count=count + other.count(); avg=(count * avg + other.count() * other.average()) / total_count; count=total_count/2; } return (T)this; }
public <T extends Average> T merge(T other) { super.merge(other); if(other instanceof AverageMinMax) { AverageMinMax o=(AverageMinMax)other; this.min=Math.min(min, o.min()); this.max=Math.max(max, o.max()); } return (T)this; }
public void writeTo(DataOutput out) throws Exception { super.writeTo(out); Bits.writeLong(min, out); Bits.writeLong(max, out); }
public void readFrom(DataInput in) throws Exception { super.readFrom(in); min=Bits.readLong(in); max=Bits.readLong(in); }