LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

C plugin function call overhead on real-time system

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.

0 Kudos
Message 1 of 2
(3,270 Views)

I'm sorry. I realized that when the build configuration was changed to Release, the directory where the DLL is saved was changed, and I didn't notice and was copying the old Debug version to the RT system. Now all the plugin calls take less than 90 us.

 

I couldn't find a way to delete the topic. How could I do that ?

0 Kudos
Message 2 of 2
(3,261 Views)