From patchwork Thu Feb 5 09:57:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 44415 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A5A321521 for ; Thu, 5 Feb 2015 09:58:27 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id k11sf1963677wes.2 for ; Thu, 05 Feb 2015 01:58:26 -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=oBfukRGDg2kIMlll5MI3a/yh+CIKgxfJ1LlbhNZJ1hY=; b=MHcYEPVxuQqW1VlEXwc2IALV7IOzuBrBZhDjh5Mi6GKcQVUbeI5/m1Df71b2WKF86m xurhLRUqg67EmEkrLKpCHNYllvCW3FZ3+KDuaTYyryjICK1Rz6xWlxfalSe5sMQQ0ctn 7y/0neZLjriOJgutCPOxMxmDxlovfaQurOR71R5QO3l0smVFGrMfL6GzsRE5N7fXiDK/ Bv8dFiU2wyy1Bm2xriHnrJ18PJ6JaTzJvu+XK9Gg7k1+fQk5oYYW5UedMlxMjmpPdFOe YwzL3JItG91HPOlgdS6qAvwUfadkKWP1BX0FSxwHDeZUH4siZsx1+yEiGmNYx98GAymd A7HQ== X-Gm-Message-State: ALoCoQnKVxHSdzZHr7xEO4lL5RIkyJqc+GIjMUfEnb62hNwF9HG0OnIVhGJIH60yRVO1AeElF6Bo X-Received: by 10.112.131.106 with SMTP id ol10mr354437lbb.20.1423130306250; Thu, 05 Feb 2015 01:58:26 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.97 with SMTP id p1ls137948laj.4.gmail; Thu, 05 Feb 2015 01:58:26 -0800 (PST) X-Received: by 10.112.54.167 with SMTP id k7mr2468605lbp.72.1423130305916; Thu, 05 Feb 2015 01:58:25 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id q5si3510359lbr.85.2015.02.05.01.58.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Feb 2015 01:58:25 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id s18so5174414lam.13 for ; Thu, 05 Feb 2015 01:58:25 -0800 (PST) X-Received: by 10.112.98.99 with SMTP id eh3mr2465135lbb.32.1423130305818; Thu, 05 Feb 2015 01:58:25 -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 h5csp1034787lbj; Thu, 5 Feb 2015 01:58:24 -0800 (PST) X-Received: by 10.224.19.193 with SMTP id c1mr6125959qab.73.1423130304094; Thu, 05 Feb 2015 01:58:24 -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 ci6si5607466qcb.4.2015.02.05.01.57.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 05 Feb 2015 01:58:24 -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 1YJJC2-0008P8-UG; Thu, 05 Feb 2015 09:57:50 +0000 Received: from mail-qc0-f180.google.com ([209.85.216.180]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YJJBu-0008OS-E4 for lng-odp@lists.linaro.org; Thu, 05 Feb 2015 09:57:42 +0000 Received: by mail-qc0-f180.google.com with SMTP id r5so5556722qcx.11 for ; Thu, 05 Feb 2015 01:57:37 -0800 (PST) X-Received: by 10.140.23.199 with SMTP id 65mr6109291qgp.84.1423130257278; Thu, 05 Feb 2015 01:57:37 -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 r8sm2494306qad.43.2015.02.05.01.57.34 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Feb 2015 01:57:35 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Thu, 5 Feb 2015 11:57:13 +0200 Message-Id: <1423130234-6305-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1423130234-6305-1-git-send-email-petri.savolainen@linaro.org> References: <1423130234-6305-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 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.54 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 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 #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 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;