Back to index

numactl  2.0.8~rc4
nodemap.c
Go to the documentation of this file.
00001 #include "numa.h"
00002 #include "bitops.h"
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 
00006 
00007 int main(void)
00008 {
00009        int i, k, w, ncpus;
00010        struct bitmask *cpus;
00011        int maxnode = numa_num_configured_nodes()-1;
00012 
00013        if (numa_available() < 0)  {
00014               printf("no numa\n");
00015               exit(1);
00016        }
00017        cpus = numa_allocate_cpumask();
00018        ncpus = cpus->size;
00019 
00020        for (i = 0; i <= maxnode ; i++) {
00021               if (numa_node_to_cpus(i, cpus) < 0) {
00022                      printf("node %d failed to convert\n",i); 
00023               }             
00024               printf("%d: ", i); 
00025               w = 0;
00026               for (k = 0; k < ncpus; k++)
00027                      if (numa_bitmask_isbitset(cpus, k))
00028                             printf(" %s%d", w>0?",":"", k);
00029               putchar('\n');              
00030        }
00031        return 0;
00032 }