hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject [08/50] [abbrv] hadoop git commit: HADOOP-11447. Add a more meaningful toString method to SampleStat and MutableStat. (kasha)
Date Mon, 23 Mar 2015 20:14:41 GMT
HADOOP-11447. Add a more meaningful toString method to SampleStat and MutableStat. (kasha)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fe5c23b6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fe5c23b6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fe5c23b6

Branch: refs/heads/HDFS-7285
Commit: fe5c23b670c773145b87fecfaf9191536e9f1c51
Parents: 586348e
Author: Karthik Kambatla <kasha@apache.org>
Authored: Fri Mar 20 17:03:03 2015 -0700
Committer: Karthik Kambatla <kasha@apache.org>
Committed: Fri Mar 20 17:03:03 2015 -0700

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt        |  3 +++
 .../org/apache/hadoop/metrics2/lib/MutableStat.java    |  4 ++++
 .../org/apache/hadoop/metrics2/util/SampleStat.java    | 13 +++++++++++++
 3 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fe5c23b6/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 823a36b..4cd2154 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fe5c23b6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java
index ba37757..d794e8e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableStat.java
@@ -151,4 +151,8 @@ public class MutableStat extends MutableMetric {
     minMax.reset();
   }
 
+  @Override
+  public String toString() {
+    return lastStat().toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/fe5c23b6/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/SampleStat.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/SampleStat.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/SampleStat.java
index 589062a..cd9aaa4 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/SampleStat.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/SampleStat.java
@@ -137,6 +137,19 @@ public class SampleStat {
     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
    */


Mime
View raw message