gpt4 book ai didi

java - jtop cpu 秒

转载 作者:行者123 更新时间:2023-11-30 05:01:22 25 4
gpt4 key购买 nike

我在 VisualVM 中使用 JConsole 的 JTOP 插件。这是我的CPU(秒)使用情况。我正在尝试理解这句话的意思,是吗?

  • a) 头部的时间(以秒为单位)CPU 的运行。
  • b) 时间(以秒为单位)第一个线程开始运行时间(它可能不会一直运行)
  • c) 其他时间?

感谢期待。

最佳答案

如果您指的是 JDK 发行版的 demo/management 文件夹中的 JTop Jconsole 插件:它使用 ThreadMXBean.getThreadCpuTime(long) 来获取 cpu 时间。此方法的 javadoc 指出:

Returns the total CPU time for a thread of the specified ID in nanoseconds. The returned value is of nanoseconds precision but not necessarily nanoseconds accuracy. If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the thread has executed in user mode or system mode.

If the thread of the specified ID is not alive or does not exist, this method returns -1. If CPU time measurement is disabled, this method returns -1. A thread is alive if it has been started and has not yet died.

If CPU time measurement is enabled after the thread has started, the Java virtual machine implementation may choose any time up to and including the time that the capability is enabled as the point where CPU time measurement starts.

Returns:the total CPU time for a thread of the specified ID if the thread of the specified ID exists, the thread is alive, and CPU time measurement is enabled; -1 otherwise.

该值在放入表格之前由插件除以 10E9,因此您可以看到进程使用 CPU 的时间量(以秒为单位)。

关于java - jtop cpu 秒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6592911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com