aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/main
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2015-07-16 23:02:06 -0700
committerXiangrui Meng <meng@databricks.com>2015-07-16 23:02:06 -0700
commit358e7bf652d6fedd9377593025cd661c142efeca (patch)
treed2bcfc2688e41e5189ec1e8736b6d23378703c9a /mllib/src/main
parent322d286bb7773389ed07df96290e427b21c775bd (diff)
downloadspark-358e7bf652d6fedd9377593025cd661c142efeca.tar.gz
spark-358e7bf652d6fedd9377593025cd661c142efeca.tar.bz2
spark-358e7bf652d6fedd9377593025cd661c142efeca.zip
[SPARK-9126] [MLLIB] do not assert on time taken by Thread.sleep()
Measure lower and upper bounds for task time and use them for validation. This PR also implements `Stopwatch.toString`. This suite should finish in less than 1 second. jkbradley pwendell Author: Xiangrui Meng <meng@databricks.com> Closes #7457 from mengxr/SPARK-9126 and squashes the following commits: 4b40faa [Xiangrui Meng] simplify tests 739f5bd [Xiangrui Meng] do not assert on time taken by Thread.sleep()
Diffstat (limited to 'mllib/src/main')
-rw-r--r--mllib/src/main/scala/org/apache/spark/ml/util/stopwatches.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/util/stopwatches.scala b/mllib/src/main/scala/org/apache/spark/ml/util/stopwatches.scala
index 5fdf878a3d..8d4174124b 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/util/stopwatches.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/util/stopwatches.scala
@@ -67,6 +67,8 @@ private[spark] abstract class Stopwatch extends Serializable {
*/
def elapsed(): Long
+ override def toString: String = s"$name: ${elapsed()}ms"
+
/**
* Gets the current time in milliseconds.
*/
@@ -145,7 +147,7 @@ private[spark] class MultiStopwatch(@transient private val sc: SparkContext) ext
override def toString: String = {
stopwatches.values.toArray.sortBy(_.name)
- .map(c => s" ${c.name}: ${c.elapsed()}ms")
+ .map(c => s" $c")
.mkString("{\n", ",\n", "\n}")
}
}