Physicists were the first to be frustrated by the phenomenon that the more closely you observe something, the more you affect it. Whether it’s a thermometer slightly impacting the temperature of what you’re measuring, or the Heisenberg principle and the inability to measure both velocity and position of a subatomic particle, or Peek-a-Boo and closely measuring processes’ resource usage, the act of measuring isn’t just a passive act: it influences what you’re trying to measure.
This brief essay explores the dilemma, basically from the perspective of Peek-a-Boo.
Peek-a-Boo gathers many pieces of information. One of the most CPU-expensive pieces is how much CPU time a process has used. In some ways this is a Catch-22, because if you’re trying to analyse which processes are using the most CPU, oftentimes it will be the one that’s doing the checking.
Even command-line tools such as top will use a surprising amount of CPU while watching other processes’ usage of CPU time. For some reason, the operating system simply uses a large chunk of the processor to track and report this information.
Two questions will naturally arise when somebody is faced with this dilemma:
Although any observation of CPU usage will itself cause more CPU time to be used, in most cases that effect is tiny. In fact, if the total CPU usage is less than 100%, that “elbow room” suggests that even gathering the CPU usage information isn’t using enough processor power to substantially affect the processes whose CPU usage is being monitored.
And Peek-a-Boo is the perfect “self-monitor” in this environment. Peek-a-Boo and its helper daemon are just normal processes, so by watching their CPU usage characteristics it is easy to tell whether the CPU usage spent monitoring CPU usage is worthwhile or needs adjustment.
The second question is really about finding the perfect balance between lowering how much CPU time Peek-a-Boo needs and maximizing the resolution of the data for processes whose CPU usage is being tracked.
All of the CPU-intensive capabilities of Peek-a-Boo have been designed to be adjustable. If you see Peek-a-Boo using too much of the CPU, you can generally turn down the frequency which which Peek-a-Boo updates its information.
Peek-a-Boo’s Process Throb view is a perfect example of this ability to fine-tune how Peek-a-Boo works for you. There are three things that Process Throb does that use the CPU:
Even though we made some guesses for these parameters, they may not work best for you. You may have a faster computer and want more frequent CPU-usage updates. Or you may want to minimize Peek-a-Boo’s CPU usage and set updates to happen very infrequently.
All options that affect Peek-a-Boo’s CPU usage are adjustable in the Preferences panes.