From ffbe95ffd9d45e660f93fcbe7b3a23d857e1c1eb Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 23 Mar 2006 18:36:14 +0000
Subject: [PATCH] Log if slurmctld background loop takes more than one second

---
 src/slurmctld/controller.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index 11760e1d989..580826cc726 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -698,6 +698,7 @@ static void *_slurmctld_background(void *no_data)
 	static time_t last_assert_primary_time;
 	time_t now;
 	int ping_interval;
+	DEF_TIMERS;
 
 	/* Locks: Read config */
 	slurmctld_lock_t config_read_lock = { 
@@ -734,6 +735,7 @@ static void *_slurmctld_background(void *no_data)
 		sleep(1);
 
 		now = time(NULL);
+		START_TIMER;
 
 		if (slurmctld_config.shutdown_time) {
 			int i;
@@ -824,6 +826,9 @@ static void *_slurmctld_background(void *no_data)
 		}
 		unlock_slurmctld(config_read_lock);
 
+		END_TIMER;
+		if (DELTA_TIMER > 1000000)	/* more than one second */ 
+			info("_slurmctld_background loop %s", TIME_STR);
 	}
 	debug3("_slurmctld_background shutting down");
 
-- 
GitLab