From patchwork Thu Nov 5 16:00:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56068 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp488283lbr; Thu, 5 Nov 2015 08:00:54 -0800 (PST) X-Received: by 10.107.130.101 with SMTP id e98mr11929712iod.77.1446739254522; Thu, 05 Nov 2015 08:00:54 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f129si7059376iof.18.2015.11.05.08.00.53; Thu, 05 Nov 2015 08:00:54 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id B5A2861A2E; Thu, 5 Nov 2015 16:00:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id A493D6195C; Thu, 5 Nov 2015 16:00:49 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5B3AB6194F; Thu, 5 Nov 2015 16:00:48 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by lists.linaro.org (Postfix) with ESMTPS id 2AC066194F for ; Thu, 5 Nov 2015 16:00:45 +0000 (UTC) Received: by lbbwb3 with SMTP id wb3so38639753lbb.1 for ; Thu, 05 Nov 2015 08:00:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=PljOMt2H2Dub9cMJsudbhonQtiQ1QMoHNIGPQ7Xdn4I=; b=J7LAAtWl8tkwxXqTyPRZG13VkQ7p4XqmoMeFBSwkJqUOZOE60FE86EKhoCF/MDGgJ9 Cs4wR4EvXeyru5MgzZF1/pINM3bqO85o622rnaQpmtoeK5PuHKIvAWAB1QlZfLTEPNaj 6Me0OoxOSmCKNDJzJJxolc27guWxRd+V7EuMIK5lJShITEGPIPfcpdHt8iSNBZkhyrfB IUZckxOg32lVXoiLo5VR3RZIPynYlJzWwPrw0f+9M8+EKSH8xIjReZ6PdLvU+WWpqVG9 U71l5xyYoL+J7C6fST/tzswcrwXRHsmLOhkSU2Z9KI2/isXqv5bS/DQJeZWqvHTALEVE UZyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PljOMt2H2Dub9cMJsudbhonQtiQ1QMoHNIGPQ7Xdn4I=; b=YcJeC15T8uzVdfA/lnsrXF02aB66dxGbiNfOAYh6fAUaCN6Kcn1ZS9OUk2wujowYw9 LV6Ogioxfw3Mqz9AAhk+uPIdn9HJ5i6cnYruD3I5etinMTkutKRDausns3Rd+QFN2GCe WmXK7ZJsx6OMw8KnNy1mvRI3SYLLAcfI9ypjgEN2/3kzOXXdAMYVX1gW66wiJPrqUOrS +0T1dPYeMw9UGJz2Aqre4EZqezJf5zYtlOKk+jjveILvkj9ZViBymxIEL04UDP26djU+ zwmjjPWOaqpZFa1zsUtE9Dno0T1Iiz2uYZmWmKwu4cNpdmeibKj8i5n50t4eTwoZPzmK 2d2Q== X-Gm-Message-State: ALoCoQn8FGDtJI+6o2zVP+gRjYsDFcHhnG2YPLjDv97JayAcnj/IvcCivYjp5ogXq28yYB32jwHe X-Received: by 10.112.130.39 with SMTP id ob7mr4440749lbb.66.1446739243995; Thu, 05 Nov 2015 08:00:43 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id j136sm622593lfe.38.2015.11.05.08.00.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 08:00:42 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 5 Nov 2015 18:00:36 +0200 Message-Id: <1446739236-15149-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] api: cpu: change order of arguments for diff function X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" 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" It's more convenient to pass parameters in order, like t2 - t1, when t2 is supposed to be more. Also it's needed to keep in sync with time API which uses same order. Signed-off-by: Ivan Khoronzhuk --- Based on series: "[lng-odp] [API-NEXT PATCH v7 0/6] api: time: unbind CPU cycles from time API" https://lists.linaro.org/pipermail/lng-odp/2015-November/016962.html include/odp/api/cpu.h | 4 ++-- platform/linux-generic/include/odp_cpu_internal.h | 2 +- platform/linux-generic/odp_cpu.c | 4 ++-- platform/linux-generic/odp_time.c | 2 +- test/performance/odp_scheduling.c | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 80d2638..8a804d4 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -129,12 +129,12 @@ uint64_t odp_cpu_cycles(void); * first cycle count sample and c2 the second. The function handles correctly * single cycle count wrap between c1 and c2. * - * @param c1 First cycle count * @param c2 Second cycle count + * @param c1 First cycle count * * @return CPU cycles from c1 to c2 */ -uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2); +uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1); /** * Maximum CPU cycle count diff --git a/platform/linux-generic/include/odp_cpu_internal.h b/platform/linux-generic/include/odp_cpu_internal.h index 5eeabef..664e2df 100644 --- a/platform/linux-generic/include/odp_cpu_internal.h +++ b/platform/linux-generic/include/odp_cpu_internal.h @@ -14,7 +14,7 @@ extern "C" { #include static inline -uint64_t _odp_cpu_cycles_diff(uint64_t c1, uint64_t c2) +uint64_t _odp_cpu_cycles_diff(uint64_t c2, uint64_t c1) { if (odp_likely(c2 >= c1)) return c2 - c1; diff --git a/platform/linux-generic/odp_cpu.c b/platform/linux-generic/odp_cpu.c index e5ec4f0..636f811 100644 --- a/platform/linux-generic/odp_cpu.c +++ b/platform/linux-generic/odp_cpu.c @@ -8,7 +8,7 @@ #include #include -uint64_t odp_cpu_cycles_diff(uint64_t c1, uint64_t c2) +uint64_t odp_cpu_cycles_diff(uint64_t c2, uint64_t c1) { - return _odp_cpu_cycles_diff(c1, c2); + return _odp_cpu_cycles_diff(c2, c1); } diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index 3c439c7..a2e4046 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -33,7 +33,7 @@ odp_time_t odp_time_local(void) odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1) { - return tick_to_time(_odp_cpu_cycles_diff(t1, t2)); + return tick_to_time(_odp_cpu_cycles_diff(t2, t1)); } uint64_t odp_time_to_ns(odp_time_t time) diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index d08f253..5d17c47 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -199,7 +199,7 @@ static int test_alloc_single(int thr, odp_pool_t pool) } c2 = odp_cpu_cycles(); - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); cycles = cycles / ALLOC_ROUNDS; printf(" [%i] alloc_sng alloc+free %6" PRIu64 " CPU cycles\n", @@ -239,7 +239,7 @@ static int test_alloc_multi(int thr, odp_pool_t pool) } c2 = odp_cpu_cycles(); - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); cycles = cycles / (ALLOC_ROUNDS * MAX_ALLOCS); printf(" [%i] alloc_multi alloc+free %6" PRIu64 " CPU cycles\n", @@ -310,7 +310,7 @@ static int test_poll_queue(int thr, odp_pool_t msg_pool) } c2 = odp_cpu_cycles(); - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); cycles = cycles / QUEUE_ROUNDS; printf(" [%i] poll_queue enq+deq %6" PRIu64 " CPU cycles\n", @@ -382,7 +382,7 @@ static int test_schedule_single(const char *str, int thr, odp_schedule_resume(); c2 = odp_cpu_cycles(); - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); odp_barrier_wait(barrier); clear_sched_queues(); @@ -458,7 +458,7 @@ static int test_schedule_many(const char *str, int thr, odp_schedule_resume(); c2 = odp_cpu_cycles(); - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); odp_barrier_wait(barrier); clear_sched_queues(); @@ -574,7 +574,7 @@ static int test_schedule_multi(const char *str, int thr, c2 = odp_cpu_cycles(); - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); odp_barrier_wait(barrier); clear_sched_queues(); @@ -745,7 +745,7 @@ static void test_cpu_freq(void) else nsec -= tp1.tv_nsec - tp2.tv_nsec; - cycles = odp_cpu_cycles_diff(c1, c2); + cycles = odp_cpu_cycles_diff(c2, c1); max_cycles = (nsec * odp_cpu_hz_max()) / 1000000000.0; /* Compare measured CPU cycles to maximum theoretical CPU cycle count */