diff --git a/base/events.c b/base/events.c index 9a86cc9..b2e6f6a 100644 --- a/base/events.c +++ b/base/events.c @@ -1576,6 +1576,7 @@ void compensate_for_system_time_change(unsigned long last_time, unsigned long cu int seconds = 0; int delta = 0; +time_t dbgstart, dbgend; log_debug_info(DEBUGL_FUNCTIONS, 0, "compensate_for_system_time_change() start\n"); @@ -1609,6 +1610,8 @@ void compensate_for_system_time_change(unsigned long last_time, unsigned long cu /* adjust service timestamps */ for(temp_service = service_list; temp_service != NULL; temp_service = temp_service->next) { +dbgstart = time(NULL); + adjust_timestamp_for_time_change(last_time, current_time, time_difference, &temp_service->last_notification); adjust_timestamp_for_time_change(last_time, current_time, time_difference, &temp_service->last_check); adjust_timestamp_for_time_change(last_time, current_time, time_difference, &temp_service->next_check); @@ -1618,13 +1621,25 @@ void compensate_for_system_time_change(unsigned long last_time, unsigned long cu /* recalculate next re-notification time */ temp_service->next_notification = get_next_service_notification_time(temp_service, temp_service->last_notification); +dbgend = time(NULL); +if ((dbgend - dbgstart) > 1) +logit(NSLOG_PROCESS_INFO|NSLOG_RUNTIME_WARNING, TRUE, "DebugQueueFreeze - get_next_service_notification_time took %lu seconds for service %s on host %s\n", +dbgend - dbgstart, temp_service->description, temp_service->host_name); +dbgstart = dbgend; + /* update the status data */ update_service_status(temp_service, FALSE); +dbgend = time(NULL); +if ((dbgend - dbgstart) > 1) +logit(NSLOG_PROCESS_INFO|NSLOG_RUNTIME_WARNING, TRUE, "DebugQueueFreeze - update_service_status took %lu seconds for service %s on host %s\n", +dbgend - dbgstart, temp_service->description, temp_service->host_name); } /* adjust host timestamps */ for(temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) { +dbgstart = time(NULL); + adjust_timestamp_for_time_change(last_time, current_time, time_difference, &temp_host->last_notification); adjust_timestamp_for_time_change(last_time, current_time, time_difference, &temp_host->last_check); adjust_timestamp_for_time_change(last_time, current_time, time_difference, &temp_host->next_check); @@ -1635,10 +1650,23 @@ void compensate_for_system_time_change(unsigned long last_time, unsigned long cu /* recalculate next re-notification time */ temp_host->next_notification = get_next_host_notification_time(temp_host, temp_host->last_notification); +dbgend = time(NULL); +if ((dbgend - dbgstart) > 1) +logit(NSLOG_PROCESS_INFO|NSLOG_RUNTIME_WARNING, TRUE, "DebugQueueFreeze - get_next_host_notification_time took %lu seconds for host %s\n", +dbgend - dbgstart, temp_host->name); +dbgstart = dbgend; + /* update the status data */ update_host_status(temp_host, FALSE); +dbgend = time(NULL); +if ((dbgend - dbgstart) > 1) +logit(NSLOG_PROCESS_INFO|NSLOG_RUNTIME_WARNING, TRUE, "DebugQueueFreeze - update_host_status took %lu seconds for host %s\n", +dbgend - dbgstart, temp_host->name); +dbgstart = dbgend; } +dbgstart = time(NULL); + /* adjust program timestamps */ adjust_timestamp_for_time_change(last_time, current_time, time_difference, &program_start); adjust_timestamp_for_time_change(last_time, current_time, time_difference, &event_start); @@ -1646,6 +1674,10 @@ void compensate_for_system_time_change(unsigned long last_time, unsigned long cu /* update the status data */ update_program_status(FALSE); +dbgend = time(NULL); +if ((dbgend - dbgstart) > 1) +logit(NSLOG_PROCESS_INFO|NSLOG_RUNTIME_WARNING, TRUE, "DebugQueueFreeze - update_program_status took %lu seconds\n", dbgend - dbgstart); + return; }