This directory contains a large and growing set of dynamic samples of my computer’s processes. The samples contain three types of data:
- The output of a ps(1) command.
- A reading of various temperature sensors on my MacBook Pro. (Added March 2012)
- Free form miscellaneous notes that I added to the sampling. (Added May 2012)
This data sampling is a part of a bigger project.
Data Sampling Times
The samples were taken every 5 minutes via cron(8) using this line:
3-59/5 * * * * Command line...
in my crontab(5).
Being that I’m on a MacBook Pro, the computer always sleeps when the lid is closed. The only way to avoid this is to connect an external keyboard, mouse, and display. Thank you – not!
Due to the lid closing/sleep issue, sampling stopped when I was traveling with my computer or any other time that I shut the lid. A byproduct of my daily routine frequently leads to me shutting the lid when I’m sleeping.
Running Process Sampling Mechanism
This is the exact line I have in my crontab(5) file:
3-59/5 * * * * nice -n +20 $HOME/bin/statprocs > $HOME/process-data/samples/`$HOME/bin/dtstamp`
dstamp shell script is a one-liner that outputs the data in the format I wanted to use for my filenames. It’s one line is:
/bin/echo -n $(date '+Y%Y-M%m-D%d')
An example of its output is:
statprocs is where the real work happens.
statprocs runs ps(1) as:
ps -eS -o pid,state,cputime,etime,vsz,rss,pcpu,pmem,comm
The output of the ps(1) command is then stripped for brevity and privacy. This includes reducing full executable paths down to just the executable name, removing command-line arguments, and trimming of similar data.
Temperature Sampling Mechanism
tempmonitor -l -a -f
As I was writing this posting, I ran the above
tempmonitor command and this its output:
CPU Core 2: 190.4 F SMART Disk Hitachi HTS545050B9SA02 (100315PBL400Q7KA7E8N): 98.6 F SMB NORTHBRIDGE CHIP DIE: 150.8 F SMC BATTERY: 93.2 F SMC BATTERY POSITION 2: 93.2 F SMC BATTERY POSITION 3: 87.8 F SMC BATTERY POSITION 4: 96.8 F SMC CPU A DIODE: 190.4 F SMC CPU A PROXIMITY: 149 F SMC GPU 1 CHIP: 141.8 F SMC GPU 1 HEAT SINK: 136.4 F SMC GPU DIODE: 167 F SMC LEFT PALM REST: 89.6 F SMC MAIN HEAT SINK 3: 136.4 F SMC MAIN LOGIC BOARD: 118.4 F SMC NORTHBRIDGE POS 1: 149 F
See tempmonitor’s website for an explanation of these temperatures.
Miscellaneous Data Collection Mechanism
The miscellaneous notes functionality allowed me to add free form notes to any sampling. This was accomplished by appending notes to specific file. When
statprocs ran, it would append the data of this file to the sampling and remove the file.
I didn’t bother to synchronize the writing of the notes file with the reading of the notes file. I imagine that some notes are added to the previous or succeeding sample of where they should be. There are thousands of samples with a very small percentage of the having the notes attached to the wrong sampling. No biggie.
At the time of writing this, the miscellaneous data is only used to keep track of when I have had to kill Firefox, Chrome, or Canary because they were misbehaving. I have written three shell scripts called
killcan. When run, these shell scripts kill Firefox, Chrome, and Canary, respectively. After killing the browser, each of them adds some miscellaneous data to a notes file.
I only use the
kill* commands when my browser has broken in some way. Typically this means that the browser has hung but can also include other problems that require restarting the browser. I never use the
kill* commands to shut the browsers down for normal reasons such as shutting the computer down, upgrading browser versions, or, with Firefox, installing add-ons.