This returns system specific cpu id.
Signed-off-by: Petri Savolainen <[email protected]>
---
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(-)
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 0df041f..8274a44 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -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_id());
/*
* Find the pool
diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index d6016cb..844f45a 100644
--- a/include/odp/api/thread.h
+++ b/include/odp/api/thread.h
@@ -29,14 +29,6 @@ extern "C" {
*/
int odp_thread_id(void);
-
-/**
- * Get CPU number
- *
- * @return CPU number where the thread is currently running
- */
-int odp_thread_cpu(void);
-
/**
* @}
*/
diff --git a/platform/linux-generic/odp_thread.c
b/platform/linux-generic/odp_thread.c
index e66b8c1..ac8c9de 100644
--- a/platform/linux-generic/odp_thread.c
+++ b/platform/linux-generic/odp_thread.c
@@ -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_id(void)
{
return this_thread->cpu;
}
diff --git a/test/performance/odp_scheduling.c
b/test/performance/odp_scheduling.c
index 98c060e..820ac12 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -610,7 +610,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_id());
shm = odp_shm_lookup("test_globals");
globals = odp_shm_addr(shm);
diff --git a/test/validation/odp_synchronizers.c
b/test/validation/odp_synchronizers.c
index 3361835..8786c69 100644
--- a/test/validation/odp_synchronizers.c
+++ b/test/validation/odp_synchronizers.c
@@ -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_id();
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_id() + 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_id() + 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_id() + 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_id() + 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_id() + 1;
per_thread_mem = thread_init();
global_mem = per_thread_mem->global_mem;
iterations = global_mem->g_iterations;
--
2.2.2
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp