From 95a15fc949dac8c6eca8371a8200fc754b55d4f7 Mon Sep 17 00:00:00 2001 From: Yogeswaran K Date: Fri, 27 Feb 2026 09:20:19 +0000 Subject: [PATCH 01/12] RDKEMW-7226: Add Logs to caluculate time for shutdown sequence Signed-off-by: Yogeswaran K --- source/telemetry2_0.c | 7 +++++++ telemetry2_0.service | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/telemetry2_0.c b/source/telemetry2_0.c index 9acd53ee..dbd03bce 100644 --- a/source/telemetry2_0.c +++ b/source/telemetry2_0.c @@ -109,6 +109,10 @@ T2ERROR initTelemetry() static void terminate() { + struct timespec t2, t_start; + clock_gettime(CLOCK_MONOTONIC, &t_start); + T2Info("=== [SHUTDOWN] telemetry2_0 shutdown started ===\n"); + if(remove("/tmp/.t2ReadyToReceiveEvents") != 0) { printf("removing the file /tmp/.t2ReadyToReceiveEvents failed!\n"); @@ -131,6 +135,9 @@ static void terminate() ReportProfiles_uninit(); http_pool_cleanup(); } + clock_gettime(CLOCK_MONOTONIC, &t2); + T2Info("=== [SHUTDOWN] telemetry2_0 shutdown complete, total=%ldms ===\n", + (t2.tv_sec - t_start.tv_sec) * 1000 + (t2.tv_nsec - t_start.tv_nsec) / 1000000); } static void _print_stack_backtrace(void) diff --git a/telemetry2_0.service b/telemetry2_0.service index fe4d6a87..fa622559 100644 --- a/telemetry2_0.service +++ b/telemetry2_0.service @@ -24,8 +24,8 @@ Requires=network-online.target [Service] Type=forking ExecStart=/usr/bin/telemetry2_0 -ExecStop=/usr/bin/killall telemetry2_0 -ExecStopPost=/bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady +ExecStop=/bin/sh -c 'echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop initiated by systemd" >> /rdklogs/logs/telemetry2_0.txt.0 2>&1; date +%%s > /tmp/.t2_stop_start 2>/dev/null; /usr/bin/killall telemetry2_0' +ExecStopPost=/bin/sh -c 'T_START=$(cat /tmp/.t2_stop_start 2>/dev/null); T_END=$(date +%%s); ELAPSED=$((T_END - ${T_START:-$T_END})); echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop completed in ${ELAPSED}s" >> /rdklogs/logs/telemetry2_0.txt.0 2>&1; rm -f /tmp/.t2_stop_start; /bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady' Restart=always [Install] From 22704b5061f129ed37487e953bac406d0496416b Mon Sep 17 00:00:00 2001 From: Yogeswaran K Date: Fri, 27 Feb 2026 11:10:56 +0000 Subject: [PATCH 02/12] RDKEMW-7226:Add Logs to calculate time for shutdown sequence Signed-off-by: Yogeswaran K --- source/telemetry2_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/telemetry2_0.c b/source/telemetry2_0.c index dbd03bce..ab5a834f 100644 --- a/source/telemetry2_0.c +++ b/source/telemetry2_0.c @@ -136,8 +136,8 @@ static void terminate() http_pool_cleanup(); } clock_gettime(CLOCK_MONOTONIC, &t2); - T2Info("=== [SHUTDOWN] telemetry2_0 shutdown complete, total=%ldms ===\n", - (t2.tv_sec - t_start.tv_sec) * 1000 + (t2.tv_nsec - t_start.tv_nsec) / 1000000); + T2Info("=== [SHUTDOWN] telemetry2_0 shutdown complete, total=%lldms ===\n", + (long long)(t2.tv_sec - t_start.tv_sec) * 1000 + (t2.tv_nsec - t_start.tv_nsec) / 1000000LL); } static void _print_stack_backtrace(void) From f34e064d11650567d5c93fdfdbc1d47cdc4bef78 Mon Sep 17 00:00:00 2001 From: Yogeswaran K Date: Wed, 4 Mar 2026 08:57:47 +0000 Subject: [PATCH 03/12] RDKEMW-7226:Add Logs to calculate time for shutdown sequence Signed-off-by: Yogeswaran K --- telemetry2_0.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telemetry2_0.service b/telemetry2_0.service index fa622559..fab5e704 100644 --- a/telemetry2_0.service +++ b/telemetry2_0.service @@ -24,8 +24,8 @@ Requires=network-online.target [Service] Type=forking ExecStart=/usr/bin/telemetry2_0 -ExecStop=/bin/sh -c 'echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop initiated by systemd" >> /rdklogs/logs/telemetry2_0.txt.0 2>&1; date +%%s > /tmp/.t2_stop_start 2>/dev/null; /usr/bin/killall telemetry2_0' -ExecStopPost=/bin/sh -c 'T_START=$(cat /tmp/.t2_stop_start 2>/dev/null); T_END=$(date +%%s); ELAPSED=$((T_END - ${T_START:-$T_END})); echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop completed in ${ELAPSED}s" >> /rdklogs/logs/telemetry2_0.txt.0 2>&1; rm -f /tmp/.t2_stop_start; /bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady' +ExecStop=/bin/sh -c 'echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop initiated by systemd" >> /opt/logs/telemetry2_0.txt.0 2>&1; date +%%s > /tmp/.t2_stop_start 2>/dev/null; /usr/bin/killall telemetry2_0' +ExecStopPost=/bin/sh -c 'T_START=$(cat /tmp/.t2_stop_start 2>/dev/null); T_END=$(date +%%s); ELAPSED=$((T_END - ${T_START:-$T_END})); echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop completed in ${ELAPSED}s" >> /opt/logs/telemetry2_0.txt.0 2>&1; rm -f /tmp/.t2_stop_start; /bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady' Restart=always [Install] From d599bc48bf1811427be875dacf5f61f9866b3dd6 Mon Sep 17 00:00:00 2001 From: Yogeswaran K Date: Mon, 9 Mar 2026 14:17:37 +0000 Subject: [PATCH 04/12] RDKEMW-7226: Add Logs to calculate time for shutdown sequence Signed-off-by: Yogeswaran K --- telemetry2_0.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telemetry2_0.service b/telemetry2_0.service index fab5e704..1870ab10 100644 --- a/telemetry2_0.service +++ b/telemetry2_0.service @@ -25,7 +25,7 @@ Requires=network-online.target Type=forking ExecStart=/usr/bin/telemetry2_0 ExecStop=/bin/sh -c 'echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop initiated by systemd" >> /opt/logs/telemetry2_0.txt.0 2>&1; date +%%s > /tmp/.t2_stop_start 2>/dev/null; /usr/bin/killall telemetry2_0' -ExecStopPost=/bin/sh -c 'T_START=$(cat /tmp/.t2_stop_start 2>/dev/null); T_END=$(date +%%s); ELAPSED=$((T_END - ${T_START:-$T_END})); echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop completed in ${ELAPSED}s" >> /opt/logs/telemetry2_0.txt.0 2>&1; rm -f /tmp/.t2_stop_start; /bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady' +ExecStopPost=/bin/sh -c 'echo "[SHUTDOWN] $$(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop completed" >> /opt/logs/telemetry2_0.txt.0 2>&1; rm -f /tmp/.t2_stop_start; /bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady' Restart=always [Install] From 664955e3fc7a17fb46cc140e62ab3b8c2b76484e Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 15:53:18 +0530 Subject: [PATCH 05/12] RDKEMW-7226: Update telemetry2_0.service --- telemetry2_0.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telemetry2_0.service b/telemetry2_0.service index 1870ab10..fe4d6a87 100644 --- a/telemetry2_0.service +++ b/telemetry2_0.service @@ -24,8 +24,8 @@ Requires=network-online.target [Service] Type=forking ExecStart=/usr/bin/telemetry2_0 -ExecStop=/bin/sh -c 'echo "[SHUTDOWN] $(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop initiated by systemd" >> /opt/logs/telemetry2_0.txt.0 2>&1; date +%%s > /tmp/.t2_stop_start 2>/dev/null; /usr/bin/killall telemetry2_0' -ExecStopPost=/bin/sh -c 'echo "[SHUTDOWN] $$(date +%%Y-%%m-%%dT%%H:%%M:%%S) telemetry2_0 stop completed" >> /opt/logs/telemetry2_0.txt.0 2>&1; rm -f /tmp/.t2_stop_start; /bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady' +ExecStop=/usr/bin/killall telemetry2_0 +ExecStopPost=/bin/rm -rf /tmp/.t2ReadyToReceiveEvents /tmp/telemetry_initialized_bootup /tmp/.t2ConfigReady Restart=always [Install] From 3cf6144bd7804eed57e02368724ca005a5dead69 Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:08:58 +0530 Subject: [PATCH 06/12] RDKEMW-7226: Update telemetry2_0.c --- source/telemetry2_0.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/telemetry2_0.c b/source/telemetry2_0.c index 45d87e8a..ff4c9c57 100644 --- a/source/telemetry2_0.c +++ b/source/telemetry2_0.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef __GNUC__ #ifndef _BUILD_ANDROID #ifdef __GLIBC__ @@ -109,9 +110,9 @@ T2ERROR initTelemetry() static void terminate() { + T2Info("%s ++in\n", __FUNCTION__); struct timespec t2, t_start; clock_gettime(CLOCK_MONOTONIC, &t_start); - T2Info("=== [SHUTDOWN] telemetry2_0 shutdown started ===\n"); if(remove("/tmp/.t2ReadyToReceiveEvents") != 0) { @@ -138,6 +139,7 @@ static void terminate() clock_gettime(CLOCK_MONOTONIC, &t2); T2Info("=== [SHUTDOWN] telemetry2_0 shutdown complete, total=%lldms ===\n", (long long)(t2.tv_sec - t_start.tv_sec) * 1000 + (t2.tv_nsec - t_start.tv_nsec) / 1000000LL); + T2Info("%s --out\n", __FUNCTION__); } static void _print_stack_backtrace(void) @@ -172,6 +174,7 @@ static void _print_stack_backtrace(void) void sig_handler(int sig, siginfo_t* info, void* uc) { + T2Info("%s ++in\n", __FUNCTION__); if(DAEMONPID == getpid()) { int fd; @@ -224,6 +227,14 @@ void sig_handler(int sig, siginfo_t* info, void* uc) } else if ( sig == SIGTERM || sig == SIGKILL ) { + if ( sig == SIGTERM ) + { + T2Info(("SIGTERM received!\n")); + } + else + { + T2Info(("SIGKILL received!\n")); + } terminate(); exit(0); } @@ -248,6 +259,7 @@ void sig_handler(int sig, siginfo_t* info, void* uc) exit(0); } } + T2Info("%s --out\n", __FUNCTION__); } static void t2DaemonMainModeInit( ) From 43e58c8be6c9a052ed1490aac05f7d0ef817ab74 Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:16:34 +0530 Subject: [PATCH 07/12] RDKEMW-7226: Update xconfclient.c --- source/xconf-client/xconfclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/xconf-client/xconfclient.c b/source/xconf-client/xconfclient.c index 788ce80e..e751771d 100644 --- a/source/xconf-client/xconfclient.c +++ b/source/xconf-client/xconfclient.c @@ -1075,7 +1075,7 @@ static void* getUpdatedConfigurationThread(void *data) void uninitXConfClient() { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); pthread_mutex_lock(&xcThreadMutex); if(!stopFetchRemoteConfiguration) { @@ -1090,7 +1090,7 @@ void uninitXConfClient() else { pthread_mutex_unlock(&xcThreadMutex); - T2Debug("XConfClientThread is stopped already\n"); + T2Info("XConfClientThread is stopped already\n"); } pthread_mutex_lock(&xcThreadMutex); if(isXconfInit) From d61670ed1f297fdb688efbb90392f93c20a572bb Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:27:28 +0530 Subject: [PATCH 08/12] RDKEMW-7226: Update t2markers.c --- source/bulkdata/t2markers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/bulkdata/t2markers.c b/source/bulkdata/t2markers.c index 20bb3b3e..98f27c37 100644 --- a/source/bulkdata/t2markers.c +++ b/source/bulkdata/t2markers.c @@ -114,13 +114,13 @@ T2ERROR clearT2MarkerComponentMap() T2ERROR destroyT2MarkerComponentMap() { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); pthread_mutex_lock(&t2MarkersMutex); hash_map_destroy(markerCompMap, freeT2Marker); markerCompMap = NULL; pthread_mutex_unlock(&t2MarkersMutex); pthread_mutex_destroy(&t2MarkersMutex); - T2Debug("%s --out\n", __FUNCTION__); + T2Info("%s --out\n", __FUNCTION__); return T2ERROR_SUCCESS; } From b284c48b2107df64d8e71ee2d45ca36641fc2b24 Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:30:20 +0530 Subject: [PATCH 09/12] RDKEMW-7226: Update scheduler.c --- source/scheduler/scheduler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/scheduler/scheduler.c b/source/scheduler/scheduler.c index 2a8930f3..15a03cb0 100644 --- a/source/scheduler/scheduler.c +++ b/source/scheduler/scheduler.c @@ -481,7 +481,7 @@ void uninitScheduler() size_t index = 0; SchedulerProfile *tProfile = NULL; - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); if (!sc_initialized) { @@ -523,7 +523,7 @@ void uninitScheduler() } //timeoutNotificationCb = NULL; Not Needed as we are in the shutdown sequence - T2Debug("%s --out\n", __FUNCTION__); + T2Info("%s --out\n", __FUNCTION__); } T2ERROR registerProfileWithScheduler(const char* profileName, unsigned int timeInterval, unsigned int activationTimeout, bool deleteonTimeout, bool repeat, bool reportOnUpdate, unsigned int firstReportingInterval, char *timeRef) From 8f96aca3a9f4468fab9f9da53a4b549ced73854d Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 17:14:22 +0530 Subject: [PATCH 10/12] RDKEMW-7226: Update datamodel.c --- source/bulkdata/datamodel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/bulkdata/datamodel.c b/source/bulkdata/datamodel.c index a9f5f892..15f2d282 100644 --- a/source/bulkdata/datamodel.c +++ b/source/bulkdata/datamodel.c @@ -390,7 +390,7 @@ T2ERROR datamodel_init(void) void datamodel_unInit(void) { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); pthread_mutex_lock(&rpMutex); stopProcessing = true; @@ -409,5 +409,5 @@ void datamodel_unInit(void) pthread_mutex_destroy(&tmpRpMutex); pthread_cond_destroy(&tmpRpCond); - T2Debug("%s --out\n", __FUNCTION__); + T2Info("%s --out\n", __FUNCTION__); } From 177d5511a95ee14b96fd6ab0795d774aacb0e53f Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 17:21:32 +0530 Subject: [PATCH 11/12] RDKEMW-7226: Update profile.c --- source/bulkdata/profile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/bulkdata/profile.c b/source/bulkdata/profile.c index 1b0cf593..0a036aaf 100644 --- a/source/bulkdata/profile.c +++ b/source/bulkdata/profile.c @@ -1280,7 +1280,7 @@ T2ERROR disableProfile(const char *profileName, bool *isDeleteRequired) T2ERROR deleteAllProfiles(bool delFromDisk) { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); int count = 0; int profileIndex = 0; @@ -1351,13 +1351,13 @@ T2ERROR deleteAllProfiles(bool delFromDisk) } pthread_mutex_lock(&plMutex); - T2Debug("Deleting all profiles from the profileList\n"); + T2Info("Deleting all profiles from the profileList\n"); Vector_Destroy(profileList, freeProfile); profileList = NULL; Vector_Create(&profileList); pthread_mutex_unlock(&plMutex); - T2Debug("%s --out\n", __FUNCTION__); + T2Info("%s --out\n", __FUNCTION__); return T2ERROR_SUCCESS; } @@ -1704,7 +1704,7 @@ hash_map_t *getProfileHashMap() T2ERROR uninitProfileList() { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); if(!initialized) { @@ -1728,7 +1728,7 @@ T2ERROR uninitProfileList() pthread_mutex_destroy(&reportLock); pthread_mutex_destroy(&plMutex); - T2Debug("%s --out\n", __FUNCTION__); + T2Info("%s --out\n", __FUNCTION__); return T2ERROR_SUCCESS; } From 1c4e949243145b9124a6d9e264a12ad7d340487c Mon Sep 17 00:00:00 2001 From: Yogeswaran K <166126056+yogeswaransky@users.noreply.github.com> Date: Thu, 9 Apr 2026 17:23:46 +0530 Subject: [PATCH 12/12] RDKEMW-7226: Update profilexconf.c --- source/bulkdata/profilexconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/bulkdata/profilexconf.c b/source/bulkdata/profilexconf.c index 3a8e8424..82fce465 100644 --- a/source/bulkdata/profilexconf.c +++ b/source/bulkdata/profilexconf.c @@ -679,7 +679,7 @@ T2ERROR ProfileXConf_init(bool checkPreviousSeek) T2ERROR ProfileXConf_uninit() { - T2Debug("%s ++in\n", __FUNCTION__); + T2Info("%s ++in\n", __FUNCTION__); if(!initialized || !singleProfile) { T2Info("profile list is not initialized yet, ignoring\n"); @@ -692,7 +692,7 @@ T2ERROR ProfileXConf_uninit() pthread_mutex_unlock(&singleProfile->reportInProgressMutex); if(reportInProgress) { - T2Debug("Waiting for final report before uninit\n"); + T2Info("Waiting for final report before uninit\n"); pthread_mutex_lock(&plMutex); pthread_cond_signal(&reuseThread); pthread_mutex_unlock(&plMutex); @@ -709,7 +709,7 @@ T2ERROR ProfileXConf_uninit() /* Destroy condition variable at module uninit, after all threads are stopped */ pthread_cond_destroy(&reuseThread); pthread_mutex_destroy(&plMutex); - T2Debug("%s --out\n", __FUNCTION__); + T2Info("%s --out\n", __FUNCTION__); return T2ERROR_SUCCESS; }