OS/2 codes: How to get information about CPUs
OS/2 provides various APIs to get information of CPU, from number of CPUs to CPU time snapshot. 1. Number of CPUs 1.1 DosQuerySysInfo( QSV_NUMPROCESSORS ) DosQuerySysInfo() returns the requested system information. If passing QSV_NUMPROCESSORS , number of CPUs are returned to the buffer. Look: DosQuerySysInfo( QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &ulCpus, sizeof( ulCpus )) 1.2 DosGetProcessorStatus() DosGetProcessorStatus() returns the status of the given CPU ID starting from 1. If CPU ID is valid, that is, ID-th CPU exists, it returns PROC_ONLINE or PROC_OFFLINE according to the status of that CPU. PROC_ONLINE means that the given CPU is available for running work. PROC_OFFLINE means that the given CPU is not available. Whereas the given CPU does not exist, it returns an error, ERROR_INVALID_PARAMETER . After all, number of CPUs can be caculated if counting from 1 unt...