X

Systemstats offers quick overview of Mavericks system activity

Apple's report-generating routines in OS X Mavericks give in-depth views of your system's activity, which may help if you need to troubleshoot problems with your system.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
3 min read

When troubleshooting your Mac, you may have specific symptoms -- such as the inability to print or a warning or error that pops up -- or problems which are not so specific in nature -- such as a general slow-down where programs launch with long delays or long pauses when shutting down.

In these instances, often it helps to get a general feel for how the system is configured, and how its hardware and software are being used. This can be a listing of attached USB devices and loaded drivers, a listing of processes that use CPU, and most importantly, third-party software you have installed which may be interfering with your system software and other programs.

Generally, to get this information you would have to run special scripts, use third-party tools, or follow lengthy instructions by technicians to get specific details about your system. While these approaches will work and may be specific for a technician's needs and instructions, Apple has introduced a service in OS X Mavericks that will help you get this information, and more.

Systemstats report in OS X Mavericks
The systemstats report gives detailed information about your system, which you can use to troubleshoot problems, especially when a given process or two is slowing the system or draining the battery (click for larger view). Screenshot by Topher Kessler/CNET

One of Apple's goals in Mavericks has been to increase battery life, and in doing so, has developed tools to monitor system usage and provide information on what processes are drawing the most energy. The main tool that does this is a background daemon called "systemstatsd" which collects ongoing information about your system's workload, both for hardware and software, and allows you to quickly compile reports about what processes and features of your system are being used at any given time.

When you open Activity Monitor, or use the battery menu to view processes that use the energy, the system is tapping into the system stats database and generating a brief report for you.

While used by programs such as Activity Monitor, you can also manually read off system stats using the "systemstats" terminal command, which will generate a fairly in-depth report on the programs and hardware you have installed, when they are activated, and how the system is using them. To view this report, simply open the Terminal utility (Applications > Utilities), and run the following command (supply your password when prompted, but know that it will not show):

sudo systemstats

You can pipe the output of this command to TextEdit so it will open in a new document for easy printing, e-mailing, or copying and pasting to other programs:

sudo systemstats | open -fe

This default usage of the "systemstats" command will give you a categorized report that includes the following information, and more:

  • Sleep, idle, and standby times
  • Battery percentages used per hour
  • CPU hardware summary information
  • Disk and network reads and writes
  • Memory usage information, including pages, purges, and reactivations
  • Top processes using memory
  • Process CPU time, interrupts and wake-ups, and which processes are launched more than others
  • Built-in connected devices (Wi-Fi, discrete GPU, and Bluetooth)
  • USB-connected devices

The way systemstats works, you specify a timeframe for which you would like to view the statistics, using the "-a" flag as follows:

sudo systemstats -a

You can also specify a given day using the "-d" flag as follows (in this case the day would be December 1, 2013):

sudo systemstats -d 20131201

Another approach is to specify a given timeframe using the "-s" (start) and "-e" (end) flags to get information for the same date as above, but only between 5 and 6 a.m.:

sudo systemstats -s 2013-12-01 05:00:00 -e 2013-12-01 06:30:00

A final useful option is to specify the timeframe of a given boot instance, so if you are finding problems when starting your system, the information in the report will pertain to the the boot timeframe only and not include general use information. To do this, run the following command:

sudo systemstats -B current

Beyond these, the systemstats command has more options you can look up, which can be seen by running the following command in the Terminal to get the help output for the command:

systemstats --help



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.