3
votes

I am running a multi-thread Java application on Ubuntu. I want to watch the CPU usage.

The reading I saw from "System Monitor" is around 42% over time. Does this mean most of the CPUs is not fully utilized? I have 8 cores.

However, if I watch it in 'top' command, it shows that my Java application is using over %300 CPU (one PID).

Which reflects the true picture of my CPU utilization? I want to see whether and how my Java application benefits the threading.

1
It sounds like your program is using about 3 cores' worth of CPU (~300% of one core, or ~42% of the entire 8-core box). I'd say the two numbers are roughly in agreement. - NPE
Seems like "System monitor" is using 100% = 8 cores under full load, while top uses 100%= 1 core under full load. So you seem to have about 3 cores maxed out. - piet.t
Probably the 42% figure relates to the processor while the 300% (8 x 42 = 336) to a single core. - Yves Daoust
"about 3 cores maxed out" does this mean other 5 cores are pretty idle, and I can increase the number of threads my application will use to speed up? - user697911
@NPE, you mean 300% is for one core? Are the other 7 cores idle? - user697911

1 Answers

4
votes

By default, top on Linux runs in so-called IRIX mode.

With IRIX mode on, 1 fully utilized core is 100% and 3 cores are 300%. With IRIX mode off, 1/8 fully utilized core is 12.5%. This means in top it shows over 300% and in "System Monitor" 40%.

You can toggle IRIX mode while top is running with Shift+i. This will make the numbers match up.