countProcessors
Syntax
- int countProcessors(void)
Arguments
- none
Return
- Returns the number of physical and/or logical processors on your system, as reported by the Windows GetSystemInfo API.
Description
- Lets you know the number of processors you have at your disposal to perform useful work. The process count includes each separate physical cpu, or each core within a multicore cpu, or the two logical cpus within a Hyper-Threaded cpu.
Example
%ffp
OnFilterStart:
{
int ncpu = countProcessors();
Info ("This system has %d available processor%s.", ncpu, ncpu==1?"":"s");
return false; //continue processing
}
Also see
- System Functions, Multithreading Functions, triggerThread, waitForThread, isThreadActive, getThreadRetVal, terminateThread
Comments
- It would be nice to have an API that gives additional info about the processors, such as which ones are physical, which are logical, which logical processors reside on the same H-T or multicore processor, etc.
- Everyone can add her comments about her experiences with this function here. Tips for using it are welcome, too.