S B
S B

Reputation: 8384

How to find out the number of CPUs in QT?

Is there a OS-independent function in QT for this?

There is this int QThread::idealThreadCount which returns the ideal number of threads but it does not tell anything about the number of processors

Upvotes: 3

Views: 6189

Answers (1)

cmannett85
cmannett85

Reputation: 22346

From the docs:

Returns the ideal number of threads that can be run on the system. This is done by querying the number of processor cores, both real and logical, in the system.

So it is wrong if you do not consider logical cores to be taken into account, in which case you must use platform-specific API calls.

Upvotes: 5

Related Questions