开发者

jtop cpu seconds

开发者 https://www.devze.com 2023-03-18 12:34 出处:网络
I am using JTOP plugin of JConsole in 开发者_运维知识库VisualVM. It somes me the CPU(secs) usage. I am trying to understand the meaning of this, is it?

I am using JTOP plugin of JConsole in 开发者_运维知识库VisualVM. It somes me the CPU(secs) usage. I am trying to understand the meaning of this, is it?

  • a) Time (in secs) the theead is running of CPU.
  • b) Time (in secs) the thread started running for the first time (it might not be running always)
  • c) Some other time?

Thanks in anticipation.


If you mean the JTop Jconsole plugin from the demo/management folder of the JDK distribution: It uses ThreadMXBean.getThreadCpuTime(long) to get the cpu time. The javadoc for this method states:

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.

This value is divided by 10E9 by the plugin before put into the table, so you see the amount of Time the process was using the CPU in seconds.


I'd say it's a), ie. the time the thread spent running on the CPU so far.

It's actually a ui for ThreadMXBean.

From that JavaDoc:

If the implementation distinguishes between user mode time and system mode time, the returned CPU time is the amount of time that the current thread has executed in user mode or system mode.

This implies that overall CPU time is also the execution time.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号