Erik Eckel offers tips on using Mac OS X Lion's Activity Monitor to diagnose and track performance problems.
Task Manager proves critical in helping diagnose Windows issues. Activity Monitor does the same for Mac OS X Lion.
Maximize Activity Monitor
As previously reviewed, Activity Monitor reveals processes consuming CPU and RAM resources. Located within the Application's Utilities folder, Activity Monitor lists process identification (PID) numbers, friendly Process Names, User accounts that spawned each process, CPU percentages and physical memory usage that processes are consuming, and more.
Double-clicking an individual process opens a window providing vastly more information about that specific process.
For example, double-clicking Microsoft Word opens a window possessing three tabs. The Memory tab lists Real Memory Size, Virtual Memory Size, Shared Memory Size, Private Memory Size, and Virtual Private Memory, all different memory spaces that can be reviewed to help trace error-prone or runaway processes. The Statistics tab lists the total number of threads the process maintains, as well as ports, CPU time, context switches, faults, page ins, messages in and out, and system calls (in and out). The Open Files and Ports tab, meanwhile, lists the actual files and hard disk locations for those files, while also listing the processes' CPU percentage, responsible user account, and recent hangs.
Since parent processes, too, can be found by reading the parent process listed at the window's top-left side, Activity Monitor makes it easier to diagnose a faulty application. Because parent-child threads can be tracked via Activity Monitor, the utility simplifies the process of not only diagnosing a runaway or faulty application but suspending offending processes. Problematic processes can be terminated by highlighting them and clicking View and selecting Quit Process or by clicking the Quit button that appears within the process' corresponding window that opens when double-clicking a process.
By default, only the currently logged in user's processes are displayed. Users can elect to view additional processes by changing the default selection found within the drop-down menu at the top right edge of the window. Available options include All Processes, All Processes Hierarchically, System Processes, Other User Processes, Active Processes, Inactive Processes, and Windows Processes.
Users and administrators wishing to track or compare system performance at different times can choose to create snapshots of individual processes. To do so, the user need only highlight the process to be tracked and click the Activity Monitor's Sample Process icon. Mac OS X Lion will create a sample of the process and record the date, time, process, thread assignments, memory and addressing information, and system library data. This information can then be saved as a text file that can be later compared to additional samples to measure changes against a baseline or to track performance trends.
The Statistics tab also empowers performance tracking. Since Activity Monitor tracks system usage (including faults, CPU time and system calls) historically and not just when the Activity Monitor is open, users can dig deep specifically by process. Studying a process' statistics can help determine whether an application is frozen, stuck in an endless loop, or generating faults, in which case additional troubleshooting can occur to determine whether a hardware error exists, an application is malfunctioning, an application incompatibility exists, memory errors are occurring, or potentially some other problem is present.
Users requiring additional performance tracking and debugging information may wish to load Apple's developer tools. Xcode 4.2.1 for Lion is available free in the Mac App store. A new interface and debugging engine assist troubleshooting and optimizing Mac OS X Lion applications. New data collection tools are included, too, to further enhance performance tracking and improvement.