From patchwork Tue Feb 3 10:59: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: 44212 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 858932034D for ; Tue, 3 Feb 2015 11:00:05 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id s18sf20200434lam.2 for ; Tue, 03 Feb 2015 03:00:04 -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=GKEs+siI0/nUd1H0pKsSqkSvA3de+hb+XGlous5sFyQ=; b=kDUp8Q++f4OdlpZxB+u9cGEyoWIFDHprjB0Ycn4L42IPgrR7CtqedM03Zi2z1QHa6P P5Qu7rUA5MnujipBqxPPBXaTy2WrVN0xCizubIkXi/XrGkg0GT3oEge7eWqm8O9uy6ro yheTufG2jFSDeJtgs5r8gkb7wq6qANlnZV4hIFsK0XAyXsG8nasRNGzjN663khq1jrsi U349cpFvXpCKuSlFcRLGU07+6VpS7TbPgEsiSgXkWLPhK9SgbOoUqpWCTvi5UfEYkfax k3Sf04hTv6lY0fLmoGnjYdyw6iw57HkO1zr9snHp2/rnBC+I+Xy2WGcJC1wY75cOQEdb u/gA== X-Gm-Message-State: ALoCoQmrPvDMScHWP9asKaA3w0CZ8VyCK2J7V91JqzcSTLkUrDXOVjNCYTuyMSR5JVw49B2Xbg9V X-Received: by 10.112.30.131 with SMTP id s3mr3078744lbh.13.1422961204454; Tue, 03 Feb 2015 03:00:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.102 with SMTP id ud6ls195048lac.26.gmail; Tue, 03 Feb 2015 03:00:04 -0800 (PST) X-Received: by 10.112.45.135 with SMTP id n7mr23914809lbm.28.1422961204236; Tue, 03 Feb 2015 03:00:04 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id np9si18934206lbb.0.2015.02.03.03.00.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 03:00:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id s18so50447448lam.5 for ; Tue, 03 Feb 2015 03:00:04 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr23952315laa.80.1422961204135; Tue, 03 Feb 2015 03:00:04 -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 h5csp1861142lbj; Tue, 3 Feb 2015 03:00:03 -0800 (PST) X-Received: by 10.224.40.195 with SMTP id l3mr51566469qae.61.1422961202730; Tue, 03 Feb 2015 03:00:02 -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 40si13479714qgh.10.2015.02.03.03.00.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 03:00:02 -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 1YIbD5-0006Y0-9n; Tue, 03 Feb 2015 10:59:59 +0000 Received: from mail-qc0-f174.google.com ([209.85.216.174]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIbCy-0006Wf-Hn for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 10:59:52 +0000 Received: by mail-qc0-f174.google.com with SMTP id s11so34683865qcv.5 for ; Tue, 03 Feb 2015 02:59:47 -0800 (PST) X-Received: by 10.140.23.199 with SMTP id 65mr48567781qgp.84.1422961187387; Tue, 03 Feb 2015 02:59:47 -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 v15sm20959791qav.11.2015.02.03.02.59.45 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 02:59:46 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 12:59:25 +0200 Message-Id: <1422961167-2307-2-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1422961167-2307-1-git-send-email-petri.savolainen@linaro.org> References: <1422961167-2307-1-git-send-email-petri.savolainen@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 2/4] api: cpu: Renamed odp_thread_cpu to odp_cpu_id 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.46 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 system specific cpu id. Signed-off-by: Petri Savolainen --- 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 --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 #include #include +#include #include #include @@ -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;