I do this a lot:
- Notice my MacBook Air is running hot
- Open Activity Monitor, see "Google Chrome Helper" process pegged at 100% CPU
- Open Chrome's Task Manager to find the responsible tab
- Find and kill some blog post I opened two days ago whose JS is running an infinite loop
It's especially frustrating if it happens when I'm away from my desk, and my fans have been wearing themselves out all night for no reason.
How can I prevent this?
I know cputhrottle lets you cap the CPU usage of a particular PID, but Chrome uses many processes. I considered writing a script that periodically runs cputhrottle on each PID in ps -A | grep Chrome, but this would slow down foreground tabs as well, which I'd like to keep at full speed. Monitoring of foreground/background switches could be done through a Chrome extension, which would need to communicate to a daemon running outside Chrome via the Native Messaging API, but it seems like a lot of work both to write and to distribute. I'm hoping there's a simpler solution I'm overlooking.

