QB64 Phoenix Edition
Looking for a solution to determine the thread count via API - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Looking for a solution to determine the thread count via API (/showthread.php?tid=2580)



Looking for a solution to determine the thread count via API - SagaraS - 04-06-2024

Hi,

I'm looking for a solution to display a MAX thread count in QB64 via API.

I'm writing a settings tool for another application and somehow need a solution to determine the maximum number of threads on the current computer.

I would be happy if someone could help me solve this via API.

The config parameter help says:
"# Display_ExtraScalerThreads=auto/0/1/... - number of extra threads used for advanced scaling. Auto means number of threads based on number of cpu cores."


RE: Looking for a solution to determine the thread count via API - SpriggsySpriggs - 04-06-2024

I'm not at home right now but if I remember, I could look into this with you. I'm generally the API guy around here.


RE: Looking for a solution to determine the thread count via API - SagaraS - 04-06-2024

Code: (Select All)
DECLARE DYNAMIC LIBRARY "KERNEL32"
  FUNCTION GetMaximumProcessorCount% ALIAS "GetMaximumProcessorCount" (_
    Byval GroupNumber as integer)
END DECLARE

DIM CPUthreads AS INTEGER

PRINT GetMaximumProcessorCount(CPUthreads)

I think I have found a useful solution.
At least for my purposes for now.

But those are the CPU cores, or are they for the threads?

Because the threads refer to the CPU cores.

If an i7 980 now has 6 cores, it can have 12 threads.

It would be interesting how this can be determined via API.
So that you can display the max cores and max threads separately.


RE: Looking for a solution to determine the thread count via API - a740g - 04-06-2024

(04-06-2024, 05:22 PM)SagaraS Wrote:
Code: (Select All)
DECLARE DYNAMIC LIBRARY "KERNEL32"
  FUNCTION GetMaximumProcessorCount% ALIAS "GetMaximumProcessorCount" (_
    Byval GroupNumber as integer)
END DECLARE

DIM CPUthreads AS INTEGER

PRINT GetMaximumProcessorCount(CPUthreads)

I think I have found a useful solution.
At least for my purposes for now.

But those are the CPU cores, or are they for the threads?

Because the threads refer to the CPU cores.

If an i7 980 now has 6 cores, it can have 12 threads.

It would be interesting how this can be determined via API.
So that you can display the max cores and max threads separately.
I think the following should help.

GetLogicalProcessorInformation function (sysinfoapi.h) - Win32 apps | Microsoft Learn


RE: Looking for a solution to determine the thread count via API - SpriggsySpriggs - 04-08-2024

I regret to inform you that I indeed did forget to do this