Monitoring CPU Usage on your Mac – a better top command

Oct 6, 2009 - 10 Comments

Following the CPU usage on my Mac is a mild obsession, and I usually use the Mac terminal command ‘top’ to do this but I noticed that top itself takes up a fair amount of CPU usage (5% or more). I made this complaint to a friend of mine and they told me to try this command instead:

top -F -R -o cpu

Type that in the Terminal and you’ll get a more efficient usage of top that uses less CPU itself, thanks to the flags. Here’s an explanation of the flags:

-F Do not calculate statistics on shared libraries, also known as frameworks.
-R Do not traverse and report the memory object map for each process.
-o cpu Order by CPU usage

By using top with those flags I have reduced top CPU usage to 1% and it’s also more appropriate for my needs. Try it out!

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: David Mendez in Command Line, Tips & Tricks

10 Comments

» Comments RSS Feed

  1. DistortedLoop says:

    What I don’t like about Top is that is that you can never see every item on the list. It only displays as many processes as will fit in the shell window. Is there a way to make it scrollable?

  2. addi says:

    ~$ top -F
    Segmentation fault

    wtf??

  3. Justin Pitts says:

    Segfault here as well, isolated to the use of the -R switch. Snow Leopard thing?

  4. Justin Pitts says:

    s/-R/-F/

    sigh.

  5. addi says:

    A friend tested the command for me on his machine (also snow leopard) … ‘top -F’ works for him without segfault.

  6. Bill Eccles says:

    The segmentation fault seems to occur with the -F, not the -R.

    Save a few keystrokes and use “-u” which is “an alias equivalent to: -o cpu -O time”. Close enough.

    top -R -u

    works OK and cuts the CPU usage of top by about 80%.

  7. Sampling every second is not useful for me. Therefore I use

    top -s 5 -u

    which cuts the overall CPU usage of top by 80% too.

  8. martin says:

    iostat -n0 -w1

    This should be significantly less CPU intensive and provide precisely what you’re looking for.

  9. MrPaul says:

    I wish the OS X (BSD) version of top was more like the one that comes with ubuntu. With that I can press the number “1” and it will display the CPU usage for each CPU/core. You can also press the letter “i” and it will hide all idle processes to clean up the display a bit.

  10. […] on it’s own and it’ll spit out a one-off look at the system stats, or you can just use the top command for similar […]

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates