Back to index

numactl  2.0.8~rc4
Functions
distance.c File Reference
#include <numa.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

int main (void)

Function Documentation

int main ( void  )

Definition at line 6 of file distance.c.

{
       int numnodes, a, b;
       if (numa_available() < 0) {
              printf("no numa support in kernel\n");
              exit(1);
       }

        numnodes = numa_num_configured_nodes();
       for (a = 0; a < numnodes; a++) { 
              printf("%03d: ", a); 
              if (numa_distance(a, a) != 10) { 
                     printf("%d: self distance is not 10 (%d)\n", 
                            a, numa_distance(a,a));
                     exit(1);
              }
              for (b = 0; b < numnodes; b++) { 
                     int d1 = numa_distance(a, b); 
                     int d2 = numa_distance(b, a);
                     printf("%03d ", d1);
                     if (d1 != d2) {
                            printf("\n(%d,%d)->(%d,%d) wrong!\n",a,b,d1,d2); 
                            exit(1);
                     }
              }
              printf("\n");
       } 
       return 0;     
}

Here is the call graph for this function: