File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 14
14
#include " RedisSelectableChannel.h"
15
15
#include " ZeroMQSelectableChannel.h"
16
16
#include " PerformanceIntervalTimer.h"
17
+ #include " TimerWatchdog.h"
17
18
18
19
#include " sairediscommon.h"
19
20
@@ -4295,6 +4296,14 @@ bool Syncd::isVeryFirstRun()
4295
4296
return firstRun;
4296
4297
}
4297
4298
4299
+ static void timerWatchdogCallback (
4300
+ _In_ int64_t span)
4301
+ {
4302
+ SWSS_LOG_ENTER ();
4303
+
4304
+ SWSS_LOG_ERROR (" main loop execution exceeded %ld us" , span);
4305
+ }
4306
+
4298
4307
void Syncd::run ()
4299
4308
{
4300
4309
SWSS_LOG_ENTER ();
@@ -4342,6 +4351,10 @@ void Syncd::run()
4342
4351
runMainLoop = false ;
4343
4352
}
4344
4353
4354
+ TimerWatchdog twd (30 * 1000000 ); // watch for executions over 30 seconds
4355
+
4356
+ twd.setCallback (timerWatchdogCallback);
4357
+
4345
4358
while (runMainLoop)
4346
4359
{
4347
4360
try
@@ -4350,6 +4363,8 @@ void Syncd::run()
4350
4363
4351
4364
int result = s->select (&sel);
4352
4365
4366
+ twd.setStartTime ();
4367
+
4353
4368
if (sel == m_restartQuery.get ())
4354
4369
{
4355
4370
/*
@@ -4438,6 +4453,8 @@ void Syncd::run()
4438
4453
{
4439
4454
SWSS_LOG_ERROR (" select failed: %d" , result);
4440
4455
}
4456
+
4457
+ twd.setEndTime ();
4441
4458
}
4442
4459
catch (const std::exception &e)
4443
4460
{
@@ -4454,6 +4471,8 @@ void Syncd::run()
4454
4471
4455
4472
// make sure that if second exception will arise, then we break the loop
4456
4473
m_commandLineOptions->m_disableExitSleep = true ;
4474
+
4475
+ twd.setEndTime ();
4457
4476
}
4458
4477
}
4459
4478
You can’t perform that action at this time.
0 commit comments