Extremely high CPU usage when using libpicohrdl with ADC-24.

Post your Linux discussions here
Post Reply
ehliar
Newbie
Posts: 0
Joined: Tue Mar 26, 2019 8:44 am

Extremely high CPU usage when using libpicohrdl with ADC-24.

Post by ehliar » Tue Mar 26, 2019 12:42 pm

Ok, so I have now managed to get a small program up and running which is essentially a slightly modified version of picohrdlCon.c. The main loop basically looks like this:

Code: Select all

while(1) {
    CollectSingleBlocked();
}
However, even though I only get roughly one measurement per second picohrdlCon is using 40% CPU. By using strace it seems as if the library busy-waits until data arrives from the USB bus.

To avoid this I tried to modify CollectStreaming() instead under the theory that the library was not really optimized for the CollectSingleBlocked() use-case. However, when I call HRDLGetValues() it still seems as if the library uses busy-waiting since I now manage to get up to 100% CPU usage. (At least if I remove the 2000ms sleep.)

Unlike the other issues I mentioned in a few previous posts I really do not see any feasible way to get close to real-time data with the current software library without paying a huge price in CPU-usage. Do you have any advice here?

Hitesh
PICO STAFF
PICO STAFF
Posts: 2855
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Extremely high CPU usage when using libpicohrdl with ADC-24.

Post by Hitesh » Wed Apr 03, 2019 8:36 am

Hi ehliar,

This is an issue that we have been made aware of previously and has recently been fixed in the driver. I am unable to advise when the fix will be made available but do check for updates to the driver package in a few weeks.

Regards,
Hitesh

Software Dev. Engineer

Post Reply