microsoft / Azure-Kinect-Sensor-SDK

A cross platform (Linux and Windows) user mode SDK to read data from your Azure Kinect device.
https://Azure.com/Kinect
MIT License
1.5k stars 621 forks source link

tracker::pop_result() low performance #1407

Closed sbr-dev closed 3 years ago

sbr-dev commented 4 years ago

Hi all,

This is more of a question than a bug report.

We integrated the azure kinect SDK for headtracking purpose. The integration works like a charm with our company tools.

However, we spotted a huge performance drop when connecting our libraries with 3rd party softwares. After some benchmark, we spotted the bottleneck: ka4bt::tracker::pop_result(); is the culprit. It seems this call freezes for some time the application and causes the FPS drop.

Am I missing something. What does it still hangs the app when called on a dedicated thread ??

Cheers,

qm13 commented 4 years ago

Without knowing anything about your company tools we are just guessing at the issue. One area to look at is memory transfer between the GPU and CPU.

sbr-dev commented 4 years ago

Hi @qm13 Thanks for your reply !

Indeed, it might be difficult for you to guess what happens without knowing the setup. I'm just asking for some advice or if something is wrong in the way I handle the kinect .

Datas transfer could be an issue, but neither the CPU nor the GPU are overloaded (25% and 80% respectively) The GPU bandwith usage is also in the usual limit.

Could it be related to the OpenGL context? What happens if I start the Kinect on the main thread and then I execute only some code on a dedicated thread? Is there any autonomatic context switch?

What's the data worflow of the kinect ? Is it Kinect -> CPU -> GPU ?

qm13 commented 4 years ago

@aspioupiou the perf tools especially GPU tools often do not take into account DMA orchestrated data transfers.

The data flow is Kinect -> CPU -> GPU