Tuesday, July 26, 2005

"Why is the fan so loud on my PowerBook?"

I asked myself that a few seconds ago. I'm in bed. My 12" Powerbook is on my chest, and the fan is on full blast. Which means its running hot. Which means it's doing something processor intensive. But what could that be? I'm just browsing the web. I'm not even listening to iTunes. There is no reason for this.

Luckily, as a developer, I've installed Apple's free development tools. (If you bought Mac OS X, they are on the separate CD) and I can run the "top" utility. So I launch the "Terminal" application, and type in:

top -o cpu

And what do I see, but that Sherlock is using up half my CPU doing nothing but pausing a movie trailer:

[Lefler:/System/Library/Extensions] glenn% top -o cpu

Processes: 79 total, 6 running, 73 sleeping... 280 threads 07:52:47
Load Avg: 1.81, 0.89, 1.07 CPU usage: 62.7% user, 37.3% sys, 0.0% idle
SharedLibs: num = 238, resident = 42.7M code, 4.61M data, 4.86M LinkEdit
MemRegions: num = 15609, resident = 457M + 12.0M private, 138M shared
PhysMem: 132M wired, 416M active, 318M inactive, 867M used, 285M free
VM: 7.38G + 151M 410626(15) pageins, 308443(0) pageouts

2637 Sherlock 41.4% 0:21.33 14 235 336 15.3M+ 17.5M 25.4M+
782 DashboardC 11.8% 4:20.41 4 105 210 5.97M+ 7.52M 12.1M+

What would a typical user do in this situation? How would they know which of dozens of applications is killing the performance of their expensive toy? I know enough to feel the symptoms and run top, but what would someone else do? It might not even be an application taking up all the cycles. The installer for my HP printer installs a background process which occasionally goes crazy and uses 60% of my cycles. It's inconceivable that the typical user would know how to make their computer speedy again. They would just have a poor experience with Mac OS X.

And what is wrong with Sherlock that it can't idle a QuickTime movie properly? QuickTime does all the work for you these days making efficient use of idle time. It's not like the old days when you set your sleep time to zero and gave QuickTime idle time every pass through your WaitNextEvent loop. QuickTime can now register its own Carbon Event timer. It's very nice. It practically writes itself.

[Update: The "Activity Monitor" application under Applications/Utilities is a more user friendly, and informative, way to find out what application is soaking up cycles.]