From patchwork Fri Jan 30 11:39:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44038 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BE3A02410D for ; Fri, 30 Jan 2015 11:40:13 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id l4sf408631lbv.1 for ; Fri, 30 Jan 2015 03:40:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=JPmASbqKpIHfdnyQGRK+WWufyLH89US8dijEARTIHeQ=; b=iBQk9EkwJIre6pmOlaYMZXgzK0VEc6nnqeBhveLDnvYbFWnzXS8Gfx8bZ53bLcYnch OYVPyAc8gtShmF9zxzHy/zxQxGxXOlyeXZ7KwtiuvWgK2oxQ9RWlbxuIvVM8y7DcMyU/ /JUH3E05/gq6M2eYsAHzgxIRvYPTYYdEtDJRkJD7RrVgtERkUM6Jlf/HFdElwPKFTW5/ MvagUZRYxAFIY69ENyNkjiF8ZNRUjN1NAkclMpuid8rJql/fKLLxR1kp+bGfWXpIXR06 gqHghPZ5NqHAaFaccCKj0RMvQkBWLWxPL/GVR6ZSnBfgIJNz1EzBWAOVIXNi1kCSBtEO Bp1w== X-Gm-Message-State: ALoCoQk4VIA8fHXcHLDx6ekNLgvmF62PZ5lK7V1R6pOfXeE2wwqSl9bcg/SZK2XaQ4pAuQJDErhH X-Received: by 10.152.26.74 with SMTP id j10mr759138lag.10.1422618009443; Fri, 30 Jan 2015 03:40:09 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.11 with SMTP id lc11ls174622lac.19.gmail; Fri, 30 Jan 2015 03:40:09 -0800 (PST) X-Received: by 10.152.161.204 with SMTP id xu12mr1284105lab.12.1422618009297; Fri, 30 Jan 2015 03:40:09 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id my5si7510258lbb.93.2015.01.30.03.40.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Jan 2015 03:40:08 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id hs14so23090899lab.9 for ; Fri, 30 Jan 2015 03:40:08 -0800 (PST) X-Received: by 10.152.8.1 with SMTP id n1mr5736114laa.47.1422618008881; Fri, 30 Jan 2015 03:40:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp253348lbj; Fri, 30 Jan 2015 03:40:07 -0800 (PST) X-Received: by 10.224.46.132 with SMTP id j4mr11226089qaf.16.1422618007358; Fri, 30 Jan 2015 03:40:07 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id g74si13802090qge.82.2015.01.30.03.40.06 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 30 Jan 2015 03:40:07 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH9vg-0002RW-FG; Fri, 30 Jan 2015 11:40:04 +0000 Received: from mail-qg0-f42.google.com ([209.85.192.42]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YH9vX-0002Q6-2w for lng-odp@lists.linaro.org; Fri, 30 Jan 2015 11:39:55 +0000 Received: by mail-qg0-f42.google.com with SMTP id q107so37663213qgd.1 for ; Fri, 30 Jan 2015 03:39:49 -0800 (PST) X-Received: by 10.140.94.205 with SMTP id g71mr10586549qge.70.1422617989882; Fri, 30 Jan 2015 03:39:49 -0800 (PST) Received: from mcpro03.emea.nsn-net.net (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id y17sm9778758qaq.14.2015.01.30.03.39.47 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Jan 2015 03:39:48 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Fri, 30 Jan 2015 13:39:25 +0200 Message-Id: <1422617966-27160-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422617966-27160-1-git-send-email-petri.savolainen@linaro.org> References: <1422617966-27160-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 3/4] api: cpu: Renamed odp_sys_cpu_count to odp_cpu_count X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This returns number of cpus available to ODP. Signed-off-by: Petri Savolainen --- 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 --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index ed5396d..b7310ae 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -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" diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index a4dc63d..e1960fb 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -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" diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 195d3d0..83d1bd4 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -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" diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 83992b6..c7cb245 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -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" diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 35ea2a1..25fca93 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 #include #include +#include #include #include @@ -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 2f32d96..c8cf6b9 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -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"); 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 f48141a..74ee485 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 109bc60..a6880ae 100644 --- a/test/validation/odp_system.c +++ b/test/validation/odp_system.c @@ -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}, 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;