I'm running
top -H -b -n 1
on a Linux with a java app
I get result with headers:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
is the %CPU I see for each thread
a real cpu meaning it does not take into account the time the thread wasted on waiting for locks, etc., so its purely the time the thread has been spending on CPU.
If you looking for more information about process I/O access and cpu usage maybe you can look iotop. The app provide information about process like top but for Input/Output information. Iotop use information from /proc files , example here for the process 16528.
cat /proc/16528/io
rchar: 48752567
wchar: 549961789
syscr: 5967
syscw: 67138
read_bytes: 49020928
write_bytes: 549961728
cancelled_write_bytes: 0
I Know it's possible to call it in bash mode like top.
iotop -botqqq --iter=3 >> /var/log/iotop
You can look dstat too but it's like top , global for the system not specific for a process.
You don't have thread lock information.
If you look only for java maybe look jconsole it uses ThreadMXBean getThreadCpuTime() function.