diff mbox

[v3,3/4] api: cpu: Renamed odp_sys_cpu_count to odp_cpu_count

Message ID 1423130234-6305-3-git-send-email-petri.savolainen@linaro.org
State Accepted
Commit e14083fb4e88bcbf9af4d4e59e2e3844d8bf5bb6
Headers show

Commit Message

Petri Savolainen Feb. 5, 2015, 9:57 a.m. UTC
This returns number of cpus available to ODP.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>
---
 example/generator/odp_generator.c        | 2 +-
 example/ipsec/odp_ipsec.c                | 2 +-
 example/l2fwd/odp_l2fwd.c                | 2 +-
 example/packet/odp_pktio.c               | 2 +-
 example/timer/odp_timer_test.c           | 2 +-
 include/odp/api/system_info.h            | 9 ---------
 platform/linux-generic/odp_linux.c       | 6 +++---
 platform/linux-generic/odp_system_info.c | 3 ++-
 test/api_test/odp_atomic_test.c          | 4 ++--
 test/api_test/odp_common.c               | 4 ++--
 test/api_test/odp_ring_test.c            | 2 +-
 test/api_test/odp_shm_test.c             | 2 +-
 test/performance/odp_scheduling.c        | 2 +-
 test/validation/odp_schedule.c           | 2 +-
 test/validation/odp_shm.c                | 2 +-
 test/validation/odp_synchronizers.c      | 2 +-
 test/validation/odp_system.c             | 6 +++---
 test/validation/odp_timer.c              | 2 +-
 18 files changed, 24 insertions(+), 32 deletions(-)
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index b073987..23976f3 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -876,7 +876,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "CPU count:       %i\n"
 	       "\n",
 	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
-	       odp_sys_cache_line_size(), odp_sys_cpu_count());
+	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
 	       "-----------------\n"
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 1defb8f..3d09804 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1483,7 +1483,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "CPU count:       %i\n"
 	       "\n",
 	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
-	       odp_sys_cache_line_size(), odp_sys_cpu_count());
+	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
 	       "-----------------\n"
diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c
index aeb55ff..2262624 100644
--- a/example/l2fwd/odp_l2fwd.c
+++ b/example/l2fwd/odp_l2fwd.c
@@ -561,7 +561,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "CPU count:       %i\n"
 	       "\n",
 	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
-	       odp_sys_cache_line_size(), odp_sys_cpu_count());
+	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
 	       "-----------------\n"
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 4c02ece..3f14c11 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -583,7 +583,7 @@  static void print_info(char *progname, appl_args_t *appl_args)
 	       "CPU count:       %i\n"
 	       "\n",
 	       odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(),
-	       odp_sys_cache_line_size(), odp_sys_cpu_count());
+	       odp_sys_cache_line_size(), odp_cpu_count());
 
 	printf("Running ODP appl: \"%s\"\n"
 	       "-----------------\n"
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 8274a44..f83b005 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -344,7 +344,7 @@  int main(int argc, char *argv[])
 	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
 	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
-	printf("Max CPU count:   %i\n",        odp_sys_cpu_count());
+	printf("Max CPU count:   %i\n",        odp_cpu_count());
 
 	printf("\n");
 
diff --git a/include/odp/api/system_info.h b/include/odp/api/system_info.h
index c14d654..e20e866 100644
--- a/include/odp/api/system_info.h
+++ b/include/odp/api/system_info.h
@@ -59,15 +59,6 @@  const char *odp_sys_cpu_model_str(void);
 int odp_sys_cache_line_size(void);
 
 /**
- * CPU count
- * Report the number of CPU's available to this ODP program.
- * This may be smaller than the number of (online) CPU's in the system.
- *
- * @return Number of available CPU's
- */
-int odp_sys_cpu_count(void);
-
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c
index d7da64a..2f95131 100644
--- a/platform/linux-generic/odp_linux.c
+++ b/platform/linux-generic/odp_linux.c
@@ -34,7 +34,7 @@  int odph_linux_cpumask_default(odp_cpumask_t *mask, int num_in)
 	int num = num_in;
 	int cpu_count;
 
-	cpu_count = odp_sys_cpu_count();
+	cpu_count = odp_cpu_count();
 
 	/*
 	 * If no user supplied number or it's too large, then attempt
@@ -100,7 +100,7 @@  void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl,
 
 	memset(thread_tbl, 0, num * sizeof(odph_linux_pthread_t));
 
-	cpu_count = odp_sys_cpu_count();
+	cpu_count = odp_cpu_count();
 
 	if (num < 1 || num > cpu_count) {
 		ODP_ERR("Bad num\n");
@@ -164,7 +164,7 @@  int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl,
 
 	memset(proc_tbl, 0, num * sizeof(odph_linux_process_t));
 
-	cpu_count = odp_sys_cpu_count();
+	cpu_count = odp_cpu_count();
 
 	if (num < 1 || num > cpu_count) {
 		ODP_ERR("Bad num\n");
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index d27c819..de52d49 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -8,6 +8,7 @@ 
 #include <odp_internal.h>
 #include <odp_debug_internal.h>
 #include <odp/align.h>
+#include <odp/cpu.h>
 #include <string.h>
 #include <stdio.h>
 
@@ -403,7 +404,7 @@  int odp_sys_cache_line_size(void)
 	return odp_system_info.cache_line_size;
 }
 
-int odp_sys_cpu_count(void)
+int odp_cpu_count(void)
 {
 	return odp_system_info.cpu_count;
 }
diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c
index ec4a8d8..6ccdc35 100644
--- a/test/api_test/odp_atomic_test.c
+++ b/test/api_test/odp_atomic_test.c
@@ -254,7 +254,7 @@  int main(int argc, char *argv[])
 			goto err_exit;
 		}
 		if (test_type < TEST_MIX || test_type > TEST_MAX ||
-		    pthrdnum > odp_sys_cpu_count() || pthrdnum < 0) {
+		    pthrdnum > odp_cpu_count() || pthrdnum < 0) {
 			usage();
 			goto err_exit;
 		}
@@ -262,7 +262,7 @@  int main(int argc, char *argv[])
 	}
 
 	if (pthrdnum == 0)
-		pthrdnum = odp_sys_cpu_count();
+		pthrdnum = odp_cpu_count();
 
 	test_atomic_init();
 	test_atomic_store();
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 5f9504c..f1a173c 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -46,7 +46,7 @@  void odp_print_system_info(void)
 	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
 	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
-	printf("CPU count:       %i\n",        odp_sys_cpu_count());
+	printf("CPU count:       %i\n",        odp_cpu_count());
 	printf("CPU mask:        %s\n",        str);
 
 	printf("\n");
@@ -62,7 +62,7 @@  int odp_test_global_init(void)
 		return -1;
 	}
 
-	num_workers = odp_sys_cpu_count();
+	num_workers = odp_cpu_count();
 	/* force to max CPU count */
 	if (num_workers > MAX_WORKERS)
 		num_workers = MAX_WORKERS;
diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c
index 157bdab..e8a962a 100644
--- a/test/api_test/odp_ring_test.c
+++ b/test/api_test/odp_ring_test.c
@@ -430,7 +430,7 @@  int main(int argc __attribute__((__unused__)),
 
 	odph_ring_tailq_init();
 
-	rarg.thrdarg.numthrds = odp_sys_cpu_count();
+	rarg.thrdarg.numthrds = odp_cpu_count();
 
 #ifdef RING_TEST_BASIC
 	rarg.thrdarg.testcase = ODP_RING_TEST_BASIC;
diff --git a/test/api_test/odp_shm_test.c b/test/api_test/odp_shm_test.c
index be83657..13d037d 100644
--- a/test/api_test/odp_shm_test.c
+++ b/test/api_test/odp_shm_test.c
@@ -58,7 +58,7 @@  int main(int argc __attribute__((__unused__)),
 	printf("test shared data at %p\n\n", test_shared_data);
 
 	thrdarg.testcase = ODP_SHM_TEST;
-	thrdarg.numthrds = odp_sys_cpu_count();
+	thrdarg.numthrds = odp_cpu_count();
 	odp_test_thread_create(run_thread, &thrdarg);
 
 	odp_test_thread_exit(&thrdarg);
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 820ac12..1932746 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -869,7 +869,7 @@  int main(int argc, char *argv[])
 	printf("CPU model:       %s\n",        odp_sys_cpu_model_str());
 	printf("CPU freq (hz):   %"PRIu64"\n", odp_sys_cpu_hz());
 	printf("Cache line size: %i\n",        odp_sys_cache_line_size());
-	printf("Max CPU count:   %i\n",        odp_sys_cpu_count());
+	printf("Max CPU count:   %i\n",        odp_cpu_count());
 
 	printf("\n");
 
diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c
index ba7ba4b..3035db8 100644
--- a/test/validation/odp_schedule.c
+++ b/test/validation/odp_schedule.c
@@ -602,7 +602,7 @@  static int schd_suite_init(void)
 
 	memset(globals, 0, sizeof(test_globals_t));
 
-	globals->cpu_count = odp_sys_cpu_count();
+	globals->cpu_count = odp_cpu_count();
 	if (globals->cpu_count > MAX_WORKERS)
 		globals->cpu_count = MAX_WORKERS;
 
diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c
index 4b1a38e..39dd8f0 100644
--- a/test/validation/odp_shm.c
+++ b/test/validation/odp_shm.c
@@ -65,7 +65,7 @@  static void test_odp_shm_sunnyday(void)
 	test_shared_data->foo = TEST_SHARE_FOO;
 	test_shared_data->bar = TEST_SHARE_BAR;
 
-	thrdarg.numthrds = odp_sys_cpu_count();
+	thrdarg.numthrds = odp_cpu_count();
 
 	if (thrdarg.numthrds > MAX_WORKERS)
 		thrdarg.numthrds = MAX_WORKERS;
diff --git a/test/validation/odp_synchronizers.c b/test/validation/odp_synchronizers.c
index 8786c69..ab9164f 100644
--- a/test/validation/odp_synchronizers.c
+++ b/test/validation/odp_synchronizers.c
@@ -1060,7 +1060,7 @@  int tests_global_init(void)
 	global_mem->g_iterations = MAX_ITERATIONS;
 	global_mem->g_verbose = VERBOSE;
 
-	core_count = odp_sys_cpu_count();
+	core_count = odp_cpu_count();
 
 	max_threads = (core_count >= MAX_WORKERS) ? MAX_WORKERS : core_count;
 
diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
index ab1608e..65f857a 100644
--- a/test/validation/odp_system.c
+++ b/test/validation/odp_system.c
@@ -30,11 +30,11 @@  static void test_odp_version_numbers(void)
 	CU_ASSERT(char_ok);
 }
 
-static void test_odp_sys_cpu_count(void)
+static void test_odp_cpu_count(void)
 {
 	int cpus;
 
-	cpus = odp_sys_cpu_count();
+	cpus = odp_cpu_count();
 	CU_ASSERT(0 < cpus);
 }
 
@@ -83,7 +83,7 @@  static void test_odp_sys_cpu_hz(void)
 
 CU_TestInfo test_odp_system[] = {
 	{"odp version",  test_odp_version_numbers},
-	{"odp_sys_cpu_count",  test_odp_sys_cpu_count},
+	{"odp_cpu_count",  test_odp_cpu_count},
 	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
 	{"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
 	{"odp_sys_page_size",  test_odp_sys_page_size},
diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index c0b6f67..5189301 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -258,7 +258,7 @@  static void test_odp_timer_all(void)
 	odp_timer_pool_param_t tparam;
 	/* This is a stressfull test - need to reserve some cpu cycles
 	 * @TODO move to test/performance */
-	int num_workers = min(odp_sys_cpu_count()-1, MAX_WORKERS);
+	int num_workers = min(odp_cpu_count()-1, MAX_WORKERS);
 
 	/* Create timeout pools */
 	params.tmo.num = (NTIMERS + 1) * num_workers;