git commit: SPARK-1829 Sub-second durations shouldn't round to 0 s

2014-05-15 Thread rxin
Repository: spark
Updated Branches:
  refs/heads/master fde82c154 - a3315d7f4


SPARK-1829 Sub-second durations shouldn't round to 0 s

As 99 ms up to 99 ms
As 0.1 s from 0.1 s up to 0.9 s

https://issues.apache.org/jira/browse/SPARK-1829

Compare the first image to the second here: http://imgur.com/RaLEsSZ,7VTlgfo#0

Author: Andrew Ash and...@andrewash.com

Closes #768 from ash211/spark-1829 and squashes the following commits:

1c15b8e [Andrew Ash] SPARK-1829 Format sub-second durations more appropriately


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

Branch: refs/heads/master
Commit: a3315d7f4c7584dae2ee0aa33c6ec9e97b229b48
Parents: fde82c1
Author: Andrew Ash and...@andrewash.com
Authored: Wed May 14 12:01:14 2014 -0700
Committer: Reynold Xin r...@apache.org
Committed: Wed May 14 12:01:14 2014 -0700

--
 core/src/main/scala/org/apache/spark/ui/UIUtils.scala | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/a3315d7f/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
--
diff --git a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala 
b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
index a3d6a18..a43314f 100644
--- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
@@ -36,7 +36,13 @@ private[spark] object UIUtils extends Logging {
   def formatDate(timestamp: Long): String = dateFormat.get.format(new 
Date(timestamp))
 
   def formatDuration(milliseconds: Long): String = {
+if (milliseconds  100) {
+  return %d ms.format(milliseconds)
+}
 val seconds = milliseconds.toDouble / 1000
+if (seconds  1) {
+  return %.1f s.format(seconds)
+}
 if (seconds  60) {
   return %.0f s.format(seconds)
 }



git commit: SPARK-1829 Sub-second durations shouldn't round to 0 s

2014-05-14 Thread rxin
Repository: spark
Updated Branches:
  refs/heads/branch-1.0 379f733e9 - 530bdf7d4


SPARK-1829 Sub-second durations shouldn't round to 0 s

As 99 ms up to 99 ms
As 0.1 s from 0.1 s up to 0.9 s

https://issues.apache.org/jira/browse/SPARK-1829

Compare the first image to the second here: http://imgur.com/RaLEsSZ,7VTlgfo#0

Author: Andrew Ash and...@andrewash.com

Closes #768 from ash211/spark-1829 and squashes the following commits:

1c15b8e [Andrew Ash] SPARK-1829 Format sub-second durations more appropriately

(cherry picked from commit a3315d7f4c7584dae2ee0aa33c6ec9e97b229b48)
Signed-off-by: Reynold Xin r...@apache.org


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

Branch: refs/heads/branch-1.0
Commit: 530bdf7d4bde2e90e1523e65b089559a2eddd793
Parents: 379f733
Author: Andrew Ash and...@andrewash.com
Authored: Wed May 14 12:01:14 2014 -0700
Committer: Reynold Xin r...@apache.org
Committed: Wed May 14 12:01:22 2014 -0700

--
 core/src/main/scala/org/apache/spark/ui/UIUtils.scala | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/spark/blob/530bdf7d/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
--
diff --git a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala 
b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
index a3d6a18..a43314f 100644
--- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
@@ -36,7 +36,13 @@ private[spark] object UIUtils extends Logging {
   def formatDate(timestamp: Long): String = dateFormat.get.format(new 
Date(timestamp))
 
   def formatDuration(milliseconds: Long): String = {
+if (milliseconds  100) {
+  return %d ms.format(milliseconds)
+}
 val seconds = milliseconds.toDouble / 1000
+if (seconds  1) {
+  return %.1f s.format(seconds)
+}
 if (seconds  60) {
   return %.0f s.format(seconds)
 }