* [Xenomai-core] native rt_timer questions
@ 2008-09-03 9:39 Fillod Stephane
2008-09-03 10:16 ` Gilles Chanteperdrix
2008-09-21 18:10 ` Gilles Chanteperdrix
0 siblings, 2 replies; 3+ messages in thread
From: Fillod Stephane @ 2008-09-03 9:39 UTC (permalink / raw)
To: xenomai-core
Hi!
Why rt_timer functions, esp. rt_timer_tsc(), are not inlined in
user-space
(with CONFIG_XENO_HW_DIRECT_TSC) ? Is it because some policy insists
that every library function must have an overridable symbol?
Even a branch is worrisome when doing repetitive micro-measurements.
What about a patch along the following? or an extern inline?
--- include/native/timer.h 15 May 2008 07:40:30 -0000
+++ include/native/timer.h 3 Sep 2008 09:10:31 -0000
@@ -46,7 +52,7 @@
extern "C" {
#endif
-#if (defined(__KERNEL__) || defined(__XENO_SIM__)) &&
!defined(DOXYGEN_CPP)
+#if (defined(__KERNEL__) || defined(__XENO_SIM__) ||
defined(__NATIVE_INLINE)) && !defined(DOXYGEN_CPP)
static inline SRTIME rt_timer_ns2tsc(SRTIME ns)
{
return xnarch_ns_to_tsc(ns);
BTW, I had the bad surprise of rt_timer_read() doing a syscall, which
is costly when doing fine measurement. Should it be documented?
The native rt_timer functions are documented in two locations:
http://www.xenomai.org/documentation/branches/v2.4.x/html/api/include_2n
ative_2timer_8h.html
http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__nat
ive__timer.html
Could they be gathered, maybe with the here below patch (untested, no
doxy expert):
--- include/native/timer.h 15 May 2008 07:40:30 -0000
+++ include/native/timer.h 3 Sep 2008 09:10:31 -0000
@@ -17,6 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
+ *
+ * \ingroup native_timer
*/
#ifndef _XENO_TIMER_H
@@ -26,6 +28,10 @@
#define TM_ONESHOT XN_APERIODIC_TICK
+/** Structure containing timer-information useful to users.
+ *
+ * @see rt_timer_inquire()
+ */
typedef struct rt_timer_info {
RTIME period; /* !< Current status (unset, aperiodic, period).
*/
--
Stephane
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-core] native rt_timer questions
2008-09-03 9:39 [Xenomai-core] native rt_timer questions Fillod Stephane
@ 2008-09-03 10:16 ` Gilles Chanteperdrix
2008-09-21 18:10 ` Gilles Chanteperdrix
1 sibling, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2008-09-03 10:16 UTC (permalink / raw)
To: Fillod Stephane; +Cc: xenomai-core
Fillod Stephane wrote:
> Hi!
>
> Why rt_timer functions, esp. rt_timer_tsc(), are not inlined in
> user-space
> (with CONFIG_XENO_HW_DIRECT_TSC) ? Is it because some policy insists
> that every library function must have an overridable symbol?
> Even a branch is worrisome when doing repetitive micro-measurements.
> What about a patch along the following? or an extern inline?
>
> --- include/native/timer.h 15 May 2008 07:40:30 -0000
> +++ include/native/timer.h 3 Sep 2008 09:10:31 -0000
> @@ -46,7 +52,7 @@
> extern "C" {
> #endif
> -#if (defined(__KERNEL__) || defined(__XENO_SIM__)) &&
> !defined(DOXYGEN_CPP)
> +#if (defined(__KERNEL__) || defined(__XENO_SIM__) ||
> defined(__NATIVE_INLINE)) && !defined(DOXYGEN_CPP)
> static inline SRTIME rt_timer_ns2tsc(SRTIME ns)
> {
> return xnarch_ns_to_tsc(ns);
I am afraid we do not want this on every architecture. On ARM where the
tsc is an emulation and contains a fair number of instructions using a
fair number of registers (still faster than a syscall, of course), I
think we do want an out of line function.
>
> BTW, I had the bad surprise of rt_timer_read() doing a syscall, which
> is costly when doing fine measurement. Should it be documented?
I suggested once to use the tsc as well for the implementation of
clock_gettime(CLOCK_REALTIME) (the posix equivalent of rt_timer_read()),
but was told at the time that we may want, one day, to provide syscalls
to compensate for clock drifts, so reading the system clock should
remain a syscall.
--
Gilles.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xenomai-core] native rt_timer questions
2008-09-03 9:39 [Xenomai-core] native rt_timer questions Fillod Stephane
2008-09-03 10:16 ` Gilles Chanteperdrix
@ 2008-09-21 18:10 ` Gilles Chanteperdrix
1 sibling, 0 replies; 3+ messages in thread
From: Gilles Chanteperdrix @ 2008-09-21 18:10 UTC (permalink / raw)
To: Fillod Stephane; +Cc: xenomai-core
Fillod Stephane wrote:
> The native rt_timer functions are documented in two locations:
> http://www.xenomai.org/documentation/branches/v2.4.x/html/api/include_2n
> ative_2timer_8h.html
> http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__nat
> ive__timer.html
>
> Could they be gathered, maybe with the here below patch (untested, no
> doxy expert):
Fixed, thanks ! But your MUA mangles patches (by adding newlines), so,
you should rather send them as attachments.
--
Gilles.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-21 18:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-03 9:39 [Xenomai-core] native rt_timer questions Fillod Stephane
2008-09-03 10:16 ` Gilles Chanteperdrix
2008-09-21 18:10 ` Gilles Chanteperdrix
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.