pike.git / lib / modules / Pike.pmod / Watchdog.pike

version» Context lines:

pike.git/lib/modules/Pike.pmod/Watchdog.pike:83:    foreach( debug_funcs, function f )    catch(f());       threads_disabled = 0;   }      //! Explicitly trigger the watchdog, if enough CPU time has been   //! used. This is not normally called manually.   void alarm_alarm_alarm()   { - #if constant(System.getrusage) +     if( System.getrusage()->utime < expected_cpu_time && (time()-last_seen) < delay*2 )    {    float cpus = (System.getrusage()->utime - expected_cpu_time + (delay*900))/1000.0;       Stdio.stderr.write("\n"    "****************************************\n");    Stdio.stderr.write("** WATCHDOG PENDING. **\n");    Stdio.stderr.write("** Last activity %4d seconds ago **\n", time()-last_seen);    Stdio.stderr.write("** %4.1f CPU seconds have been used **\n", cpus);    Stdio.stderr.write("****************************************\n");   #if constant(alarm)    alarm( 1 );   #endif    } - #endif +     really_trigger_watchdog_promise();   }         //! Really trigger the watchdog, killing the current process.   //! This is not normally called manually.   void really_trigger_watchdog_promise()   {    Stdio.stderr.write("\n\n***************************************************\n");    Stdio.stderr.write("***************************************************\n");
pike.git/lib/modules/Pike.pmod/Watchdog.pike:150:   {    if( (time()-last_seen) > delay/2.0 )    update_watchdog();   }      protected void update_watchdog()   {    last_seen = time();    call_out( update_watchdog, min(delay/2.0,2.0) );    - #if constant(System.getrusage) +     // Do not trigger if we have not been using CPU as well.    expected_cpu_time = System.getrusage()->utime + delay*900; - #endif +        foreach( probes, function(void:bool) probe )    {    if( !probe() )    {    Stdio.stderr.write("%O did not return true.\n", probe);    catch(really_trigger_watchdog_promise());    _exit(1);    }    }   #if constant(alarm)    alarm( delay );   #endif   }