Skip to content

Conversation

@shivabhaskar
Copy link
Contributor

Reason for Change: Changing CLOCK_REALTIME to CLOCK_MONOTONIC to avoid clock drifts impact in the calculations
Test Procedure: When Telemetry report generation is in progress change the time. The processing time should have a valid value
Risks: Low
Priority: P1

Copilot AI review requested due to automatic review settings November 19, 2025 11:46
@shivabhaskar shivabhaskar requested a review from a team as a code owner November 19, 2025 11:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes invalid time values in telemetry report generation caused by system clock drift by changing timing measurements from CLOCK_REALTIME to CLOCK_MONOTONIC.

  • Changed all elapsed time measurements from CLOCK_REALTIME to CLOCK_MONOTONIC to prevent clock drift from affecting duration calculations
  • Improved log messages in profilexconf.c for better clarity and consistency

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
source/bulkdata/profilexconf.c Updated three clock_gettime calls to use CLOCK_MONOTONIC for measuring start time, processing time, and elapsed time; improved log messages for execution count and processing time
source/bulkdata/profile.c Updated two clock_gettime calls to use CLOCK_MONOTONIC for measuring start and end times of report collection and generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dharshini555
Copy link
Contributor

Code changes looks good to me.

@rdkcmf-jenkins
Copy link
Contributor

Coverity Issue - Data race condition

Accessing "profile->grepSeekProfile->execCounter" without holding lock "plMutex". Elsewhere, "_GrepSeekProfile.execCounter" is written to with "plMutex" held 2 out of 2 times.

Medium Impact, CWE-366
MISSING_LOCK

Issue location

This issue was discovered outside the diff for this Pull Request. You can find it at:
source/bulkdata/profile.c:339

else
{
T2Error("Unsupported encoding format : %s\n", profile->encodingType);
}
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

{
encodeEventMarkersInJSON(valArray, profile->eMarkerList);
}
profile->grepSeekProfile->execCounter += 1;
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

else
{
T2Warning("Failed to save grep config to file for profile: %s\n", profile->name);
}
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

else
{
T2Error("Unsupported encoding format : %s\n", profile->encodingType);
}
Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

Copy link
Contributor

@rdkcmf-jenkins rdkcmf-jenkins Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity issue no longer present as of: undefined

Show issue

Coverity Issue - Unchecked return value

Calling "clock_gettime" without checking return value (as is done elsewhere 1 out of 1 times).

Medium Impact, CWE-252
CHECKED_RETURN

Copilot AI review requested due to automatic review settings November 24, 2025 12:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime);
if(clockReturn)
{
T2Warning("Error in Fetching the time Elapsed");
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "Error in Fetching the time Elapsed" is grammatically incorrect and unclear. Consider revising to "Error fetching elapsed time" or "Failed to get time from clock_gettime()" to be more concise and accurate.

Suggested change
T2Warning("Error in Fetching the time Elapsed");
T2Warning("Failed to get time from clock_gettime()");

Copilot uses AI. Check for mistakes.
clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime);
if (clockReturn)
{
T2Warning("Error in Fetching the time Elapsed");
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "Error in Fetching the time Elapsed" is grammatically incorrect and unclear. Consider revising to "Error fetching elapsed time" or "Failed to get time from clock_gettime()" to be more concise and accurate.

Suggested change
T2Warning("Error in Fetching the time Elapsed");
T2Warning("Failed to get time from clock_gettime()");

Copilot uses AI. Check for mistakes.
clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime);
if(clockReturn)
{
T2Warning("Error in Fetching the time Elapsed");
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message "Error in Fetching the time Elapsed" is grammatically incorrect and unclear. Consider revising to "Error fetching elapsed time" or "Failed to get time from clock_gettime()" to be more concise and accurate.

Suggested change
T2Warning("Error in Fetching the time Elapsed");
T2Warning("Failed to get time from clock_gettime()");

Copilot uses AI. Check for mistakes.
…ONIC

Reason for Change: Changing CLOCK_REALTIME to CLOCK_MONOTONIC to avoid clock drifts impact in the calculations
Test Procedure: When Telemetry report generation is in progress change the time. The processing time should have a valid value
Risks: Low
Priority: P1
Copilot AI review requested due to automatic review settings December 17, 2025 21:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +250 to +251
int clockReturn = 0;
clockReturn = clock_gettime(CLOCK_MONOTONIC, &startTime);
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of the first clock_gettime call is not checked. If the first call fails, clockReturn will be non-zero, but the code continues execution. This could lead to using uninitialized startTime values in later calculations. Consider checking the return value immediately after the first call or initializing clockReturn to ensure both calls are checked properly.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants