@@ -192,7 +192,7 @@ static void *run_thread(void *ptr)
args = ptr;
thr = odp_thread_id();
- printf("Thread %i starts on cpu %i\n", thr, odp_thread_cpu());
+ printf("Thread %i starts on cpu %i\n", thr, odp_cpu());
/*
* Find the pool
@@ -29,14 +29,6 @@ extern "C" {
*/
int odp_thread_id(void);
-
-/**
- * Get CPU number
- *
- * @return CPU ID where the thread is currently running
- */
-int odp_thread_cpu(void);
-
/**
* @}
*/
@@ -16,6 +16,7 @@
#include <odp_debug_internal.h>
#include <odp/shared_memory.h>
#include <odp/align.h>
+#include <odp/cpu.h>
#include <string.h>
#include <stdio.h>
@@ -118,7 +119,7 @@ int odp_thread_id(void)
}
-int odp_thread_cpu(void)
+int odp_cpu(void)
{
return this_thread->cpu;
}
@@ -606,7 +606,7 @@ static void *run_thread(void *arg)
thr = odp_thread_id();
- printf("Thread %i starts on CPU %i\n", thr, odp_thread_cpu());
+ printf("Thread %i starts on CPU %i\n", thr, odp_cpu());
shm = odp_shm_lookup("test_globals");
globals = odp_shm_addr(shm);
@@ -119,7 +119,7 @@ static per_thread_mem_t *thread_init(void)
per_thread_mem->delay_counter = 1;
per_thread_mem->thread_id = odp_thread_id();
- per_thread_mem->thread_core = odp_thread_cpu();
+ per_thread_mem->thread_core = odp_cpu();
global_shm = odp_shm_lookup(GLOBAL_SHM_NAME);
global_mem = odp_shm_addr(global_shm);
@@ -165,7 +165,7 @@ static uint32_t barrier_test(per_thread_mem_t *per_thread_mem,
uint32_t thread_num, slow_thread_num, next_slow_thread, num_threads;
uint32_t lock_owner_delay, barrier_cnt1, barrier_cnt2;
- thread_num = odp_thread_cpu() + 1;
+ thread_num = odp_cpu() + 1;
global_mem = per_thread_mem->global_mem;
num_threads = global_mem->g_num_threads;
iterations = BARRIER_ITERATIONS;
@@ -389,7 +389,7 @@ static void *no_lock_functional_test(void *arg UNUSED)
uint32_t thread_num, resync_cnt, rs_idx, iterations, cnt;
uint32_t sync_failures, current_errs, lock_owner_delay;
- thread_num = odp_thread_cpu() + 1;
+ thread_num = odp_cpu() + 1;
per_thread_mem = thread_init();
global_mem = per_thread_mem->global_mem;
iterations = global_mem->g_iterations;
@@ -460,7 +460,7 @@ static void *spinlock_functional_test(void *arg UNUSED)
uint32_t sync_failures, is_locked_errs, current_errs;
uint32_t lock_owner_delay;
- thread_num = odp_thread_cpu() + 1;
+ thread_num = odp_cpu() + 1;
per_thread_mem = thread_init();
global_mem = per_thread_mem->global_mem;
iterations = global_mem->g_iterations;
@@ -543,7 +543,7 @@ static void *ticketlock_functional_test(void *arg UNUSED)
uint32_t sync_failures, is_locked_errs, current_errs;
uint32_t lock_owner_delay;
- thread_num = odp_thread_cpu() + 1;
+ thread_num = odp_cpu() + 1;
per_thread_mem = thread_init();
global_mem = per_thread_mem->global_mem;
iterations = global_mem->g_iterations;
@@ -627,7 +627,7 @@ static void *rwlock_functional_test(void *arg UNUSED)
uint32_t thread_num, resync_cnt, rs_idx, iterations, cnt;
uint32_t sync_failures, current_errs, lock_owner_delay;
- thread_num = odp_thread_cpu() + 1;
+ thread_num = odp_cpu() + 1;
per_thread_mem = thread_init();
global_mem = per_thread_mem->global_mem;
iterations = global_mem->g_iterations;
This return system cpu number. Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org> --- example/timer/odp_timer_test.c | 2 +- include/odp/api/thread.h | 8 -------- platform/linux-generic/odp_thread.c | 3 ++- test/performance/odp_scheduling.c | 2 +- test/validation/odp_synchronizers.c | 12 ++++++------ 5 files changed, 10 insertions(+), 17 deletions(-)