#include <urcu/arch.h>
-#ifdef __linux__
-#include <syscall.h>
-#endif
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
{
unsigned long tidx = (unsigned long)data;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
}
tot_nr_reads[tidx] = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
{
unsigned long wtidx = (unsigned long)data;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
tot_nr_writes[wtidx] = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
{
unsigned long tidx = (unsigned long)data;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
}
tot_nr_reads[tidx] = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
unsigned long wtidx = (unsigned long)data;
long tidx;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
tot_nr_writes[wtidx] = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(), (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
-#ifdef __linux__
-#include <syscall.h>
-#endif
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
+#include "thread-id.h"
#include <urcu.h>
cycles_t time1, time2;
long tidx = (long)arg;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
sleep(2);
time1 = caa_get_cycles();
reader_time[tidx] = time2 - time1;
sleep(2);
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
long tidx;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
sleep(2);
for (i = 0; i < OUTER_WRITE_LOOP; i++) {
}
}
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
return ((void*)2);
}
tid_reader = malloc(sizeof(*tid_reader) * num_read);
tid_writer = malloc(sizeof(*tid_writer) * num_write);
- printf("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
per_thread_lock = malloc(sizeof(struct per_thread_lock) * NR_READ);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
}
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
*count = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
-#ifdef __linux__
-#include <syscall.h>
-#endif
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
+#include "thread-id.h"
#include <urcu.h>
int i, j;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
sleep(2);
time1 = caa_get_cycles();
reader_time[(unsigned long)arg] = time2 - time1;
sleep(2);
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
int i, j;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
sleep(2);
for (i = 0; i < OUTER_WRITE_LOOP; i++) {
}
}
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
return ((void*)2);
}
tid_reader = malloc(sizeof(*tid_reader) * num_read);
tid_writer = malloc(sizeof(*tid_writer) * num_write);
- printf("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
for (i = 0; i < NR_READ; i++) {
err = pthread_create(&tid_reader[i], NULL, thr_reader,
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
unsigned long long *count = _count;
int *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
unsigned long long *count = _count;
int *new, *old;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
*count = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long)gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
unsigned long long *count = _count;
struct test_array *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
unsigned long long *count = _count;
struct test_array *new, *old;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
*count = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
test_array = calloc(1, sizeof(*test_array) * ARRAY_SIZE);
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
unsigned long long *count = _count;
int *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
unsigned long long *count = _count;
int *new, *old;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
*count = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
unsigned long long *count = _count;
struct test_array *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
struct test_array *new, *old = NULL;
int ret;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
rcu_defer_unregister_thread();
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
tot_nr_writes[wtidx] = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
unsigned long long *count = _count;
struct test_array *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
struct test_array *new, *old;
#endif
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
tot_nr_writes[wtidx] = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
void *thr_count(void *arg)
{
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "counter", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "counter", urcu_get_thread_id());
rcu_register_thread();
write_pool_offset, write_pool_size);
printf_verbose("Number of hash chains: %lu.\n",
nr_hash_chains);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
if (!tid_reader) {
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
#define DEFAULT_HASH_SIZE 32
#define DEFAULT_MIN_ALLOC_SIZE 1
#define poison_free(ptr) free(ptr)
#endif
-
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
struct lfht_test_node *node;
struct cds_lfht_iter iter;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
- printf_verbose("readid : %lx, lookupfail %lu, lookupok %lu\n",
- (unsigned long) pthread_self(), URCU_TLS(lookup_fail),
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
+ printf_verbose("read tid : %lx, lookupfail %lu, lookupok %lu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(lookup_fail),
URCU_TLS(lookup_ok));
return ((void*)1);
struct wr_count *count = _count;
int ret;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
- printf_verbose("info id %lx: nr_add %lu, nr_addexist %lu, nr_del %lu, "
- "nr_delnoent %lu\n", (unsigned long) pthread_self(), URCU_TLS(nr_add),
- URCU_TLS(nr_addexist), URCU_TLS(nr_del),
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
+ printf_verbose("info tid %lu: nr_add %lu, nr_addexist %lu, nr_del %lu, "
+ "nr_delnoent %lu\n", urcu_get_thread_id(),
+ URCU_TLS(nr_add),
+ URCU_TLS(nr_addexist),
+ URCU_TLS(nr_del),
URCU_TLS(nr_delnoent));
count->update_ops = URCU_TLS(nr_writes);
count->add = URCU_TLS(nr_add);
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
- printf_verbose("readid : %lx, lookupfail %lu, lookupok %lu\n",
- (unsigned long) pthread_self(), URCU_TLS(lookup_fail),
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
+ printf_verbose("read tid : %lu, lookupfail %lu, lookupok %lu\n",
+ urcu_get_thread_id(), URCU_TLS(lookup_fail),
URCU_TLS(lookup_ok));
return ((void*)1);
int ret;
int loc_add_unique;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
- printf_verbose("info id %lx: nr_add %lu, nr_addexist %lu, nr_del %lu, "
- "nr_delnoent %lu\n", (unsigned long) pthread_self(), URCU_TLS(nr_add),
- URCU_TLS(nr_addexist), URCU_TLS(nr_del),
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
+ printf_verbose("info tid %lu: nr_add %lu, nr_addexist %lu, nr_del %lu, "
+ "nr_delnoent %lu\n", urcu_get_thread_id(),
+ URCU_TLS(nr_add),
+ URCU_TLS(nr_addexist),
+ URCU_TLS(nr_del),
URCU_TLS(nr_delnoent));
count->update_ops = URCU_TLS(nr_writes);
count->add = URCU_TLS(nr_add);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#endif
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "enqueuer", urcu_get_thread_id());
set_affinity();
count[0] = URCU_TLS(nr_enqueues);
count[1] = URCU_TLS(nr_successful_enqueues);
- printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
- "enqueues %llu successful_enqueues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_enqueues), URCU_TLS(nr_successful_enqueues));
+ printf_verbose("enqueuer thread_end, tid %lu, "
+ "enqueues %llu successful_enqueues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_enqueues),
+ URCU_TLS(nr_successful_enqueues));
return ((void*)1);
}
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "dequeuer", urcu_get_thread_id());
set_affinity();
}
rcu_unregister_thread();
- printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
- "dequeues %llu, successful_dequeues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues));
+ printf_verbose("dequeuer thread_end, tid %lu, "
+ "dequeues %llu, successful_dequeues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_dequeues),
+ URCU_TLS(nr_successful_dequeues));
count[0] = URCU_TLS(nr_dequeues);
count[1] = URCU_TLS(nr_successful_dequeues);
return ((void*)2);
duration, nr_enqueuers, nr_dequeuers);
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#endif
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "enqueuer", urcu_get_thread_id());
set_affinity();
count[0] = URCU_TLS(nr_enqueues);
count[1] = URCU_TLS(nr_successful_enqueues);
- printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
- "enqueues %llu successful_enqueues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_enqueues), URCU_TLS(nr_successful_enqueues));
+ printf_verbose("enqueuer thread_end, tid %lu, "
+ "enqueues %llu successful_enqueues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_enqueues),
+ URCU_TLS(nr_successful_enqueues));
return ((void*)1);
}
unsigned long long *count = _count;
unsigned int counter = 0;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "dequeuer", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
- printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
- "dequeues %llu, successful_dequeues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues));
+ printf_verbose("dequeuer thread_end, tid %lu, "
+ "dequeues %llu, successful_dequeues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_dequeues),
+ URCU_TLS(nr_successful_dequeues));
count[0] = URCU_TLS(nr_dequeues);
count[1] = URCU_TLS(nr_successful_dequeues);
return ((void*)2);
printf_verbose("External sync: none.\n");
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#endif
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "enqueuer", urcu_get_thread_id());
set_affinity();
count[0] = URCU_TLS(nr_enqueues);
count[1] = URCU_TLS(nr_successful_enqueues);
- printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
- "enqueues %llu successful_enqueues %llu\n",
- pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_enqueues), URCU_TLS(nr_successful_enqueues));
+ printf_verbose("enqueuer thread_end, tid %lu, "
+ "enqueues %llu successful_enqueues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_enqueues),
+ URCU_TLS(nr_successful_enqueues));
return ((void*)1);
}
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "dequeuer", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
- printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
- "dequeues %llu, successful_dequeues %llu\n",
- pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues));
+ printf_verbose("dequeuer thread_end, tid %lu, "
+ "dequeues %llu, successful_dequeues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_dequeues),
+ URCU_TLS(nr_successful_dequeues));
count[0] = URCU_TLS(nr_dequeues);
count[1] = URCU_TLS(nr_successful_dequeues);
return ((void*)2);
duration, nr_enqueuers, nr_dequeuers);
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#else
unsigned long long *count = _count;
int *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
unsigned long long *count = _count;
int *new, *old;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
*count = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#define _LGPL_SOURCE
#include <urcu-qsbr.h>
unsigned long long *count = _count;
struct test_array *local_ptr;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
set_affinity();
rcu_unregister_thread();
*count = URCU_TLS(nr_reads);
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
struct test_array *new, *old;
#endif
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
set_affinity();
loop_sleep(wdelay);
}
- printf_verbose("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
tot_nr_writes[wtidx] = URCU_TLS(nr_writes);
return ((void*)2);
}
duration, nr_readers, nr_writers);
printf_verbose("Writer delay : %lu loops.\n", wdelay);
printf_verbose("Reader duration : %lu loops.\n", rduration);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_reader = malloc(sizeof(*tid_reader) * nr_readers);
tid_writer = malloc(sizeof(*tid_writer) * nr_writers);
#include <errno.h>
#include <urcu/arch.h>
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
+#include "thread-id.h"
#define _LGPL_SOURCE
#include <urcu-qsbr.h>
struct test_array *local_ptr;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
sleep(2);
rcu_register_thread();
reader_time[(unsigned long)arg] = time2 - time1;
sleep(2);
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
struct test_array *new, *old;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
sleep(2);
for (i = 0; i < OUTER_WRITE_LOOP; i++) {
}
}
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
return ((void*)2);
}
tid_reader = malloc(sizeof(*tid_reader) * num_read);
tid_writer = malloc(sizeof(*tid_writer) * num_write);
- printf("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
for (i = 0; i < NR_READ; i++) {
err = pthread_create(&tid_reader[i], NULL, thr_reader,
#include <errno.h>
#include <urcu/arch.h>
-#ifdef __linux__
-#include <syscall.h>
-#endif
-
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
+#include "thread-id.h"
#define _LGPL_SOURCE
#include <urcu.h>
struct test_array *local_ptr;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
sleep(2);
rcu_register_thread();
reader_time[(unsigned long)arg] = time2 - time1;
sleep(2);
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "reader", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "reader", urcu_get_thread_id());
return ((void*)1);
}
struct test_array *new, *old;
cycles_t time1, time2;
- printf("thread_begin %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_begin %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
sleep(2);
for (i = 0; i < OUTER_WRITE_LOOP; i++) {
}
}
- printf("thread_end %s, thread id : %lx, tid %lu\n",
- "writer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread_end %s, tid %lu\n",
+ "writer", urcu_get_thread_id());
return ((void*)2);
}
tid_reader = malloc(sizeof(*tid_reader) * num_read);
tid_writer = malloc(sizeof(*tid_writer) * num_write);
- printf("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
for (i = 0; i < NR_READ; i++) {
err = pthread_create(&tid_reader[i], NULL, thr_reader,
#include <urcu/tls-compat.h>
#include <urcu/uatomic.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#endif
unsigned long long *count = _count;
bool was_nonempty;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "enqueuer", urcu_get_thread_id());
set_affinity();
count[0] = URCU_TLS(nr_enqueues);
count[1] = URCU_TLS(nr_successful_enqueues);
count[2] = URCU_TLS(nr_empty_dest_enqueues);
- printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
- "enqueues %llu successful_enqueues %llu, "
- "empty_dest_enqueues %llu\n",
- pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_enqueues),
- URCU_TLS(nr_successful_enqueues),
- URCU_TLS(nr_empty_dest_enqueues));
+ printf_verbose("enqueuer thread_end, tid %lu, "
+ "enqueues %llu successful_enqueues %llu, "
+ "empty_dest_enqueues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_enqueues),
+ URCU_TLS(nr_successful_enqueues),
+ URCU_TLS(nr_empty_dest_enqueues));
return ((void*)1);
}
unsigned long long *count = _count;
unsigned int counter = 0;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "dequeuer", urcu_get_thread_id());
set_affinity();
loop_sleep(rduration);
}
- printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
- "dequeues %llu, successful_dequeues %llu, "
- "nr_splice %llu\n",
- pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues),
- URCU_TLS(nr_splice));
+ printf_verbose("dequeuer thread_end, tid %lu, "
+ "dequeues %llu, successful_dequeues %llu, "
+ "nr_splice %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues),
+ URCU_TLS(nr_splice));
count[0] = URCU_TLS(nr_dequeues);
count[1] = URCU_TLS(nr_successful_dequeues);
count[2] = URCU_TLS(nr_splice);
printf_verbose("Wait for dequeuers to empty queue.\n");
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
#include <urcu/arch.h>
#include <urcu/tls-compat.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#endif
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "enqueuer", urcu_get_thread_id());
set_affinity();
count[0] = URCU_TLS(nr_enqueues);
count[1] = URCU_TLS(nr_successful_enqueues);
- printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
- "enqueues %llu successful_enqueues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_enqueues), URCU_TLS(nr_successful_enqueues));
+ printf_verbose("enqueuer thread_end, tid %lu, "
+ "enqueues %llu successful_enqueues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_enqueues),
+ URCU_TLS(nr_successful_enqueues));
return ((void*)1);
}
{
unsigned long long *count = _count;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "dequeuer", urcu_get_thread_id());
set_affinity();
loop_sleep(rduration);
}
- printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
- "dequeues %llu, successful_dequeues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues));
+ printf_verbose("dequeuer thread_end, tid %lu, "
+ "dequeues %llu, successful_dequeues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_dequeues),
+ URCU_TLS(nr_successful_dequeues));
count[0] = URCU_TLS(nr_dequeues);
count[1] = URCU_TLS(nr_successful_dequeues);
return ((void*)2);
duration, nr_enqueuers, nr_dequeuers);
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);
#include <urcu/tls-compat.h>
#include <urcu/uatomic.h>
#include "cpuset.h"
-
-#ifdef __linux__
-#include <syscall.h>
-#endif
+#include "thread-id.h"
/* hardcoded number of CPUs */
#define NR_CPUS 16384
-#if defined(_syscall0)
-_syscall0(pid_t, gettid)
-#elif defined(__NR_gettid)
-static inline pid_t gettid(void)
-{
- return syscall(__NR_gettid);
-}
-#else
-#warning "use pid as tid"
-static inline pid_t gettid(void)
-{
- return getpid();
-}
-#endif
-
#ifndef DYNAMIC_LINK_TEST
#define _LGPL_SOURCE
#endif
unsigned long long *count = _count;
bool was_nonempty;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "enqueuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "enqueuer", urcu_get_thread_id());
set_affinity();
count[0] = URCU_TLS(nr_enqueues);
count[1] = URCU_TLS(nr_successful_enqueues);
count[2] = URCU_TLS(nr_empty_dest_enqueues);
- printf_verbose("enqueuer thread_end, thread id : %lx, tid %lu, "
- "enqueues %llu successful_enqueues %llu, "
- "empty_dest_enqueues %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_enqueues),
- URCU_TLS(nr_successful_enqueues),
- URCU_TLS(nr_empty_dest_enqueues));
+ printf_verbose("enqueuer thread_end, tid %lu, "
+ "enqueues %llu successful_enqueues %llu, "
+ "empty_dest_enqueues %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_enqueues),
+ URCU_TLS(nr_successful_enqueues),
+ URCU_TLS(nr_empty_dest_enqueues));
return ((void*)1);
}
unsigned long long *count = _count;
unsigned int counter = 0;
- printf_verbose("thread_begin %s, thread id : %lx, tid %lu\n",
- "dequeuer", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread_begin %s, tid %lu\n",
+ "dequeuer", urcu_get_thread_id());
set_affinity();
loop_sleep(rduration);
}
- printf_verbose("dequeuer thread_end, thread id : %lx, tid %lu, "
- "dequeues %llu, successful_dequeues %llu "
- "pop_all %llu pop_last %llu\n",
- (unsigned long) pthread_self(),
- (unsigned long) gettid(),
- URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues),
- URCU_TLS(nr_pop_all),
- URCU_TLS(nr_pop_last));
+ printf_verbose("dequeuer thread_end, tid %lu, "
+ "dequeues %llu, successful_dequeues %llu "
+ "pop_all %llu pop_last %llu\n",
+ urcu_get_thread_id(),
+ URCU_TLS(nr_dequeues), URCU_TLS(nr_successful_dequeues),
+ URCU_TLS(nr_pop_all),
+ URCU_TLS(nr_pop_last));
count[0] = URCU_TLS(nr_dequeues);
count[1] = URCU_TLS(nr_successful_dequeues);
count[2] = URCU_TLS(nr_pop_all);
printf_verbose("Wait for dequeuers to empty stack.\n");
printf_verbose("Writer delay : %lu loops.\n", rduration);
printf_verbose("Reader duration : %lu loops.\n", wdelay);
- printf_verbose("thread %-6s, thread id : %lx, tid %lu\n",
- "main", (unsigned long) pthread_self(),
- (unsigned long) gettid());
+ printf_verbose("thread %-6s, tid %lu\n",
+ "main", urcu_get_thread_id());
tid_enqueuer = malloc(sizeof(*tid_enqueuer) * nr_enqueuers);
tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers);