Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cpu_get_max(3) [osf1 man page]

cpu_get_info(3) 					     Library Functions Manual						   cpu_get_info(3)

NAME
cpu_get_info, cpu_get_num, cpu_get_max - Query CPU information for the platform (libc library) SYNOPSIS
#include <cpuset.h> int cpu_get_info( ncpu_info_t *info ); int cpu_get_num( void ); int cpu_get_max( void ); PARAMETERS
Points to an ncpu_info_t buffer to receive the CPU information for the booted configuration. DESCRIPTION
The cpu_get_info() function returns the following information about the platform CPU configuration in the buffer pointed to by the info parameter: Revision number. Maximum number of CPUs supported by the machine architecture. CPU processor set that is physically plugged into the system and recognized by the system console. Set of online CPUs in the caller's partition; that is, the set of CPUs on which the caller can schedule work. Set of CPUs in the partition that have processes bound to them. Set of CPUs in the partition whose processor set is marked for exclusive use. The CPU sets specified in the ncpu_info_t structure must have been created by the caller prior to the call. If the caller specifies zero for a CPU set, the function silently ignores filling in data for that set. The information returned by the cpu_get_info() function is relative to the caller's partition. The cpu_get_num() function returns the actual number of CPUs available in the caller's partition. The cpu_get_max() function returns the maximum number of CPUs, including unpopulated CPU slots, that can be configured in the system. NOTES
A cpu_get_info() call is similar to a getsysinfo(GSI_CPU_INFO, ...) call. The principal difference is that the main ncpu_info_t struc- ture fields returned by cpu_get_info() are of type cpuset_t, whereas the same information returned by getsysinfo()is of type ulong_t. Fur- thermore, a getsysinfo(GSI_CPU_INFO, ...) call returns information only about the first n CPUs, where n is the number of bits in a ulong_t field, or (sizeof(ulong_t)*8). For cpu_get_info(), the ncpu_version field of the info argument must be set to NCPU_INFO_VERSION prior to the call. RESTRICTIONS
The information returned by these functions is a snapshot of the platform/partition configuration at the time the information is sampled. The data may be stale by the time the caller uses the information. RETURN VALUES
The cpu_get_info() function returns the following values: Success. Failure. In this case, errno is set to indicate the error. The cpu_get_num() and cpu_get_max() functions return values as stated in the DESCRIPTION. These functions always complete successfully. ERRORS
The cpu_get_info() function fails, it sets errno to one of the following values: The info argument or one of the cpuset_t elements, points to an invalid address. One or more of the cpuset_t elements of the info argument points to an invalid CPU set, possibly one that was not created by cpusetcreate(). The version number specified in the ncpu_version field of the info argument is not recognized by the system. SEE ALSO
Functions: cpusetops(3), numa_intro(3) cpu_get_info(3)

Check Out this Related Man Page

cpusetops(3)						     Library Functions Manual						      cpusetops(3)

NAME
cpusetops, cpuaddset, cpuandset, cpucopyset, cpucountset, cpudelset, cpudiffset, cpuemptyset, cpufillset, cpuisemptyset, cupismember, cpuorset, cpusetcreate, cpusetdestroy, cpuxorset - Perform operations on CPU sets (libc library) SYNOPSIS
#include <cpuset.h> int cpuaddset( cpuset_t set, cpuid_t cpuid ); int cpuandset( cpuset_t set_src1, cpuset_t set_src2, cpuset_t set_dst ); int cpucopyset( cpuset_t set_src, cpuset_t set_dst ); int cpucountset( cpuset_t set ); int cpudelset( cpuset_t set, cpuid_t cpuid ); int cpudiffset( cpuset_t set_src1, cpuset_t set_src2, cpuset_t set_dst ); int cpuemptyset( cpuset_t set ); int cpufillset( cpuset_t set ); int cpuisemptyset( cpuset_t set ); int cpuismember( cpuset_t set, cpuid_t cpuid ); int cpuorset( cpuset_t set_src1, cpuset_t set_src2, cpuset_t set_dst ); int cpusetcreate( cpuset_t *set ); int cpusetdestroy( cpuset_t *set ); int cpuxorset( cpuset_t set_src1, cpuset_t set_src2, cpuset_t set_dst ); PARAMETERS
Identifies a CPU. Specifies or points to a CPU set. Specifies a CPU set that is being copied to or that is the result of a logical OR, XOR, or AND operation on two other CPU sets. Specifies a CPU set that is being copied to another CPU set or that is part of a logical OR, XOR, or AND operation with another CPU set. DESCRIPTION
The cpusetops primitives manipulate sets of CPUs, by operating on data objects (of type cpuset_t) that are created by cpusetcreate(). The cpusetcreate() function allocates, and sets to empty, a CPU set pointed to by set. The cpusetdestroy() function releases the memory that was obtained by cpusetcreate() for the specified CPU set pointed to by set. The cpucountset() function returns the number of members in the CPU set specified by set. The cpuemptyset() function initializes the CPU set specified by set, such that no CPUs are included in the set. The cpufillset() function initializes the CPU set specified by set, such that all CPUs that are currently configured in the caller's parti- tion are included in the set. The cpuismember() function tests whether the CPU specified by the value of cpuid is a member of the CPU set specified by set. The cpuisemptyset() function tests whether the CPU set specified by the set is empty. The cpucopyset() function copies the contents of the CPU set specified by set_src to the CPU set specified by set_dst. The cpuaddset() and cpudelset() functions respectively add or delete the individual CPU specified by the value of cpuid to or from the CPU set specified by set. The cpuandset(), cpuorset(), and cpuxorset() functions perform a logical AND, OR, or XOR operation, respectively, on the CPU sets specified by set_src1 and set_src2, storing the result in the CPU set specified by set_dst. The cpudiffset() function finds the logical difference between the CPU sets specified by set_src1 and set_src2, storing the result in the CPU set specified by set_dst. (The result is made up of members that are included in set_src1 but not in set_src2.) RETURN VALUES
These functions return the following values: Success (returned by all functions). For cpuisemptyset() and cpuismember() only, 0 also means the condition being tested is false; that is, the specified CPU set is not empty or does not contain the specified member. Success (returned by cpuisemptyset() and cpuismember()only). This return value also means the condition being tested is true; that is, the specified CPU set is empty or contains the specified member. Failure (returned by all functions). In this case, errno is set to indicate the error. ERRORS
The cpuaddset(), cpuandset(), cpucopyset(), cpucountset(), cpudelset(), cpudiffset(), cpuemptyset(), cpufillset(), cpuisemptyset(), cpuis- member(), cpuorset(), and cpuxorset() functions set errno to the following value for the corresponding condition: The value of a set or set_* argument is invalid (possibly is not a CPU set created bycpusetcreate()). The cpusetcreate() and cpusetdestroy() functions set errno to one of the the following values for the corresponding condition: The address of the specified CPU set is invalid. For cpusetcreate() only, no memory could be allocated for the specified CPU set. If the cpuaddset(), cpudelset(), and cpuismember() functions fail, they set errno to the following value for the reason specified: The value of cpuid is an invalid or unsupported CPU identifier. EXAMPLES
The following example demonstrates a variety of CPU set operations: #include <cpuset.h> int main() { cpuset_t cpuset, cpuset2; /* Create cpusets - initialized as empty */ cpusetcreate(&cpuset); cpusetcreate(&cpuset2); /* demonstrate cpuset operations */ /* add cpu 0 to cpuset */ if (cpuaddset(cpuset, 0) == -1) { perror("cpuaddset"); return 0; } /* copy cpuset to cpuset2 */ if (cpucopyset(cpuset, cpuset2) == -1) { perror("cpucopyset"); return 0; } if (cpuaddset(cpuset, 1) == -1) { /* add cpu 1 to cpuset */ perror("cpuaddset"); return 0; } /* difference of cpuset and cpuset2, store in cpuset */ if (cpudiffset(cpuset, cpuset2, cpuset) == -1) { perror("cpudiffset"); return 0; } /* Enumerate cpuset. */ while (1) { cpuid_t id; int flags = SET_CURSOR_CONSUME; cpu_cursor_t cpu_cursor = SET_CURSOR_INIT; id = cpu_foreach(cpuset, flags, &cpu_cursor); if (id == CPU_NONE) { printf(" "); break; } else { printf("%3d ", id); } } /* Destroy cpuset */ cpusetdestroy(&cpuset); cpusetdestroy(&cpuset2); return 0; } SEE ALSO
Functions: cpu_foreach(3), numa_intro(3) Files: numa_types(4) cpusetops(3)
Man Page