While this interface is simple to use, collecting multiple samples over a long period of time to monitor overall system behaviour takes a little more effort. To help with this, I've written a very simple tool called eventstat that calculates the rate of events per second and can dump the data in a .csv (comma separated values) format for importing into a spreadsheet such as LibreOffice for further analysis (such as graphing).
In its basic form, eventstat will run ad infinitum and can be halted by control-C. One can also specify the sample period and number of samples to gather, for example:
sudo eventstat 10 60
.. this gathers samples every 10 seconds for 60 samples (which equates to 10 minutes).
The -t option specifies an events/second threshold to discard events less than this threshold, for example: sudo cpustat -t 10 will show events running at 10Hz or higher.
To dump the samples into a .csv file, use the -r option followed by the name of the .csv file. If you just want to collect just the samples into a .csv file and not see the statistics during the run, use also the -q option, e.g.
sudo eventstat -q -r event-report.csv
With eventstat you can quickly identify rouge processes that cause a high frequency of wake ups. Arguably one can do this with tools such as PowerTop, but eventstat was written to allow one to collect the event statistics over a very long period of time and then help to analyse or graph the data in tools such as Libre Office spreadsheet.
The source is available in the following git repository: git://kernel.ubuntu.com/cking/eventstat.git and in my power management tools PPA: https://launchpad.net/~colin-king/+archive/powermanagement
In an ideal world, application developers should check their code with tools like eventstat or PowerTop to ensure that the application is not misbehaving and causing excessive wake ups especially because abuse of timers could be happening in the supporting libraries that applications may be using.
No comments:
Post a Comment