Logging CPU Usage

Is there a way to keep track of CPU usage? Activity monitor can give a nice graphical display of which core is being used and to what extent, as well as showing this information over time. Is there a log file for this information, or a way to create one?

Thanks

MacBook 1.83GHz core2duo, Mac OS X (10.5.7)

Posted on May 29, 2009 5:37 AM

Reply
5 replies

May 29, 2009 1:43 PM in response to mgardnertech

Welcome to Apple Discussions:

Yes, run
top
in the terminal
It runs continuously.
Use q or ctl-c to quit. That's ctl not cmd.

If you want to save it to a desktop file, run

top > desktop/top.txt

When you thing it's recorded enough use q or ctl-c

You can change the interval and do other things.
In the terminal enter
man top
to get the instructions and usage.

Message was edited by: nerowolfe

May 29, 2009 6:55 PM in response to nerowolfe

Thanks for the information. I ran top, but can't really get a good handle on what information it is giving me, or how it is separated out. What I am really looking for is a way to track the load over time, and keep a record of it. Activity Monitor does a good job of showing this information for a little while, but it doesn't seem to keep a record of it.

If top keeps this information, do you know how to dig it out of the text file? I tried opening it in Excel and Numbers to see if it was tab or comma delimited, but it doesn't appear to be.

Thanks,
Mike

May 29, 2009 7:34 PM in response to mgardnertech

top essentially gives you the same info as does Activity Monitor.
Be sure your terminal is set large enough to see the entire line.
PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE

PID is simply a number the system assigns to the process
Most are self-explanatory
COMMAND is the name of the process
TH is the number of threads the proces spawns
TIME is the actual processor time used, not a %

Again, if you enter
man top
You get a complete explanation.
You can also customize the output to your requirements or needs.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Logging CPU Usage

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.