diff mbox

[v2,2/4] api: cpu: Renamed odp_thread_cpu to odp_cpu_id

Message ID 1422961167-2307-2-git-send-email-petri.savolainen@linaro.org
State New
Headers show

Commit Message

Petri Savolainen Feb. 3, 2015, 10:59 a.m. UTC
This returns system specific cpu id.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 example/timer/odp_timer_test.c      |  2 +-
 include/odp/api/cpu.h               | 10 +++++-----
 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 ++++++------
 6 files changed, 15 insertions(+), 22 deletions(-)
diff mbox

Patch

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/cpu.h b/include/odp/api/cpu.h
index 16461a3..3ddd082 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -24,14 +24,14 @@  extern "C" {
 
 
 /**
- * CPU number
+ * CPU ID
  *
- * CPU number where the thread is currently running. CPU numbering is system
- * specific.
+ * Determine CPU ID on which the calling thread is running. CPU numbering is
+ * system specific.
  *
- * @return CPU number
+ * @return CPU ID
  */
-int odp_cpu(void);
+int odp_cpu_id(void);
 
 /**
  * CPU count
diff --git a/include/odp/api/thread.h b/include/odp/api/thread.h
index 469d298..97d5de7 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 ID 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 3d7167f..e03e673 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -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_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;