HBASE-15222 Addendum - Use less contended classes for metrics
This commit is contained in:
parent
43f99def67
commit
77133fd225
|
@ -310,12 +310,8 @@ public class FastLongHistogram {
|
||||||
* Resets the histogram for new counting.
|
* Resets the histogram for new counting.
|
||||||
*/
|
*/
|
||||||
public FastLongHistogram reset() {
|
public FastLongHistogram reset() {
|
||||||
if (this.bins.hasData.get()) {
|
Bins oldBins = this.bins;
|
||||||
Bins oldBins = this.bins;
|
this.bins = new Bins(this.bins, this.bins.counts.length - 3, 0.01, 0.99);
|
||||||
this.bins = new Bins(this.bins, this.bins.counts.length - 3, 0.01, 0.99);
|
return new FastLongHistogram(oldBins);
|
||||||
return new FastLongHistogram(oldBins);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,9 @@ public class MutableHistogram extends MutableMetric implements MetricHistogram {
|
||||||
public synchronized void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all) {
|
public synchronized void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all) {
|
||||||
// Get a reference to the old histogram.
|
// Get a reference to the old histogram.
|
||||||
FastLongHistogram histo = histogram.reset();
|
FastLongHistogram histo = histogram.reset();
|
||||||
updateSnapshotMetrics(metricsRecordBuilder, histo);
|
if (histo != null) {
|
||||||
|
updateSnapshotMetrics(metricsRecordBuilder, histo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateSnapshotMetrics(MetricsRecordBuilder metricsRecordBuilder,
|
protected void updateSnapshotMetrics(MetricsRecordBuilder metricsRecordBuilder,
|
||||||
|
|
|
@ -56,8 +56,10 @@ public abstract class MutableRangeHistogram extends MutableHistogram implements
|
||||||
public synchronized void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all) {
|
public synchronized void snapshot(MetricsRecordBuilder metricsRecordBuilder, boolean all) {
|
||||||
// Get a reference to the old histogram.
|
// Get a reference to the old histogram.
|
||||||
FastLongHistogram histo = histogram.reset();
|
FastLongHistogram histo = histogram.reset();
|
||||||
updateSnapshotMetrics(metricsRecordBuilder, histo);
|
if (histo != null) {
|
||||||
updateSnapshotRangeMetrics(metricsRecordBuilder, histo);
|
updateSnapshotMetrics(metricsRecordBuilder, histo);
|
||||||
|
updateSnapshotRangeMetrics(metricsRecordBuilder, histo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSnapshotRangeMetrics(MetricsRecordBuilder metricsRecordBuilder,
|
public void updateSnapshotRangeMetrics(MetricsRecordBuilder metricsRecordBuilder,
|
||||||
|
|
Loading…
Reference in New Issue