HADOOP-11447. Add a more meaningful toString method to SampleStat and MutableStat. (kasha)

This commit is contained in:
Karthik Kambatla 2015-03-20 17:03:03 -07:00
parent 586348e4cb
commit fe5c23b670
3 changed files with 20 additions and 0 deletions

View File

@ -455,6 +455,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-11709. Time.NANOSECONDS_PER_MILLISECOND - use class-level final
constant instead of method variable (Ajith S via ozawa)
HADOOP-11447. Add a more meaningful toString method to SampleStat and
MutableStat. (kasha)
OPTIMIZATIONS
BUG FIXES

View File

@ -151,4 +151,8 @@ public void resetMinMax() {
minMax.reset();
}
@Override
public String toString() {
return lastStat().toString();
}
}

View File

@ -137,6 +137,19 @@ public double max() {
return minmax.max();
}
@Override
public String toString() {
try {
return "Samples = " + numSamples() +
" Min = " + min() +
" Mean = " + mean() +
" Std Dev = " + stddev() +
" Max = " + max();
} catch (Throwable t) {
return super.toString();
}
}
/**
* Helper to keep running min/max
*/