From the course: Linux Performance Tuning

top for CPU usage - Linux Tutorial

From the course: Linux Performance Tuning

Start my 1-month free trial

top for CPU usage

- [Instructor] So here we're going to run the top command. You can see we've got a good bit of information on the top of top, and we see a refreshed display, and we see at the top because this is sorted by CPU percentage, a command called nthreads, and it's using over 300% of the CPU. Interesting math there. That's because this machine has more than one core, and it must be a multi-threaded program, because it must be running on more than one core. We can tell top to show all the threads instead of just one command per thread by typing the capital letter H. So if I type that, you'll see the display change, but you won't see me type the H. I'm going to type capital H, and now we see a display, bash there for a sec, and we see nthreads, and we also see bash in there too. And nthreads is there four times because nthreads is a program with four threads. So bash is doing some other stuff. But if you look at the process ids for nthreads, you can see they're consecutive. Program started and then it started some new threads. So sometimes that's kind of handy, and if you look a the percentages now, none of them are more than 100%, because you can't be more than 100% on a single CPU. That was a simple example with top, and we see, "Hey! Some stuff that's definitely CPU- (mumbles). You quit top with ctrl+C.

Contents