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__); } 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; } 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; } 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; } 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) diff --git a/source/telemetry2_0.c b/source/telemetry2_0.c index bb92e5a6..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,6 +110,10 @@ T2ERROR initTelemetry() static void terminate() { + T2Info("%s ++in\n", __FUNCTION__); + struct timespec t2, t_start; + clock_gettime(CLOCK_MONOTONIC, &t_start); + if(remove("/tmp/.t2ReadyToReceiveEvents") != 0) { printf("removing the file /tmp/.t2ReadyToReceiveEvents failed!\n"); @@ -131,6 +136,10 @@ static void terminate() ReportProfiles_uninit(); http_pool_cleanup(); } + 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) @@ -165,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; @@ -217,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); } @@ -241,6 +259,7 @@ void sig_handler(int sig, siginfo_t* info, void* uc) exit(0); } } + T2Info("%s --out\n", __FUNCTION__); } static void t2DaemonMainModeInit( ) 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)