1

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.

2
  • Waiting (for locks, disk, network, user input, ...) usually doesn't consume CPU.
    – scai
    Aug 7, 2013 at 9:44
  • i understand it does not consume cpu i want to know if %CPU measurement is aware of that. (if it samples the amount of time the thread is in that method it might not know that)
    – Jas
    Aug 8, 2013 at 9:39

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .