aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAndrew Ash <andrew@andrewash.com>2014-05-14 12:01:14 -0700
committerReynold Xin <rxin@apache.org>2014-05-14 12:01:14 -0700
commita3315d7f4c7584dae2ee0aa33c6ec9e97b229b48 (patch)
treefa52ad07e1f68bff58bc381bbb9ef2ce019a56be /core
parentfde82c1549c78f1eebbb21ec34e60befbbff65f5 (diff)
downloadspark-a3315d7f4c7584dae2ee0aa33c6ec9e97b229b48.tar.gz
spark-a3315d7f4c7584dae2ee0aa33c6ec9e97b229b48.tar.bz2
spark-a3315d7f4c7584dae2ee0aa33c6ec9e97b229b48.zip
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 <andrew@andrewash.com> Closes #768 from ash211/spark-1829 and squashes the following commits: 1c15b8e [Andrew Ash] SPARK-1829 Format sub-second durations more appropriately
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/ui/UIUtils.scala6
1 files changed, 6 insertions, 0 deletions
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 a3d6a18212..a43314f481 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)
}