JianyuWang0623 commented on PR #18840: URL: https://github.com/apache/nuttx/pull/18840#issuecomment-4467575615
This PR removes a real obstacle I hit while prototyping a switch to `CNTPCT` for `up_perf_gettime()` (under `CONFIG_ARM_HAVE_PTM=y`). The motivation for that prototype is to give the note/trace subsystem a monotonic, fixed-frequency timestamp instead of the 32-bit PMU cycle counter. The blocker I ran into is purely a type-width issue: `up_perf_gettime()` returns `clock_t`, and under `CONFIG_SYSTEM_TIME64=n` (still the default on most boards) `clock_t` is `uint32_t`, so the 64-bit `CNTPCT` value silently truncates and the "no wrap-around" benefit disappears — at a 62.5 MHz generic-timer frequency the truncated counter wraps every ~68.7 s, which is actually worse than the PMU path with `PERF_OVERFLOW_CORRECTION`. This PR makes that whole class of problem go away: `clock_t` unconditionally 64-bit means any 64-bit hardware counter source can flow through `up_perf_gettime()` without truncation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
