< prev index next >

src/java.management/share/classes/java/lang/management/ThreadMXBean.java

Print this page




 377      * @throws java.lang.UnsupportedOperationException if the Java
 378      * virtual machine does not support thread contention monitoring.
 379      *
 380      * @throws java.lang.SecurityException if a security manager
 381      *         exists and the caller does not have
 382      *         ManagementPermission("control").
 383      *
 384      * @see #isThreadContentionMonitoringSupported
 385      */
 386     public void setThreadContentionMonitoringEnabled(boolean enable);
 387 
 388     /**
 389      * Returns the total CPU time for the current thread in nanoseconds.
 390      * The returned value is of nanoseconds precision but
 391      * not necessarily nanoseconds accuracy.
 392      * If the implementation distinguishes between user mode time and system
 393      * mode time, the returned CPU time is the amount of time that
 394      * the current thread has executed in user mode or system mode.
 395      *
 396      * <p>
 397      * This is a convenient method for local management use and is
 398      * equivalent to calling:
 399      * <blockquote><pre>
 400      *   {@link #getThreadCpuTime getThreadCpuTime}(Thread.currentThread().getId());
 401      * </pre></blockquote>
 402      *
 403      * @return the total CPU time for the current thread if CPU time
 404      * measurement is enabled; {@code -1} otherwise.
 405      *
 406      * @throws java.lang.UnsupportedOperationException if the Java
 407      * virtual machine does not support CPU time measurement for
 408      * the current thread.
 409      *
 410      * @see #getCurrentThreadUserTime
 411      * @see #isCurrentThreadCpuTimeSupported
 412      * @see #isThreadCpuTimeEnabled
 413      * @see #setThreadCpuTimeEnabled
 414      */
 415     public long getCurrentThreadCpuTime();
 416 
 417     /**
 418      * Returns the CPU time that the current thread has executed
 419      * in user mode in nanoseconds.
 420      * The returned value is of nanoseconds precision but
 421      * not necessarily nanoseconds accuracy.
 422      *
 423      * <p>
 424      * This is a convenient method for local management use and is
 425      * equivalent to calling:
 426      * <blockquote><pre>
 427      *   {@link #getThreadUserTime getThreadUserTime}(Thread.currentThread().getId());
 428      * </pre></blockquote>
 429      *
 430      * @return the user-level CPU time for the current thread if CPU time
 431      * measurement is enabled; {@code -1} otherwise.
 432      *
 433      * @throws java.lang.UnsupportedOperationException if the Java
 434      * virtual machine does not support CPU time measurement for
 435      * the current thread.
 436      *
 437      * @see #getCurrentThreadCpuTime
 438      * @see #isCurrentThreadCpuTimeSupported
 439      * @see #isThreadCpuTimeEnabled
 440      * @see #setThreadCpuTimeEnabled
 441      */
 442     public long getCurrentThreadUserTime();
 443 
 444     /**




 377      * @throws java.lang.UnsupportedOperationException if the Java
 378      * virtual machine does not support thread contention monitoring.
 379      *
 380      * @throws java.lang.SecurityException if a security manager
 381      *         exists and the caller does not have
 382      *         ManagementPermission("control").
 383      *
 384      * @see #isThreadContentionMonitoringSupported
 385      */
 386     public void setThreadContentionMonitoringEnabled(boolean enable);
 387 
 388     /**
 389      * Returns the total CPU time for the current thread in nanoseconds.
 390      * The returned value is of nanoseconds precision but
 391      * not necessarily nanoseconds accuracy.
 392      * If the implementation distinguishes between user mode time and system
 393      * mode time, the returned CPU time is the amount of time that
 394      * the current thread has executed in user mode or system mode.
 395      *
 396      * <p>
 397      * This is a convenience method for local management use and is
 398      * equivalent to calling:
 399      * <blockquote><pre>
 400      *   {@link #getThreadCpuTime getThreadCpuTime}(Thread.currentThread().getId());
 401      * </pre></blockquote>
 402      *
 403      * @return the total CPU time for the current thread if CPU time
 404      * measurement is enabled; {@code -1} otherwise.
 405      *
 406      * @throws java.lang.UnsupportedOperationException if the Java
 407      * virtual machine does not support CPU time measurement for
 408      * the current thread.
 409      *
 410      * @see #getCurrentThreadUserTime
 411      * @see #isCurrentThreadCpuTimeSupported
 412      * @see #isThreadCpuTimeEnabled
 413      * @see #setThreadCpuTimeEnabled
 414      */
 415     public long getCurrentThreadCpuTime();
 416 
 417     /**
 418      * Returns the CPU time that the current thread has executed
 419      * in user mode in nanoseconds.
 420      * The returned value is of nanoseconds precision but
 421      * not necessarily nanoseconds accuracy.
 422      *
 423      * <p>
 424      * This is a convenience method for local management use and is
 425      * equivalent to calling:
 426      * <blockquote><pre>
 427      *   {@link #getThreadUserTime getThreadUserTime}(Thread.currentThread().getId());
 428      * </pre></blockquote>
 429      *
 430      * @return the user-level CPU time for the current thread if CPU time
 431      * measurement is enabled; {@code -1} otherwise.
 432      *
 433      * @throws java.lang.UnsupportedOperationException if the Java
 434      * virtual machine does not support CPU time measurement for
 435      * the current thread.
 436      *
 437      * @see #getCurrentThreadCpuTime
 438      * @see #isCurrentThreadCpuTimeSupported
 439      * @see #isThreadCpuTimeEnabled
 440      * @see #setThreadCpuTimeEnabled
 441      */
 442     public long getCurrentThreadUserTime();
 443 
 444     /**


< prev index next >