I've never tried this, so all usual caveats apply....
There is a little-used part of PHP syntax (little used because as yet there is only one use) called [man]declare[/man]. With it you can specify a kind of cycle period. Then you can declare a function [man]register_tick_function[/man] that operates once each cycle.
My idea is that each component has with it a method that looks something like:
private function continuance()
{
static $start_time = -1;
if($start_time==-1)
{
$start_time=microtime(true);
return;
}
$current_time=microtime(true);
if($current_time-$start_time) > $this->speed_warning)
{
// Code to abort
// and clean up
// this operation.
$start_time=-1;
unregister_tick_function(array($this, 'continuance'));
return;
}
}
(I'm coding to PHP5; it wouldn't be hard to downgrade, though).
The ticks value you declare will need to be determined empirically; it depends on things like the speed of your server, etc.
The obvious downer to this is that it only knows about its own lifespan, not that of any others, but despite this it only looks at wall time, not time it has actually spent itself.