Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

thanks

share|improve this question
    
Waiting (for locks, disk, network, user input, ...) usually doesn't consume CPU. –  scai Aug 7 '13 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) –  Tomer Aug 8 '13 at 9:39

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.