-
Notifications
You must be signed in to change notification settings - Fork 20
RDKEMW-10467: Fix Invalid time values caused by drift #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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_REALTIMEtoCLOCK_MONOTONICto prevent clock drift from affecting duration calculations - Improved log messages in
profilexconf.cfor 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.
|
Code changes looks good to me. |
Coverity Issue - Data race conditionAccessing "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 Issue locationThis issue was discovered outside the diff for this Pull Request. You can find it at: |
| else | ||
| { | ||
| T2Error("Unsupported encoding format : %s\n", profile->encodingType); | ||
| } |
There was a problem hiding this comment.
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
source/bulkdata/profile.c
Outdated
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); | ||
| } |
There was a problem hiding this comment.
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
source/bulkdata/profilexconf.c
Outdated
There was a problem hiding this comment.
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); | ||
| } |
There was a problem hiding this comment.
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
source/bulkdata/profile.c
Outdated
There was a problem hiding this comment.
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
There was a problem hiding this 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"); |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
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.
| T2Warning("Error in Fetching the time Elapsed"); | |
| T2Warning("Failed to get time from clock_gettime()"); |
| clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime); | ||
| if (clockReturn) | ||
| { | ||
| T2Warning("Error in Fetching the time Elapsed"); |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
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.
| T2Warning("Error in Fetching the time Elapsed"); | |
| T2Warning("Failed to get time from clock_gettime()"); |
| clockReturn |= clock_gettime(CLOCK_MONOTONIC, &endTime); | ||
| if(clockReturn) | ||
| { | ||
| T2Warning("Error in Fetching the time Elapsed"); |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
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.
| T2Warning("Error in Fetching the time Elapsed"); | |
| T2Warning("Failed to get time from clock_gettime()"); |
…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
9a7e5ba to
d048d01
Compare
There was a problem hiding this 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.
| int clockReturn = 0; | ||
| clockReturn = clock_gettime(CLOCK_MONOTONIC, &startTime); |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
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.
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