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

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

commit 4ee6c62c9d14ba0cd2086333b8f8e4cdd18471f8
Author: Marco Casaroli <[email protected]>
AuthorDate: Tue Nov 3 17:32:09 2026 +0100

    arch/arm64/qemu: Give up_perf_init() the 1 GHz rate of the QEMU PMU.
    
    QEMU counts the PMU cycle counter (PMCCNTR_EL0) at a fixed 1 GHz, with
    TCG and with HVF.  qemu_boot.h gives up_perf_init() 62.5 MHz, so
    perf_convert() and the CPU-time clocks of SCHED_CRITMONITOR run 16
    times too fast: a busy loop of 200 ms gives 3200 ms of CPU time.
    
    Set CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC to 1 GHz.  In arch/arm64/src/qemu
    only up_perf_init() uses it.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 arch/arm64/src/qemu/qemu_boot.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/src/qemu/qemu_boot.h b/arch/arm64/src/qemu/qemu_boot.h
index 760155e049f..63a235530d2 100644
--- a/arch/arm64/src/qemu/qemu_boot.h
+++ b/arch/arm64/src/qemu/qemu_boot.h
@@ -38,7 +38,9 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
-#define CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC  62500000
+/* QEMU counts the PMU cycle counter (PMCCNTR_EL0) at 1 GHz */
+
+#define CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC  1000000000
 
 /****************************************************************************
  * Public Function Prototypes

Reply via email to