Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/22218#discussion_r214415816
--- Diff:
core/src/main/scala/org/apache/spark/executor/ExecutorSource.scala ---
@@ -73,6 +75,31 @@ class ExecutorSource(threadPool: ThreadPoolExecutor,
executorId: String) extends
registerFileSystemStat(scheme, "write_ops", _.getWriteOps(), 0)
}
+ // will try to get JVM Process CPU time or return -1 otherwise
+ // will use proprietary extensions as
com.sun.management.OperatingSystemMXBean or
+ // com.ibm.lang.management.OperatingSystemMXBean if available
+ def tryToGetJVMProcessPCUTime() : Long = {
+ val mBean: MBeanServer = ManagementFactory.getPlatformMBeanServer
+ try {
+ val name = new ObjectName("java.lang", "type", "OperatingSystem")
+ val attribute = mBean.getAttribute(name, "ProcessCpuTime")
+ if (attribute != null) {
+ attribute.asInstanceOf[Long]
+ }
+ else {
--- End diff --
Nit: pull onto previous line
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]