Test qsbr debug
[urcu.git] / test_qsbr.c
index dc871dc118ee9c82d5fd1676533eef1751552844..6830fe1d2c1c77f144f1f28760bf2a2123cff2c4 100644 (file)
@@ -35,6 +35,9 @@
 
 #include "arch.h"
 
+/* Make this big enough to include the POWER5+ L3 cacheline size of 256B */
+#define CACHE_LINE_SIZE 4096
+
 #if defined(_syscall0)
 _syscall0(pid_t, gettid)
 #elif defined(__NR_gettid)
@@ -339,10 +342,26 @@ int main(int argc, char **argv)
        printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
                        "main", pthread_self(), (unsigned long)gettid());
 
-       if (use_affinity
-           && sched_setaffinity(0, sizeof(affinity), &affinity) < 0) {
-               perror("sched_setaffinity");
-               exit(-1);
+       if (use_affinity) {
+               for (i = 0; i < CPU_SETSIZE; i++)
+                       if (CPU_ISSET(i, &affinity))
+                               printf_verbose("About to set affinity "
+                                              "to CPU : %d\n", i);
+
+               if (sched_setaffinity(0, sizeof(affinity), &affinity) < 0) {
+                       perror("sched_setaffinity");
+                       exit(-1);
+               }
+
+               if (sched_getaffinity(0, sizeof(affinity), &affinity) < 0) {
+                       perror("sched_getaffinity");
+                       exit(-1);
+               }
+
+               for (i = 0; i < CPU_SETSIZE; i++)
+                       if (CPU_ISSET(i, &affinity))
+                               printf_verbose("Effectively set affinity "
+                                              "to CPU : %d\n", i);
        }
 
        test_array = malloc(sizeof(*test_array) * ARRAY_SIZE);
This page took 0.025234 seconds and 4 git commands to generate.