From patchwork Thu Nov 5 15:33:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 56066 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp478397lbr; Thu, 5 Nov 2015 07:40:44 -0800 (PST) X-Received: by 10.140.32.200 with SMTP id h66mr8000068qgh.16.1446738044590; Thu, 05 Nov 2015 07:40:44 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z61si4884573qgd.64.2015.11.05.07.40.44; Thu, 05 Nov 2015 07:40:44 -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 1F5FB619AF; Thu, 5 Nov 2015 15:40:44 +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 BD1F061CFF; Thu, 5 Nov 2015 15:35:02 +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 D492561CFF; Thu, 5 Nov 2015 15:34:57 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id 2957361988 for ; Thu, 5 Nov 2015 15:34:12 +0000 (UTC) Received: by lfgh9 with SMTP id h9so59190538lfg.1 for ; Thu, 05 Nov 2015 07:34:11 -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:in-reply-to:references; bh=Vr840dWZ47nCT+rkyj9pUkwhXDpx4ifVSiaUV6mgUq8=; b=yOz0aflGghSonH9hooaYz6gFgUuRoxYFacIcgHbjWq0YjjxgSI6e3Y+qI7Xwxpp3xh By+Fl6rryw778zzJqthtOWnbiYJmSvgCIewEKpeON4Cb5/Z+X3kxvn/YhBNxSO6EaoG4 xtp9yIAlnZX+o+jQKxuuoJi3D0CrveFs4CHMvm3iAU2E6ZAv3B9o4tsAtKCUhZC1O7ft QDXU9ayRwyYRD0BdZHePC1lhHTknLmO1QxEoKYvG+vKGxjkVmARJo/33tC4u5BRO+MuE bVIYVBpqAM0dwIvHcUpQj70w+SMZw7XGhEelUp9eLdLKT46wl6pbH98mvmxPDXLdzYio wv/w== 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:in-reply-to :references; bh=Vr840dWZ47nCT+rkyj9pUkwhXDpx4ifVSiaUV6mgUq8=; b=AMvdelgI5mbCtcUvNX1JTa0clPF8AdTNnqlGH0Rg3nY9gmSqG2HgYo3XUvmETeewfe gP+U/xxHohJaJJ8GNWokYEo4BxsoYQq0Omg8nW3z5o3I/+sILG0GI/tKBbfw0WMa3zpF AT+Ui325Xg1RolIGtCO+i8PaC+vBzyce0dQhG8MbWtaAwPbLe0kRr9UShYapHh+sOvyC ekpCTNoOc7BVBfo0utLYPyAGWriwdiPAytVPt9/D71Poy14PhNXjiXRq+oevsVdeMuFo ryfB7TeCjnXPvQBEVZ16CvSducIZ9aP36hluUX8ItCTbIZQvrh1UTiTVBodYfn1BbU2A Y5tw== X-Gm-Message-State: ALoCoQmnMvBCvWv+S/H2IFWdEV4CLbqWWpZCE4LySAqAoWyAeSG6zhpwc5gA06DMbLo8TM7lzl0p X-Received: by 10.25.153.18 with SMTP id b18mr2270784lfe.33.1446737650900; Thu, 05 Nov 2015 07:34:10 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id oi5sm1034061lbb.13.2015.11.05.07.34.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Nov 2015 07:34:09 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Thu, 5 Nov 2015 17:33:50 +0200 Message-Id: <1446737630-2323-7-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446737630-2323-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1446737630-2323-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v7 6/6] api: time: 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. Signed-off-by: Ivan Khoronzhuk --- example/generator/odp_generator.c | 2 +- include/odp/api/time.h | 4 ++-- platform/linux-generic/odp_schedule.c | 2 +- platform/linux-generic/odp_time.c | 2 +- test/performance/odp_pktio_perf.c | 10 +++++----- test/validation/pktio/pktio.c | 4 ++-- test/validation/time/time.c | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index d476240..9d79f89 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -604,7 +604,7 @@ static void print_global_stats(int num_workers) break; } - diff = odp_time_diff(start, odp_time_local()); + diff = odp_time_diff(odp_time_local(), start); if (odp_time_cmp(wait, diff) > 0) continue; diff --git a/include/odp/api/time.h b/include/odp/api/time.h index 6e403f6..d0779cd 100644 --- a/include/odp/api/time.h +++ b/include/odp/api/time.h @@ -54,12 +54,12 @@ odp_time_t odp_time_local(void); /** * Time difference * - * @param t1 First time stamp * @param t2 Second time stamp + * @param t1 First time stamp * * @return Difference of time stamps */ -odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2); +odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1); /** * Time sum diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index bb7e324..7cb822f 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -608,7 +608,7 @@ static int schedule_loop(odp_queue_t *out_queue, uint64_t wait, } time = odp_time_local(); - diff = odp_time_diff(start_time, time); + diff = odp_time_diff(time, start_time); if (odp_time_cmp(wait, diff) < 0) break; diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index fdb143f..3c439c7 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -31,7 +31,7 @@ odp_time_t odp_time_local(void) return tick_to_time(odp_cpu_cycles()); } -odp_time_t odp_time_diff(odp_time_t t1, odp_time_t t2) +odp_time_t odp_time_diff(odp_time_t t2, odp_time_t t1) { return tick_to_time(_odp_cpu_cycles_diff(t1, t2)); } diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 2358951..ffe9844 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -337,11 +337,11 @@ static void *run_thread_tx(void *arg) cur_time = odp_time_local(); start_time = cur_time; - burst_start_time = odp_time_diff(burst_gap, cur_time); - while (odp_time_diff(start_time, cur_time) < send_duration) { + burst_start_time = odp_time_diff(cur_time, burst_gap); + while (odp_time_diff(cur_time, start_time) < send_duration) { unsigned alloc_cnt = 0, tx_cnt; - if (odp_time_diff(burst_start_time, cur_time) < burst_gap) { + if (odp_time_diff(cur_time, burst_start_time) < burst_gap) { cur_time = odp_time_local(); if (!odp_time_cmp(idle_start, ODP_TIME_NULL)) idle_start = cur_time; @@ -349,7 +349,7 @@ static void *run_thread_tx(void *arg) } if (odp_time_cmp(idle_start, ODP_TIME_NULL)) { - odp_time_t diff = odp_time_diff(idle_start, cur_time); + odp_time_t diff = odp_time_diff(cur_time, idle_start); stats->s.idle_ticks = odp_time_sum(diff, stats->s.idle_ticks); @@ -600,7 +600,7 @@ static void busy_loop_ns(uint64_t wait_ns) odp_time_t wait = odp_time_local_from_ns(wait_ns); do { - diff = odp_time_diff(start_time, odp_time_local()); + diff = odp_time_diff(odp_time_local(), start_time); } while (odp_time_cmp(wait, diff) > 0); } diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 9435a22..2f42c27 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -346,7 +346,7 @@ static odp_event_t queue_deq_wait_time(odp_queue_t queue, uint64_t ns) if (ev != ODP_EVENT_INVALID) return ev; now = odp_time_local(); - diff = odp_time_diff(start, now); + diff = odp_time_diff(now, start); } while (odp_time_to_ns(diff) < ns); return ODP_EVENT_INVALID; @@ -390,7 +390,7 @@ static odp_packet_t wait_for_packet(pktio_info_t *pktio_rx, } now = odp_time_local(); - diff = odp_time_diff(start, now); + diff = odp_time_diff(now, start); } while (odp_time_to_ns(diff) < ns); CU_FAIL("failed to receive transmitted packet"); diff --git a/test/validation/time/time.c b/test/validation/time/time.c index c8f02c0..f70c776 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -27,7 +27,7 @@ void time_test_odp_diff(void) t2 = odp_time_local(); CU_ASSERT(odp_time_cmp(t2, t1) > 0); - diff = odp_time_diff(t1, t2); + diff = odp_time_diff(t2, t1); CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0); } @@ -38,7 +38,7 @@ void time_test_odp_negative_diff(void) t1 = 10; t2 = 5; - diff = odp_time_diff(t1, t2); + diff = odp_time_diff(t2, t1); CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0); }