I test my server in java, and monitored the cpu usage for it. First I use top command, and it show me as follows:
And then ,I use command
ps -C java -L -o pcpu,cpu,nice,state,cputime,pid,tid | sort to show all the java thread
the first column is cpu usage of each thread.
And I just found that the highest usage is only 0.3 and all cpu usage Sum up much less than 31.6.
I wish some one can tell me why ,THKS
edit:
To see more information , I use top -Hp 1234 (1234is my java pid) and I suddenly found that there exists a java thread(the pidis 1238) and the cpu usage of which usually suddenly promoted to 10-20 and even more, and I think it is this to be blamed.
And then I use
jstack 1234 |grep 4d6 -A 30
to see more detail of the thread, and it showed me :
"VM Thread" prio=10 tid=0x00007ff6ec060000 nid=0x4d6 runnable
"VM Periodic Task Thread" prio=10 tid=0x00007ff6ec091800 nid=0x4dd waiting on condition
JNI global references: 262
And I wish you can help me to analyse it.


htopfor detailed informationpsat a different moment than the sum value (31.6). The two doesn't match.