<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 20, 2021 at 9:54 AM Richi Dubey <<a href="mailto:richidubey@gmail.com">richidubey@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>We are thinking of writing a piece of code that takes some time to run (it would be amazing if it takes around 2 secs to run on hardware, but we would be happy with something that takes a few milliseconds as well). </div><div><br></div><div>We tried writing this:</div><div><br></div><div>  for(int i = 0; i<10000000; ++i){<br>      fib2 = fib0 + fib1;<br>      fib0 = fib1;<br>      fib1 = fib2;<br>  }<br></div><div><br></div><div>which takes few milliseconds when tested on qemu, but only takes few microseconds on a real board. Do you have any suggestions of what else we can do?</div><div><br></div><div>We want to write a code that is context switch safe (so, we can't simply check the time before a loop, run an infinite loop that keeps checking current time and stops after a few seconds - because this logic would fail if there happens a context switch inside the loop and the task gets the control back after a few seconds). We also don't want to do a wake_after() since we want the task to be running on the cpu during the entire time (it is okay if the task gets preempted due to a higher priority process), and not voluntarily giving the control to some other task.</div></div></blockquote><div><br></div><div>The crypt test takes a long time to run. You could lift cases from there until you hit the time you want. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Any suggestions? The aim is to see the affect of a task getting removed from the cpu due to task shifting by the newly arrived task (in strong apa vs non task shifting scheduler).</div><div><br></div><div>Thank you.</div></div>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div></div>