@@ -872,7 +872,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"
@@ -1461,7 +1461,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"
@@ -556,7 +556,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"
@@ -575,7 +575,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"
@@ -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");
@@ -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);
-
-/**
* @}
*/
@@ -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");
@@ -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;
}
@@ -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();
@@ -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;
@@ -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;
@@ -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);
@@ -865,7 +865,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");
@@ -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;
@@ -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;
@@ -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;
@@ -7,11 +7,11 @@
#include "odp.h"
#include "odp_cunit_common.h"
-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);
}
@@ -59,7 +59,7 @@ static void test_odp_sys_cpu_hz(void)
}
CU_TestInfo test_odp_system[] = {
- {"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},
@@ -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;
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(-)