<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Norbert,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you for your answer !</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Yes, I am using a Xenomai cobalt - xenomai is 3.1</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important">cat
/proc/xenomai/version => 3.1</span><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:14.6667px;background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style=""><font color="#201f1e"><span style="font-size: 14.6667px;">After the installation, I tested "test tools" in /proc/xenomai/ and it worked nice.</span></font></div>
<div style=""><font color="#201f1e"><span style="font-size: 14.6667px;"><br>
</span></font></div>
<div style=""><font color="#201f1e"><span style="font-size: 14.6667px;">What do you mean by "it might deadlock really good" ?</span></font></div>
<div style=""><font color="#201f1e"><span style="font-size: 14.6667px;"><br>
</span></font></div>
<div style=""><font color="#201f1e"><span style="font-size: 14.6667px;">Cheers,</span></font></div>
<div style=""><font color="#201f1e"><span style="font-size: 14.6667px;"><br>
</span></font></div>
<div>
<div id="Signature">
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:12pt">
<p></p>
</div>
</div>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> Norbert Lange <nolange79@gmail.com><br>
<b>Envoyé :</b> jeudi 20 mai 2021 10:20<br>
<b>À :</b> MONTET Julien <julien.montet@reseau.eseo.fr><br>
<b>Cc :</b> lttng-dev@lists.lttng.org <lttng-dev@lists.lttng.org><br>
<b>Objet :</b> Re: [lttng-dev] LTTng - Xenomai : different results between timestamp-lttng and rt_time_read()</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am Do., 20. Mai 2021 um 09:58 Uhr schrieb MONTET Julien via lttng-dev<br>
<lttng-dev@lists.lttng.org>:<br>
><br>
> Hi the developers !<br>
><br>
> CONTEXT<br>
> I am currently working on a Raspberry pi 3B with Xenomai and LTTng tools.<br>
> Raspbian 10.9 Buster - kernel 4.19.85<br>
> uname -a : Linux raspberrypi 4.19.85-v7+ #5 SMP PREEMPT Wed May 12 10:13:37<br>
> Both tools are working, but I wonder about the accuracy of LTTng libraries.<br>
><br>
><br>
> METHOD<br>
> The code used is quite simple, it is written with the alchemy skin.<br>
> A rt_task_spawn calls a function that has rt_task_set_periodic(NULL, TM_NOW, period) and rt_task_wait_period(NULL).<br>
> ->The rt_task_set_periodic is based on 1ms.<br>
> ->The rt_task_wait_period(NULL) is of course inside a while loop (see below at the very end).<br>
><br>
> My goal is to get accurate traces from Xenomai.<br>
> I took two methods to do so :<br>
> -> lttng<br>
> -> basic calculation based on rt_timer_read()<br>
><br>
> What a surprise when I found both method have two different results.<br>
> -> LTTng shows me traces [0.870;1.13] ms (or even less precise)<br>
> -> rt_time_read shows me traces [0.980;1.020] ms<br>
><br>
> Thing to note :<br>
> -> The use of LTTng has no influence on rt_time_read(), you can use both methods at the same time.<br>
><br>
> Then, I saved the output of rt_time_read inside a tracepoint.<br>
> It appeared the LTTng is always called at the right time because the value got by rt_time_read () is really good.<br>
><br>
><br>
> QUESTIONS<br>
> These are now my questions :<br>
> - What is the method I should trust ?<br>
> - I have searched on the forum and I found LTTng uses a MONOTONIC clock for the timestamp. Can/Should I modify it ?<br>
><br>
><br>
> CODE<br>
> -----------------------------------------------------------------------<br>
> A small part of my function called by rt_task_spawn :<br>
> [...]<br>
> RTIME period = 1000*1000; // in ns<br>
> RTIME now;<br>
> RTIME previous = 0;<br>
> RTIME duration;<br>
> [...]<br>
> while(1)<br>
> {<br>
> overruns = 0;<br>
> err = rt_task_wait_period(&overruns);<br>
> now = rt_timer_read();<br>
> tracepoint(tp_provider, tracepoint_tick_ms, now, "tick");<br>
><br>
> if (previous != 0)<br>
> {<br>
> duration=now-previous;<br>
> rt_printf("%llu\n \n", duration/1000);<br>
> }<br>
> previous=now;<br>
> [...]<br>
> }<br>
<br>
Are you using the Xenomai kernel ("Cobalt"), or just skins via<br>
copperplate ("Mercury")?<br>
You have some file /proc/xenomai/version?<br>
<br>
The Xenomai kernel has his own clock, which in general is not<br>
correlated to the linux monotonic clock.<br>
(Under some circumstances it might be identical).<br>
<br>
My plan is to use a clock plugin for Lttng, particularly because if<br>
lttng uses the linux monotonic clock from a realtime thread<br>
it might deadlock really good ;)<br>
<br>
Norbert<br>
</div>
</span></font></div>
</body>
</html>