Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

C plugin function call overhead on real-time system

$
0
0

Hello NI forum members.

 

I'm developing a real-time application (32-bit) on a PXIe-8115 machine (Phar Lap ETS 13.1 operating system) for control of robotic devices. In order to deal with the variety of hardware interfaces that our robots use, I'm working on a plugin system, to load a different DLL (that implements a defined interface) according to the type of robot we are using. The functions implemented by each DLL include sensors (i.e. joint encoder) reading, control algorithms (step) and actuation (write control setpoint to joint motor), that need to run on a tight loop, every 5ms.

 

Using the RT time measurement functions ( GetTimeUS() ), I can verify that the loop itself (which runs in an independent thread) takes around 1us, and calling just an empty plugin function (does nothing and return) adds almost 500 us to its duration. For a single joint robot (3 sensors read + robot control step + joint control step + motor write), simple empty functions cost me more than 3ms, leaving not much room for more processing and actuators.

 

I was expecting the overhead of a indirect (function pointer) call, which would be the same of a direct call without inlining optimizations, but it is taking much more. I got similar results on LabWindows/CVI 2013 and 2015, and, in comparison, runned similar tests on a Linux system (with clock_gettime() ), where the overhead for dynamically linked library function call was in the range of nanoseconds.

 

Is there something particular about this system that I should know in this case ? Could be a way to alleviate the problem ?

 

 

Sorry for possibly bad English and thanks in advance.


Viewing all articles
Browse latest Browse all 5339

Trending Articles