changeset 22366:143099e04cfa

Move Management back into graal.debug
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Fri, 24 Jul 2015 09:29:09 -0700
parents 681c04ce9db2
children 7d48038267b4
files graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugTimerTest.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Management.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MemUseTrackerImpl.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java jvmci/jdk.internal.jvmci.debug/src/jdk/internal/jvmci/debug/Management.java
diffstat 6 files changed, 196 insertions(+), 201 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugTimerTest.java	Fri Jul 24 16:20:56 2015 +0200
+++ b/graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugTimerTest.java	Fri Jul 24 09:29:09 2015 -0700
@@ -26,8 +26,6 @@
 
 import java.lang.management.*;
 
-import jdk.internal.jvmci.debug.*;
-
 import com.oracle.graal.debug.*;
 
 import org.junit.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Management.java	Fri Jul 24 09:29:09 2015 -0700
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.debug;
+
+import static java.lang.Thread.*;
+
+import java.lang.management.*;
+
+import javax.management.*;
+
+public class Management {
+
+    private static final com.sun.management.ThreadMXBean threadMXBean = Management.initThreadMXBean();
+
+    /**
+     * The amount of memory allocated by
+     * {@link com.sun.management.ThreadMXBean#getThreadAllocatedBytes(long)} itself.
+     */
+    private static final long threadMXBeanOverhead = -getCurrentThreadAllocatedBytes() + getCurrentThreadAllocatedBytes();
+
+    public static long getCurrentThreadAllocatedBytes() {
+        return threadMXBean.getThreadAllocatedBytes(currentThread().getId()) - threadMXBeanOverhead;
+    }
+
+    private static com.sun.management.ThreadMXBean initThreadMXBean() {
+        try {
+            return (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean();
+        } catch (Error err) {
+            return new UnimplementedBean();
+        }
+    }
+
+    public static ThreadMXBean getThreadMXBean() {
+        return threadMXBean;
+    }
+
+    private static class UnimplementedBean implements ThreadMXBean, com.sun.management.ThreadMXBean {
+
+        public ObjectName getObjectName() {
+            return null;
+        }
+
+        public long getThreadAllocatedBytes(long arg0) {
+            return 0;
+        }
+
+        public long[] getThreadAllocatedBytes(long[] arg0) {
+            return null;
+        }
+
+        public long[] getThreadCpuTime(long[] arg0) {
+            return null;
+        }
+
+        public long[] getThreadUserTime(long[] arg0) {
+            return null;
+        }
+
+        public boolean isThreadAllocatedMemoryEnabled() {
+            return false;
+        }
+
+        public boolean isThreadAllocatedMemorySupported() {
+            return false;
+        }
+
+        public void setThreadAllocatedMemoryEnabled(boolean arg0) {
+        }
+
+        public int getThreadCount() {
+            return 0;
+        }
+
+        public int getPeakThreadCount() {
+            return 0;
+        }
+
+        public long getTotalStartedThreadCount() {
+            return 0;
+        }
+
+        public int getDaemonThreadCount() {
+            return 0;
+        }
+
+        public long[] getAllThreadIds() {
+            return null;
+        }
+
+        public ThreadInfo getThreadInfo(long id) {
+            return null;
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids) {
+            return null;
+        }
+
+        public ThreadInfo getThreadInfo(long id, int maxDepth) {
+            return null;
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
+            return null;
+        }
+
+        public boolean isThreadContentionMonitoringSupported() {
+            return false;
+        }
+
+        public boolean isThreadContentionMonitoringEnabled() {
+            return false;
+        }
+
+        public void setThreadContentionMonitoringEnabled(boolean enable) {
+        }
+
+        public long getCurrentThreadCpuTime() {
+            return 0;
+        }
+
+        public long getCurrentThreadUserTime() {
+            return 0;
+        }
+
+        public long getThreadCpuTime(long id) {
+            return 0;
+        }
+
+        public long getThreadUserTime(long id) {
+            return 0;
+        }
+
+        public boolean isThreadCpuTimeSupported() {
+            return false;
+        }
+
+        public boolean isCurrentThreadCpuTimeSupported() {
+            return false;
+        }
+
+        public boolean isThreadCpuTimeEnabled() {
+            return false;
+        }
+
+        public void setThreadCpuTimeEnabled(boolean enable) {
+        }
+
+        public long[] findMonitorDeadlockedThreads() {
+            return null;
+        }
+
+        public void resetPeakThreadCount() {
+        }
+
+        public long[] findDeadlockedThreads() {
+            return null;
+        }
+
+        public boolean isObjectMonitorUsageSupported() {
+            return false;
+        }
+
+        public boolean isSynchronizerUsageSupported() {
+            return false;
+        }
+
+        public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers) {
+            return null;
+        }
+
+        public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers) {
+            return null;
+        }
+    }
+}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MemUseTrackerImpl.java	Fri Jul 24 16:20:56 2015 +0200
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MemUseTrackerImpl.java	Fri Jul 24 09:29:09 2015 -0700
@@ -23,8 +23,6 @@
 package com.oracle.graal.debug.internal;
 
 import static com.oracle.graal.debug.DebugCloseable.*;
-import jdk.internal.jvmci.debug.*;
-
 import com.oracle.graal.debug.*;
 
 public final class MemUseTrackerImpl extends AccumulatedDebugValue implements DebugMemUseTracker {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Fri Jul 24 16:20:56 2015 +0200
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Fri Jul 24 09:29:09 2015 -0700
@@ -27,8 +27,6 @@
 import java.lang.management.*;
 import java.util.concurrent.*;
 
-import jdk.internal.jvmci.debug.*;
-
 import com.oracle.graal.debug.*;
 
 public final class TimerImpl extends AccumulatedDebugValue implements DebugTimer {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Fri Jul 24 16:20:56 2015 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Fri Jul 24 09:29:09 2015 -0700
@@ -33,6 +33,7 @@
 import jdk.internal.jvmci.debug.*;
 import jdk.internal.jvmci.hotspot.*;
 
+import com.oracle.graal.debug.*;
 import com.sun.management.*;
 
 @SuppressWarnings("unused")
--- a/jvmci/jdk.internal.jvmci.debug/src/jdk/internal/jvmci/debug/Management.java	Fri Jul 24 16:20:56 2015 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.internal.jvmci.debug;
-
-import static java.lang.Thread.*;
-
-import java.lang.management.*;
-
-import javax.management.*;
-
-public class Management {
-
-    private static final com.sun.management.ThreadMXBean threadMXBean = Management.initThreadMXBean();
-
-    /**
-     * The amount of memory allocated by
-     * {@link com.sun.management.ThreadMXBean#getThreadAllocatedBytes(long)} itself.
-     */
-    private static final long threadMXBeanOverhead = -getCurrentThreadAllocatedBytes() + getCurrentThreadAllocatedBytes();
-
-    public static long getCurrentThreadAllocatedBytes() {
-        return threadMXBean.getThreadAllocatedBytes(currentThread().getId()) - threadMXBeanOverhead;
-    }
-
-    private static com.sun.management.ThreadMXBean initThreadMXBean() {
-        try {
-            return (com.sun.management.ThreadMXBean) ManagementFactory.getThreadMXBean();
-        } catch (Error err) {
-            return new UnimplementedBean();
-        }
-    }
-
-    public static ThreadMXBean getThreadMXBean() {
-        return threadMXBean;
-    }
-
-    private static class UnimplementedBean implements ThreadMXBean, com.sun.management.ThreadMXBean {
-
-        public ObjectName getObjectName() {
-            return null;
-        }
-
-        public long getThreadAllocatedBytes(long arg0) {
-            return 0;
-        }
-
-        public long[] getThreadAllocatedBytes(long[] arg0) {
-            return null;
-        }
-
-        public long[] getThreadCpuTime(long[] arg0) {
-            return null;
-        }
-
-        public long[] getThreadUserTime(long[] arg0) {
-            return null;
-        }
-
-        public boolean isThreadAllocatedMemoryEnabled() {
-            return false;
-        }
-
-        public boolean isThreadAllocatedMemorySupported() {
-            return false;
-        }
-
-        public void setThreadAllocatedMemoryEnabled(boolean arg0) {
-        }
-
-        public int getThreadCount() {
-            return 0;
-        }
-
-        public int getPeakThreadCount() {
-            return 0;
-        }
-
-        public long getTotalStartedThreadCount() {
-            return 0;
-        }
-
-        public int getDaemonThreadCount() {
-            return 0;
-        }
-
-        public long[] getAllThreadIds() {
-            return null;
-        }
-
-        public ThreadInfo getThreadInfo(long id) {
-            return null;
-        }
-
-        public ThreadInfo[] getThreadInfo(long[] ids) {
-            return null;
-        }
-
-        public ThreadInfo getThreadInfo(long id, int maxDepth) {
-            return null;
-        }
-
-        public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
-            return null;
-        }
-
-        public boolean isThreadContentionMonitoringSupported() {
-            return false;
-        }
-
-        public boolean isThreadContentionMonitoringEnabled() {
-            return false;
-        }
-
-        public void setThreadContentionMonitoringEnabled(boolean enable) {
-        }
-
-        public long getCurrentThreadCpuTime() {
-            return 0;
-        }
-
-        public long getCurrentThreadUserTime() {
-            return 0;
-        }
-
-        public long getThreadCpuTime(long id) {
-            return 0;
-        }
-
-        public long getThreadUserTime(long id) {
-            return 0;
-        }
-
-        public boolean isThreadCpuTimeSupported() {
-            return false;
-        }
-
-        public boolean isCurrentThreadCpuTimeSupported() {
-            return false;
-        }
-
-        public boolean isThreadCpuTimeEnabled() {
-            return false;
-        }
-
-        public void setThreadCpuTimeEnabled(boolean enable) {
-        }
-
-        public long[] findMonitorDeadlockedThreads() {
-            return null;
-        }
-
-        public void resetPeakThreadCount() {
-        }
-
-        public long[] findDeadlockedThreads() {
-            return null;
-        }
-
-        public boolean isObjectMonitorUsageSupported() {
-            return false;
-        }
-
-        public boolean isSynchronizerUsageSupported() {
-            return false;
-        }
-
-        public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors, boolean lockedSynchronizers) {
-            return null;
-        }
-
-        public ThreadInfo[] dumpAllThreads(boolean lockedMonitors, boolean lockedSynchronizers) {
-            return null;
-        }
-    }
-}