# HG changeset patch # User Tom Rodriguez # Date 1437755349 25200 # Node ID 143099e04cfa8813c2f61a859197097dff2d9605 # Parent 681c04ce9db2f0fb4521829d2bbeb6c9b5e5a09f Move Management back into graal.debug diff -r 681c04ce9db2 -r 143099e04cfa graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugTimerTest.java --- 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.*; diff -r 681c04ce9db2 -r 143099e04cfa graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Management.java --- /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; + } + } +} diff -r 681c04ce9db2 -r 143099e04cfa graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MemUseTrackerImpl.java --- 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 { diff -r 681c04ce9db2 -r 143099e04cfa graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java --- 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 { diff -r 681c04ce9db2 -r 143099e04cfa graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java --- 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") diff -r 681c04ce9db2 -r 143099e04cfa jvmci/jdk.internal.jvmci.debug/src/jdk/internal/jvmci/debug/Management.java --- 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; - } - } -}