How can i learn if am using all of my cores in the maximum level

121 Views Asked by At

I have a time-critical application which processes a sequence of images coming from camera. It is written in C++ and it uses Qt, OpenCV and boost libraries. It is going to run on a dedicated PC.

Currently, the gui functions in main thread and i open a new thread for image processing. I didn't bother to divide the process section into threads because i think OpenCV is already doing that. However, i am having trouble maintaining the maximum tolerable delay.

My question is, how can i learn if my application using all the cores in the maximum level ? When i look at the performance monitor, the pattern i see is really strange. The CPU usage is likely %35-40, all the cores are working but not at a full throttle.

Am i doing something wrong ?

1

There are 1 best solutions below

0
On

You are not doing anything wrong, however you could change your code to take full use of the cpu cores by:

1 - setting the core affinity so that the thread does not change from one core to another, this could improve the cache usage (L1 and maybe L2)

2 - setting the scheduling of threads to FIFO so it does not get context-switched before finishing its processing

3 - run that thread on a higher priority process (this would require root privilege for the process)

Cheers