From cba080a155a4defada4f4009786e3ec3b34e9836 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Tue, 5 Dec 2023 18:09:17 +0800 Subject: [PATCH] comment --- .../spark/kyuubi/benchmark/Benchmark.scala | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/kyuubi/benchmark/Benchmark.scala b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/kyuubi/benchmark/Benchmark.scala index 62c1eb09e21..040d8ef99fd 100644 --- a/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/kyuubi/benchmark/Benchmark.scala +++ b/externals/kyuubi-spark-sql-engine/src/test/scala/org/apache/spark/kyuubi/benchmark/Benchmark.scala @@ -27,6 +27,28 @@ import scala.util.Try import org.apache.commons.io.output.TeeOutputStream import org.apache.commons.lang3.SystemUtils import org.apache.spark.util.Utils + +/** + * Copied from Apache Spark + * [[org.apache.spark.benchmark.Benchmark]] of the spark-core module + * + * Utility class to benchmark components. An example of how to use this is: + * val benchmark = new Benchmark("My Benchmark", valuesPerIteration) + * benchmark.addCase("V1")() + * benchmark.addCase("V2")() + * benchmark.run + * This will output the average time to run each function and the rate of each function. + * + * The benchmark function takes one argument that is the iteration that's being run. + * + * @param name name of this benchmark. + * @param valuesPerIteration number of values used in the test case, used to compute rows/s. + * @param minNumIters the min number of iterations that will be run per case, not counting warm-up. + * @param warmupTime amount of time to spend running dummy case iterations for JIT warm-up. + * @param minTime further iterations will be run for each case until this time is used up. + * @param outputPerIteration if true, the timing for each run will be printed to stdout. + * @param output optional output stream to write benchmark results to + */ class Benchmark( name: String, valuesPerIteration: Long,