<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Arial;color: #000000;font-size: 10pt;"><br>
<div><font size="2" face="Tahoma" color="#000000"><b>From:</b> Joel Sherrill [joel@rtems.org]</font><br>
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div dir="ltr"><font size="2" face="Tahoma" color="#000000"><b>Sent:</b> Thursday, October 13, 2016 17:38<br>
<b>To:</b> Jakob Viketoft<br>
<b>Cc:</b> devel@rtems.org<br>
<b>Subject:</b> Re: Time spent in ticks...</font><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">>I don't have an or1k handy so ran on a sparc/erc32 simulator/
<div>>It is is a SPARC v7 at 15 Mhz. </div>
<div><br>
</div>
<div>>These times are in microseconds and based on the tmtests.</div>
<div>>Specifically tm08and tm27.</div>
<div><br>
</div>
<div>
<div>>(1) rtems_clock_tick: only case - 52</div>
</div>
<div>
<div>>(2) rtems interrupt: entry overhead returns to interrupted task - 12</div>
<div>>(3) rtems interrupt: exit overhead returns to interrupted task - 4</div>
<div>>(4) rtems interrupt: entry overhead returns to nested interrupt - 11</div>
<div>>(5) rtems interrupt: exit overhead returns to nested interrupt - 3</div>
</div>
<div><br>
</div>
<div>>The clock tick test has 100 tasks but it looks like they are blocked on a semaphore</div>
<div>>without timeout.</div>
<div><br>
</div>
<div>>Your times look WAY too high. Maybe the interrupt is stuck on and </div>
<div>>not being cleared. </div>
<div><br>
</div>
<div>>On the erc32, a nominal "nothing to do clock tick" would be 1+2+3 from</div>
<div>>above or 52+12+4 = 68 microseconds. 68 * 15 = 1020 machine cycles.</div>
<div>>So at a higher clock rate, it should be even less time.</div>
<div><br>
</div>
<div>>My gut feeling is that I think something is wrong with the ISR handler</div>
<div>>and it is stuck. But the performance is definitely way too high.</div>
<div><br>
</div>
<div>>--joel<br>
<br>
(Sorry if the format got somewhat I garbled, anything but top-posting have to be done manually...)<br>
<br>
I re-tested my case using an -O3 optimization (we have been using -O0 during development for debugging purposes) and I got a good performance boost, but I'm still nowhere near your numbers. I can vouch for that the interrupt (exception really) isn't stuck,
 but that the code unfortunately takes a long time to compute. I have a subsecond counter (1/16 of a second) which I'm sampling at various places in the code, storing its numbers to a buffer in memory so as to interfere with the program as little as possible.<br>
<br>
With -O3, a tick handling still takes ~320 us to perform, but the weight has now shifted. tc_windup takes ~214 us and the rest is obviously _Watchdog_Tick(). When fragmenting the tc_windup function to find the worst speed bumps the biggest contribution (~122
 us) seem to be coming from scale factor recalculation. Since it's 64 bits, it's turned into a software function which can be quite time-consuming apparently.<br>
<br>
Even though _Watchdog_Tick() "only" takes ~100 us now, it still sound much higher than your total tick with a slower system (we're running at 50 MHz).<br>
<br>
Is there anything we can do to improve these numbers? Is Clock_isr intended to be run uninterrupted as it is now? Can't see that much of the BSP patch code has anything to do with the speed of what I'm looking at right now...<br>
<br>
     /Jakob<br>
<br>
<br>
<font size="2"><font color="0000FF"><b><font face="Arial"><font color="000000">Jakob Viketoft<br>
</font></font></b></font><font face="Arial"><font color="000000">Senior Engineer in RTL and embedded software<br>
<br>
ÅAC Microtec AB<br>
Dag Hammarskjölds väg 48<br>
SE-751 83 Uppsala, Sweden<br>
<br>
T: +46 702 80 95 97<br>
http://www.aacmicrotec.com</font></font></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<div></div>
</div>
</div>
</body>
</html>