diff --git a/source/bulkdata/profile.c b/source/bulkdata/profile.c index f5d9bb17..27e2872b 100644 --- a/source/bulkdata/profile.c +++ b/source/bulkdata/profile.c @@ -349,8 +349,7 @@ static void* CollectAndReport(void* data) struct timespec endTime; struct timespec elapsedTime; char* customLogPath = NULL; - - + int clockReturn = 0; T2ERROR ret = T2ERROR_FAILURE; if( profile->name == NULL || profile->encodingType == NULL || profile->protocol == NULL ) @@ -374,7 +373,7 @@ static void* CollectAndReport(void* data) T2Info("%s ++in profileName : %s\n", __FUNCTION__, profile->name); - clock_gettime(CLOCK_REALTIME, &startTime); + clockReturn = clock_gettime(CLOCK_MONOTONIC, &startTime); if( !strcmp(profile->encodingType, "JSON") || !strcmp(profile->encodingType, "MessagePack")) { JSONEncoding *jsonEncoding = profile->jsonEncoding; @@ -749,9 +748,16 @@ static void* CollectAndReport(void* data) { T2Error("Unsupported encoding format : %s\n", profile->encodingType); } - clock_gettime(CLOCK_REALTIME, &endTime); - getLapsedTime(&elapsedTime, &endTime, &startTime); - T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long )elapsedTime.tv_sec, elapsedTime.tv_nsec); + clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime); + if(clockReturn) + { + T2Warning("Error in Fetching the time Elapsed"); + } + else + { + getLapsedTime(&elapsedTime, &endTime, &startTime); + T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long )elapsedTime.tv_sec, elapsedTime.tv_nsec); + } if(ret == T2ERROR_SUCCESS && jsonReport) { free(jsonReport); diff --git a/source/bulkdata/profilexconf.c b/source/bulkdata/profilexconf.c index 69c94d04..09e00ce8 100644 --- a/source/bulkdata/profilexconf.c +++ b/source/bulkdata/profilexconf.c @@ -247,8 +247,8 @@ static void* CollectAndReportXconf(void* data) T2Info("%s ++in profileName : %s\n", __FUNCTION__, profile->name); } - - clock_gettime(CLOCK_REALTIME, &startTime); + int clockReturn = 0; + clockReturn = clock_gettime(CLOCK_MONOTONIC, &startTime); if(profile->encodingType != NULL && !strcmp(profile->encodingType, "JSON")) { if(T2ERROR_SUCCESS != initJSONReportXconf(&profile->jsonReportObj, &valArray)) @@ -304,13 +304,21 @@ static void* CollectAndReportXconf(void* data) encodeEventMarkersInJSON(valArray, profile->eMarkerList); } profile->grepSeekProfile->execCounter += 1; - T2Info("Execution Count = %d\n", profile->grepSeekProfile->execCounter); + T2Info("Xconf Profile Execution Count = %d\n", profile->grepSeekProfile->execCounter); ret = prepareJSONReport(profile->jsonReportObj, &jsonReport); destroyJSONReport(profile->jsonReportObj); profile->jsonReportObj = NULL; - clock_gettime(CLOCK_REALTIME, &endTime); - T2Info("Processing time for profile %s is %ld seconds\n", profile->name, (long)(endTime.tv_sec - startTime.tv_sec)); + clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime); + if(clockReturn) + { + T2Warning("Error in Fetching the time Elapsed"); + } + else + { + T2Info("%s Xconf Profile Processing Time in seconds : %ld\n", profile->name, (long)(endTime.tv_sec - startTime.tv_sec)); + } + if(ret != T2ERROR_SUCCESS) { T2Error("Unable to generate report for : %s\n", profile->name); @@ -451,9 +459,17 @@ static void* CollectAndReportXconf(void* data) T2Warning("Failed to save grep config to file for profile: %s\n", profile->name); } #endif - clock_gettime(CLOCK_REALTIME, &endTime); - getLapsedTime(&elapsedTime, &endTime, &startTime); - T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long)elapsedTime.tv_sec, elapsedTime.tv_nsec); + clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime); + if (clockReturn) + { + T2Warning("Error in Fetching the time Elapsed"); + } + else + { + getLapsedTime(&elapsedTime, &endTime, &startTime); + T2Info("Elapsed Time for : %s = %lu.%lu (Sec.NanoSec)\n", profile->name, (unsigned long)elapsedTime.tv_sec, elapsedTime.tv_nsec); + } + if(jsonReport) { free(jsonReport);