On Wed, Mar 22, 2017 at 8:45 AM, Charles Steinkuehler < char...@steinkuehler.net> wrote:
> > Note you might need an -rt or -xenomai kernel to achieve reliable > operation, I've seen the non-rt kernels occasionally "wander off into > the weeds" for several hundred mS at a time. > > -- > Charles Steinkuehler > char...@steinkuehler.net > > "Wander off into the weeds . . ." I get a kick out of that expression every time I see it in this context. I do agree with Charles, and would like to add that you need to pay close attention to which C, and Linux API function calls you use in your application. Function calls such as printf() which can be handy for quick and dirty text debugging can slow your code down considerably. However, if you pipe the output of such an application into a file. You'll notice a huge performance improvement with that single trick alone. Anything related to threading, file locks( poll(), etc ), etc through Linux API calls is also going to slow you down. Certainly there is more, but these are the three things I've personally tested, and can think of off the top of my head. Also, under certain conditions, using usleep() in your code where you're using a busy wait loop, can help some, but at other times it could potentially backfire. Depending on how busy your system is. Either way though, a busy wait loop without using usleep(), or giving CPU time back to the system will wind up using ~95% processor time. Until "preempted". Just remember that there is only have one core / thread to work with. You may also need to slim down unneeded processes, services, and kernel modules that are loaded / running by default on a stock beaglebone Linux image. As all of this will be compete for CPU time, which you may not be able to afford, in order to have your application perform as well as you'd like. Basically you need to profile your system, and see what you can get away with. So from personal experience, I can say with reasonable confidence that the maximum possible latency with an RT kernel is going to be around 50ms. But this number will be if your system is constantly "busy". If you system is extremely busy, it can be more. But I've had an application that was doing a lot of processing in code, but was only using up to 5% processor time. Because I was giving processor time back to the system by using usleep(). But anyway, if you need "real-time" an RT kernel could work fine. Depending on your definition of the term. If you need deterministic, you may need to use xenomai, move into the kernel, or potentially both. I would probably start by profiling your system to see what all is running in the background, and if everything you do have running is necessary. After that, try installing an RT kernel. -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CALHSORo3sfr_N%2BCuJ%3DK_9kEAQP5Ash-FJzKCwzy4bJgVdHHR_g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.