< prev index next >

src/jdk.management/share/classes/com/sun/management/ThreadMXBean.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 2013, 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. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2011, 2019, 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. Oracle designates this
*** 59,69 **** * {@code -1} otherwise. * * @throws NullPointerException if {@code ids} is {@code null} * @throws IllegalArgumentException if any element in the input array * {@code ids} is {@code <=} {@code 0}. ! * @throws java.lang.UnsupportedOperationException if the Java * virtual machine implementation does not support CPU time * measurement. * * @see ThreadMXBean#getThreadCpuTime(long) * @see #getThreadUserTime --- 59,69 ---- * {@code -1} otherwise. * * @throws NullPointerException if {@code ids} is {@code null} * @throws IllegalArgumentException if any element in the input array * {@code ids} is {@code <=} {@code 0}. ! * @throws UnsupportedOperationException if the Java * virtual machine implementation does not support CPU time * measurement. * * @see ThreadMXBean#getThreadCpuTime(long) * @see #getThreadUserTime
*** 93,103 **** * {@code -1} otherwise. * * @throws NullPointerException if {@code ids} is {@code null} * @throws IllegalArgumentException if any element in the input array * {@code ids} is {@code <=} {@code 0}. ! * @throws java.lang.UnsupportedOperationException if the Java * virtual machine implementation does not support CPU time * measurement. * * @see ThreadMXBean#getThreadUserTime(long) * @see #getThreadCpuTime --- 93,103 ---- * {@code -1} otherwise. * * @throws NullPointerException if {@code ids} is {@code null} * @throws IllegalArgumentException if any element in the input array * {@code ids} is {@code <=} {@code 0}. ! * @throws UnsupportedOperationException if the Java * virtual machine implementation does not support CPU time * measurement. * * @see ThreadMXBean#getThreadUserTime(long) * @see #getThreadCpuTime
*** 107,123 **** */ public long[] getThreadUserTime(long[] ids); /** * Returns an approximation of the total amount of memory, in bytes, ! * allocated in heap memory for the thread of the specified ID. * The returned value is an approximation because some Java virtual machine * implementations may use object allocation mechanisms that result in a * delay between the time an object is allocated and the time its size is * recorded. * <p> ! * If the thread of the specified ID is not alive or does not exist, * this method returns {@code -1}. If thread memory allocation measurement * is disabled, this method returns {@code -1}. * A thread is alive if it has been started and has not yet died. * <p> * If thread memory allocation measurement is enabled after the thread has --- 107,154 ---- */ public long[] getThreadUserTime(long[] ids); /** * Returns an approximation of the total amount of memory, in bytes, ! * allocated in heap memory for the current thread. ! * The returned value is an approximation because some Java virtual machine ! * implementations may use object allocation mechanisms that result in a ! * delay between the time an object is allocated and the time its size is ! * recorded. ! * ! * <p> ! * This is a convenience method for local management use and is ! * equivalent to calling: ! * <blockquote><pre> ! * {@link #getThreadAllocatedBytes getThreadAllocatedBytes}(Thread.currentThread().getId()); ! * </pre></blockquote> ! * ! * @return an approximation of the total memory allocated, in bytes, in ! * heap memory for the current thread ! * if thread memory allocation measurement is enabled; ! * {@code -1} otherwise. ! * ! * @throws UnsupportedOperationException if the Java virtual ! * machine implementation does not support thread memory allocation ! * measurement. ! * ! * @see #isThreadAllocatedMemorySupported ! * @see #isThreadAllocatedMemoryEnabled ! * @see #setThreadAllocatedMemoryEnabled ! * @since 14 ! */ ! public long getCurrentThreadAllocatedBytes(); ! ! /** ! * Returns an approximation of the total amount of memory, in bytes, ! * allocated in heap memory for the thread with the specified ID. * The returned value is an approximation because some Java virtual machine * implementations may use object allocation mechanisms that result in a * delay between the time an object is allocated and the time its size is * recorded. * <p> ! * If the thread with the specified ID is not alive or does not exist, * this method returns {@code -1}. If thread memory allocation measurement * is disabled, this method returns {@code -1}. * A thread is alive if it has been started and has not yet died. * <p> * If thread memory allocation measurement is enabled after the thread has
*** 125,141 **** * to and including the time that the capability is enabled as the point * where thread memory allocation measurement starts. * * @param id the thread ID of a thread * @return an approximation of the total memory allocated, in bytes, in ! * heap memory for a thread of the specified ID ! * if the thread of the specified ID exists, the thread is alive, * and thread memory allocation measurement is enabled; * {@code -1} otherwise. * * @throws IllegalArgumentException if {@code id} {@code <=} {@code 0}. ! * @throws java.lang.UnsupportedOperationException if the Java virtual * machine implementation does not support thread memory allocation * measurement. * * @see #isThreadAllocatedMemorySupported * @see #isThreadAllocatedMemoryEnabled --- 156,172 ---- * to and including the time that the capability is enabled as the point * where thread memory allocation measurement starts. * * @param id the thread ID of a thread * @return an approximation of the total memory allocated, in bytes, in ! * heap memory for the thread with the specified ID ! * if the thread with the specified ID exists, the thread is alive, * and thread memory allocation measurement is enabled; * {@code -1} otherwise. * * @throws IllegalArgumentException if {@code id} {@code <=} {@code 0}. ! * @throws UnsupportedOperationException if the Java virtual * machine implementation does not support thread memory allocation * measurement. * * @see #isThreadAllocatedMemorySupported * @see #isThreadAllocatedMemoryEnabled
*** 163,173 **** * whose ID is in the corresponding element of the input array of IDs. * * @throws NullPointerException if {@code ids} is {@code null} * @throws IllegalArgumentException if any element in the input array * {@code ids} is {@code <=} {@code 0}. ! * @throws java.lang.UnsupportedOperationException if the Java virtual * machine implementation does not support thread memory allocation * measurement. * * @see #getThreadAllocatedBytes(long) * @see #isThreadAllocatedMemorySupported --- 194,204 ---- * whose ID is in the corresponding element of the input array of IDs. * * @throws NullPointerException if {@code ids} is {@code null} * @throws IllegalArgumentException if any element in the input array * {@code ids} is {@code <=} {@code 0}. ! * @throws UnsupportedOperationException if the Java virtual * machine implementation does not support thread memory allocation * measurement. * * @see #getThreadAllocatedBytes(long) * @see #isThreadAllocatedMemorySupported
*** 192,202 **** * Tests if thread memory allocation measurement is enabled. * * @return {@code true} if thread memory allocation measurement is enabled; * {@code false} otherwise. * ! * @throws java.lang.UnsupportedOperationException if the Java virtual * machine does not support thread memory allocation measurement. * * @see #isThreadAllocatedMemorySupported */ public boolean isThreadAllocatedMemoryEnabled(); --- 223,233 ---- * Tests if thread memory allocation measurement is enabled. * * @return {@code true} if thread memory allocation measurement is enabled; * {@code false} otherwise. * ! * @throws UnsupportedOperationException if the Java virtual * machine does not support thread memory allocation measurement. * * @see #isThreadAllocatedMemorySupported */ public boolean isThreadAllocatedMemoryEnabled();
*** 206,219 **** * is platform dependent. * * @param enable {@code true} to enable; * {@code false} to disable. * ! * @throws java.lang.UnsupportedOperationException if the Java virtual * machine does not support thread memory allocation measurement. * ! * @throws java.lang.SecurityException if a security manager * exists and the caller does not have * ManagementPermission("control"). * * @see #isThreadAllocatedMemorySupported */ --- 237,250 ---- * is platform dependent. * * @param enable {@code true} to enable; * {@code false} to disable. * ! * @throws UnsupportedOperationException if the Java virtual * machine does not support thread memory allocation measurement. * ! * @throws SecurityException if a security manager * exists and the caller does not have * ManagementPermission("control"). * * @see #isThreadAllocatedMemorySupported */
< prev index next >