wangchdo commented on code in PR #17675:
URL: https://github.com/apache/nuttx/pull/17675#discussion_r2647631834


##########
Documentation/reference/os/time_clock.rst:
##########
@@ -665,87 +665,183 @@ require nanosecond-level task timing, which tick-based 
timers
 like wdog cannot provide. Reducing the tick interval to micro-
 or nanoseconds is impractical, as it would overload the CPU with interrupts.
 
-To address this, NuttX provides a high-resolution timer (hrtimer),
-which delivers true nanosecond-level precision. Unlike wdog’s list-based 
timers,
-hrtimer uses a red-black tree for efficient management of large numbers of 
timers,
-an important advantage in hard real-time systems like vehicle control.
+High-resolution Timer (HRTimer) is a timer abstraction capable of achieving
+nanosecond-level timing precision, primarily used in scenarios requiring
+high-precision clock events. With the advancement of integrated circuit
+technology, modern high-precision timer hardware, such as the typical x86
+HPET, can already meet sub-nanosecond timing requirements and offer
+femtosecond-level jitter control.
+
+Although the current hardware timer abstraction (`up_alarm/up_timer`)
+in the NuttX kernel already supports nanosecond-level timing, its software
+timer abstraction, wdog, and the timer timeout interrupt handling process
+remain at microsecond-level (tick) precision, which falls short of
+high-precision timing demands. Therefore, it is necessary to implement a
+new timer abstraction, HRTimer, to address the precision limitations of
+wdog. HRTimer primarily provides the following functional interfaces:
+
+**Set a timer in nanoseconds**: Configure a software timer to trigger at
+                                a specified nanosecond time.
+
+**Cancel a timer**: Cancel the software timer.
+
+**Handle timer timeout**: Execute timeout processing after the timer event
+                          is triggered.
+
+The new NuttX HRTimer is designed to address the issues of insufficient
+precision in the current NuttX wdog. It draws on the strengths of the Linux

Review Comment:
   HRTimer is not primarily about precision, but about resolution.
   
   In my view, your PR related to one-shot counting focuses on precision—that 
is, improving tick accuracy. In contrast, the hrtimer module should be 
understood as a mechanism for improving timer resolution, providing 
finer-grained time representation capability.



-- 
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]

Reply via email to