From patchwork Tue Dec 15 12:29:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 58430 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp2573lbb; Tue, 15 Dec 2015 04:30:40 -0800 (PST) X-Received: by 10.140.20.242 with SMTP id 105mr49922485qgj.18.1450182631367; Tue, 15 Dec 2015 04:30:31 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u42si967236qge.50.2015.12.15.04.30.27; Tue, 15 Dec 2015 04:30:31 -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 Received: by lists.linaro.org (Postfix, from userid 109) id 0EBF961A09; Tue, 15 Dec 2015 12:30:27 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=PBkfJc82; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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 5F24C61985; Tue, 15 Dec 2015 12:29:44 +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 656B8619B8; Tue, 15 Dec 2015 12:29:40 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id E9B77618CF for ; Tue, 15 Dec 2015 12:29:38 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id y184so5205077lfc.1 for ; Tue, 15 Dec 2015 04:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1akQ0xsFmM+068DRGi8lkafJ/Q2zrU0iLVjtvV67gj0=; b=PBkfJc822A8hWOJ+MYywyCgfh6gzrQ7LoBLsSuN6Uch+2oAeSpr8tnAKUh/IhkAEVp 8bMUlAPmCCrosk0xaj1ke105G29kON0eQKCpZRLV5wO0aBWv/SdDRLV2El2lBxr8/+8H O9QJjwDJkJFV1uPWLKOweND5W2DgAGUj2s4/4= 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=1akQ0xsFmM+068DRGi8lkafJ/Q2zrU0iLVjtvV67gj0=; b=Az7a7iEpReppMdwwRAlMpU3jtW68L1brbFzpCuw0iGReqZ9WYZRgXYSFrhZ/zw8TPJ QD7GbYrCtBTF5U+67aAwk3oB/QWSe53MwkSU9kv8UIPrASoOf4qpT89RSmNq2GNOK4EN Is2oijpaseRJqsDfbYxx/GzkcFyhI6JQwjzRMljS6Yb+VJSkwkt0mRyHagyl+tkd3AIJ AiFC1DZbq963JEJAoOBNyX5UOC3RpDY8iXR4ME2OhXqM+8DoSFH5WMBu/wo+v5nQ6ljI AV2Y2Z8yox3HJbGFY2IRXUTxFxi4pkL7m5B0AMtSH/UvcphUhRLcldMxfg0tJS2YiuIn 7CIg== X-Gm-Message-State: ALoCoQlANna5Ud9nouZznHatCwwTGdZkZ9sBmJ+SQ+oOflIzO4SFueqoFbBFPVgpYZ4EAGbyAz9wcy48bxBATVgLODApbg3tJg== X-Received: by 10.25.147.209 with SMTP id v200mr15419210lfd.102.1450182577838; Tue, 15 Dec 2015 04:29:37 -0800 (PST) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id h8sm15103lbd.5.2015.12.15.04.29.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Dec 2015 04:29:36 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Tue, 15 Dec 2015 14:29:23 +0200 Message-Id: <1450182567-7646-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450182567-7646-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1450182567-7646-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v2 2/6] performance: pktio_perf: use odp_time_wait() function instead of looping 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" Now odp_time_wait() can be used instead of own implementation. Signed-off-by: Ivan Khoronzhuk --- test/performance/odp_pktio_perf.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 8737bc8..7e3a8b0 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -591,20 +591,6 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx, } /* - * Busy loop for specified length of time. - */ -static void busy_loop_ns(uint64_t wait_ns) -{ - odp_time_t wait = odp_time_local_from_ns(wait_ns); - odp_time_t cur = odp_time_local(); - odp_time_t end_time = odp_time_sum(cur, wait); - - do { - cur = odp_time_local(); - } while (odp_time_cmp(end_time, cur) > 0); -} - -/* * Run a single instance of the throughput test. When attempting to determine * the maximum packet rate this will be invoked multiple times with the only * difference between runs being the target PPS rate. @@ -617,6 +603,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx, thread_args_t args_tx, args_rx; uint64_t expected_tx_cnt; int num_tx_workers, num_rx_workers; + odp_time_t shutdown_delay = odp_time_local_from_ns(SHUTDOWN_DELAY_NS); odp_atomic_store_u32(&shutdown, 0); @@ -647,7 +634,7 @@ static int run_test_single(odp_cpumask_t *thd_mask_tx, num_tx_workers); /* delay to allow transmitted packets to reach the receivers */ - busy_loop_ns(SHUTDOWN_DELAY_NS); + odp_time_wait(shutdown_delay); /* indicate to the receivers to exit */ odp_atomic_store_u32(&shutdown, 1);