| 51 | } |
| 52 | |
| 53 | bool watchdog::run() |
| 54 | { |
| 55 | update_clock_tick(); |
| 56 | |
| 57 | unsigned expected_major_trigger_time = last_fire + this->major_threshold; |
| 58 | unsigned expected_minor_trigger_time = last_fire + this->minor_threshold; |
| 59 | |
| 60 | bool major_watchdog_tripped = clock_tick > expected_major_trigger_time; |
| 61 | bool minor_watchdog_tripped = clock_tick > expected_minor_trigger_time; |
| 62 | |
| 63 | // Check if either watchdog has taken longer than expected to run, |
| 64 | // and if so, warn that we are overloaded. |
| 65 | if (major_watchdog_tripped) { |
| 66 | major_triggers++; |
| 67 | CStat::globalStat(CStat::E_WATCHDOG_MAJOR); |
| 68 | last_trigger = clock_tick; |
| 69 | WARNING("Overload warning: the major watchdog timer %dms has been tripped (%lu), %d trips remaining.", |
| 70 | major_threshold, |
| 71 | clock_tick - last_fire, |
| 72 | major_maxtriggers - major_triggers); |
| 73 | } else if (minor_watchdog_tripped) { |
| 74 | minor_triggers++; |
| 75 | last_trigger = clock_tick; |
| 76 | CStat::globalStat(CStat::E_WATCHDOG_MINOR); |
| 77 | WARNING("Overload warning: the minor watchdog timer %dms has been tripped (%lu), %d trips remaining.", |
| 78 | minor_threshold, |
| 79 | clock_tick - last_fire, |
| 80 | minor_maxtriggers - minor_triggers); |
| 81 | } |
| 82 | |
| 83 | bool major_watchdog_failure = ((this->major_maxtriggers != -1) && |
| 84 | (major_triggers > this->major_maxtriggers)); |
| 85 | bool minor_watchdog_failure = ((this->minor_maxtriggers != -1) && |
| 86 | (minor_triggers > this->minor_maxtriggers)); |
| 87 | |
| 88 | // If the watchdogs have tripped too many times, end the SIPp run. |
| 89 | if (major_watchdog_failure) { |
| 90 | ERROR("Overload error: the watchdog timer has tripped the major threshold of %dms too many times (%d out of %d allowed) (%d out of %d minor %dms timeouts tripped)", |
| 91 | major_threshold, |
| 92 | major_triggers, |
| 93 | major_maxtriggers, |
| 94 | minor_triggers, |
| 95 | minor_maxtriggers, |
| 96 | minor_threshold); |
| 97 | } else if (minor_watchdog_failure) { |
| 98 | ERROR("Overload error: the watchdog timer has tripped the minor threshold of %dms too many times (%d out of %d allowed) (%d out of %d major %dms timeouts tripped)", |
| 99 | minor_threshold, |
| 100 | minor_triggers, |
| 101 | minor_maxtriggers, |
| 102 | major_triggers, |
| 103 | major_maxtriggers, |
| 104 | major_threshold); |
| 105 | } |
| 106 | |
| 107 | |
| 108 | |
| 109 | if ((reset_interval > 0) && |
| 110 | (major_triggers || minor_triggers) && |
nothing calls this directly
no test coverage detected