Back to index

numactl  2.0.8~rc4
getnodemask.c
Go to the documentation of this file.
00001 #include <sched.h>
00002 #include <sys/types.h>
00003 #include <unistd.h>
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 #include <numa.h>
00007 
00008 int main(int argc, char *argv[])
00009 {
00010        nodemask_t nodemask;
00011        int rc, i;
00012 
00013        rc = numa_available();
00014        printf("numa_available returns %d\n", rc);
00015        if (rc < 0) exit(1);
00016 
00017        nodemask_zero(&nodemask);
00018 
00019        nodemask = numa_get_run_node_mask();
00020        for (i = 0; i < 4; i++) {
00021               printf("numa_get_run_node_mask nodemask_isset returns=0x%lx\n", nodemask_isset(&nodemask, i));
00022        }
00023 
00024 
00025        rc = numa_run_on_node_mask(&nodemask);
00026        printf("rc=%d from numa_run_on_node_mask\n", rc);
00027 
00028        return (0);
00029 }