From 273a4ed8cc1ddf06f6c594b8cf5751e6beebff6c Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Tue, 22 Mar 2016 13:40:53 -0400 Subject: [PATCH 1/5] show JVM version information --- .../main/scala/org/apache/spark/util/Benchmark.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/src/main/scala/org/apache/spark/util/Benchmark.scala b/core/src/main/scala/org/apache/spark/util/Benchmark.scala index b562b58f1b6bf..b30e23dd89925 100644 --- a/core/src/main/scala/org/apache/spark/util/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/util/Benchmark.scala @@ -65,6 +65,7 @@ private[spark] class Benchmark( val firstBest = results.head.bestMs // The results are going to be processor specific so it is useful to include that. println(Benchmark.getProcessorName()) + println(Benchmark.getJVMInfo()) printf("%-35s %16s %12s %13s %10s\n", name + ":", "Best/Avg Time(ms)", "Rate(M/s)", "Per Row(ns)", "Relative") println("-----------------------------------------------------------------------------------" + @@ -103,6 +104,16 @@ private[spark] object Benchmark { } } + /** + * This should return a user helpful JVM information. + * This should return something like "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" + */ + def getJVMInfo(): String = { + val vmName = System.getProperty("java.vm.name") + val runtimeVersion = System.getProperty("java.runtime.version") + s"JVM information : ${vmName}, ${runtimeVersion}" + } + /** * Runs a single function `f` for iters, returning the average time the function took and * the rate of the function. From c7bd8b91c8c15531c3c4c33ac2aaad443f713df6 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Tue, 22 Mar 2016 15:50:03 -0400 Subject: [PATCH 2/5] add OS version --- .../scala/org/apache/spark/util/Benchmark.scala | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/util/Benchmark.scala b/core/src/main/scala/org/apache/spark/util/Benchmark.scala index b30e23dd89925..3ff47ea2afdb1 100644 --- a/core/src/main/scala/org/apache/spark/util/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/util/Benchmark.scala @@ -65,7 +65,7 @@ private[spark] class Benchmark( val firstBest = results.head.bestMs // The results are going to be processor specific so it is useful to include that. println(Benchmark.getProcessorName()) - println(Benchmark.getJVMInfo()) + println(Benchmark.getJVMOSInfo()) printf("%-35s %16s %12s %13s %10s\n", name + ":", "Best/Avg Time(ms)", "Rate(M/s)", "Per Row(ns)", "Relative") println("-----------------------------------------------------------------------------------" + @@ -92,26 +92,31 @@ private[spark] object Benchmark { * This should return something like "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" */ def getProcessorName(): String = { - if (SystemUtils.IS_OS_MAC_OSX) { + val cpu = if (SystemUtils.IS_OS_MAC_OSX) { Utils.executeAndGetOutput(Seq("/usr/sbin/sysctl", "-n", "machdep.cpu.brand_string")) } else if (SystemUtils.IS_OS_LINUX) { Try { val grepPath = Utils.executeAndGetOutput(Seq("which", "grep")) Utils.executeAndGetOutput(Seq(grepPath, "-m", "1", "model name", "/proc/cpuinfo")) + .replaceFirst("model name[\\s*]:", "") }.getOrElse("Unknown processor") } else { System.getenv("PROCESSOR_IDENTIFIER") } + s"CPU :${cpu}" } /** - * This should return a user helpful JVM information. - * This should return something like "Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz" + * This should return a user helpful JVM & OS information. + * This should return something like + * "OpenJDK 64-Bit Server VM 1.8.0_65-b17, Linux 4.1.13-100.fc21.x86_64" */ - def getJVMInfo(): String = { + def getJVMOSInfo(): String = { val vmName = System.getProperty("java.vm.name") val runtimeVersion = System.getProperty("java.runtime.version") - s"JVM information : ${vmName}, ${runtimeVersion}" + val osName = System.getProperty("os.name") + val osVersion = System.getProperty("os.version") + s"JVM,OS: ${vmName} ${runtimeVersion}, ${osName} ${osVersion}" } /** From 4ed814cdc260bc71b5b1f337fd36f38fe47ff9ba Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Tue, 22 Mar 2016 21:03:00 -0400 Subject: [PATCH 3/5] simplify format --- .../main/scala/org/apache/spark/util/Benchmark.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/util/Benchmark.scala b/core/src/main/scala/org/apache/spark/util/Benchmark.scala index 3ff47ea2afdb1..800aa279ddb63 100644 --- a/core/src/main/scala/org/apache/spark/util/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/util/Benchmark.scala @@ -64,8 +64,8 @@ private[spark] class Benchmark( val firstBest = results.head.bestMs // The results are going to be processor specific so it is useful to include that. - println(Benchmark.getProcessorName()) println(Benchmark.getJVMOSInfo()) + println(Benchmark.getProcessorName()) printf("%-35s %16s %12s %13s %10s\n", name + ":", "Best/Avg Time(ms)", "Rate(M/s)", "Per Row(ns)", "Relative") println("-----------------------------------------------------------------------------------" + @@ -98,25 +98,25 @@ private[spark] object Benchmark { Try { val grepPath = Utils.executeAndGetOutput(Seq("which", "grep")) Utils.executeAndGetOutput(Seq(grepPath, "-m", "1", "model name", "/proc/cpuinfo")) - .replaceFirst("model name[\\s*]:", "") + .replaceFirst("model name[\\s*]:[\\s*]", "") }.getOrElse("Unknown processor") } else { System.getenv("PROCESSOR_IDENTIFIER") } - s"CPU :${cpu}" + s"${cpu}" } /** * This should return a user helpful JVM & OS information. * This should return something like - * "OpenJDK 64-Bit Server VM 1.8.0_65-b17, Linux 4.1.13-100.fc21.x86_64" + * "OpenJDK 64-Bit Server VM 1.8.0_65-b17 on Linux 4.1.13-100.fc21.x86_64" */ def getJVMOSInfo(): String = { val vmName = System.getProperty("java.vm.name") val runtimeVersion = System.getProperty("java.runtime.version") val osName = System.getProperty("os.name") val osVersion = System.getProperty("os.version") - s"JVM,OS: ${vmName} ${runtimeVersion}, ${osName} ${osVersion}" + s"${vmName} ${runtimeVersion} on ${osName} ${osVersion}" } /** From 29e9a5e3ac1bb670ceedec70adefb05ecb6610ed Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Tue, 22 Mar 2016 21:13:45 -0400 Subject: [PATCH 4/5] fix scala style error --- core/src/main/scala/org/apache/spark/util/Benchmark.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/util/Benchmark.scala b/core/src/main/scala/org/apache/spark/util/Benchmark.scala index 800aa279ddb63..eefff5ee148a4 100644 --- a/core/src/main/scala/org/apache/spark/util/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/util/Benchmark.scala @@ -108,7 +108,7 @@ private[spark] object Benchmark { /** * This should return a user helpful JVM & OS information. - * This should return something like + * This should return something like * "OpenJDK 64-Bit Server VM 1.8.0_65-b17 on Linux 4.1.13-100.fc21.x86_64" */ def getJVMOSInfo(): String = { From d89c824d038473a6704c42f9977f5d6e0d321030 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Tue, 22 Mar 2016 21:17:14 -0400 Subject: [PATCH 5/5] make return value simple --- core/src/main/scala/org/apache/spark/util/Benchmark.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/util/Benchmark.scala b/core/src/main/scala/org/apache/spark/util/Benchmark.scala index eefff5ee148a4..9e40bafd521d7 100644 --- a/core/src/main/scala/org/apache/spark/util/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/util/Benchmark.scala @@ -103,7 +103,7 @@ private[spark] object Benchmark { } else { System.getenv("PROCESSOR_IDENTIFIER") } - s"${cpu}" + cpu } /**