Once in a while some program (ok, usually it's firefox) will start eating up nearly 100% of a processor's cpu time, heating up the processor and driving down by laptop's battery life. Since it's not bad enough to impact performance, I usually don't notice for a while, so I'd like to change this:
Is there a utility that monitors process cpu usage and popus up an alert if some process is using a lot of cpu time for an extended period of time (e.g., more than 30 seconds)? I can probably rig something up with ps or top, sed and a bunch of pipes, but I'm hoping there's a more direct way to do it.
Edit: On second thought, what I'm really after is power usage. So any instrumentation specifically targeted at estimating power consumption is of particular interest.
I'm on OS X 10.8, but welcome Linux-specific solutions as well.