This is an automated email from the ASF dual-hosted git repository.

jiuzhudong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit a89b7f7add20594258c30b995b3e6527c9839a94
Author: hujun5 <[email protected]>
AuthorDate: Thu Aug 28 09:55:27 2025 +0800

    clock: remove 64-bit perf support for 32-bit systems
    
    Remove atomic64-based 64-bit perf counter support for 32-bit systems
    where atomic64 operations are unavailable, simplifying userspace perf
    implementation to avoid unsupported atomic operations.
    
    Signed-off-by: hujun5 <[email protected]>
---
 libs/libc/sched/clock_perf.c | 50 --------------------------------------------
 1 file changed, 50 deletions(-)

diff --git a/libs/libc/sched/clock_perf.c b/libs/libc/sched/clock_perf.c
index 097d85bd0d7..d4b08f49562 100644
--- a/libs/libc/sched/clock_perf.c
+++ b/libs/libc/sched/clock_perf.c
@@ -24,61 +24,13 @@
  * Included Files
  ****************************************************************************/
 
-#include <stdint.h>
-
 #include <nuttx/arch.h>
-#include <nuttx/bits.h>
 #include <nuttx/clock.h>
 
-#if defined(CONFIG_PERF_OVERFLOW_CORRECTION) && ULONG_MAX != UINT64_MAX
-
-/****************************************************************************
- * Preprocessors
- ****************************************************************************/
-
-#define MASK_LO        GENMASK_ULL(31, 0)
-#define MASK_HI        GENMASK_ULL(63, 32)
-
-#define LO(x)          (uint32_t)((x) & MASK_LO)
-#define HI(x)          (uint32_t)(((x) & MASK_HI) >> 32)
-
-#define PACK64(hi,lo)  ((MASK_LO & (lo)) | (((uint64_t)(hi)) << 32))
-#define CLOCK_T(p)     (LO(p) | ((clock_t)HI(p) << \
-                                 CONFIG_ARCH_PERF_COUNT_BITWIDTH))
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static atomic64_t g_perf;  /* hi word is overflow, lo word is last */
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
-/****************************************************************************
- * perf_gettime
- ****************************************************************************/
-
-clock_t perf_gettime(void)
-{
-  uint64_t snap;
-  uint64_t result;
-  clock_t now;
-
-  do
-    {
-      snap = atomic64_read(&g_perf);
-      now = up_perf_gettime();
-      result = PACK64(now < LO(snap) ? HI(snap) + 1 : HI(snap), now);
-    }
-  while (!atomic64_try_cmpxchg(&g_perf, &snap, result));
-
-  return CLOCK_T(result);
-}
-
-#else
-
 /****************************************************************************
  * perf_gettime
  ****************************************************************************/
@@ -87,5 +39,3 @@ clock_t perf_gettime(void)
 {
   return up_perf_gettime();
 }
-
-#endif

Reply via email to