From patchwork Mon Dec 14 18:58:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 58359 Delivered-To: patch@linaro.org Received: by 10.112.73.68 with SMTP id j4csp1666550lbv; Mon, 14 Dec 2015 10:59:44 -0800 (PST) X-Received: by 10.140.140.8 with SMTP id 8mr23047549qhm.60.1450119573123; Mon, 14 Dec 2015 10:59:33 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v72si36062927qka.96.2015.12.14.10.59.32; Mon, 14 Dec 2015 10:59:33 -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 9C8CE61D25; Mon, 14 Dec 2015 18:59:32 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=EuGEkfHR; 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 54C5461D29; Mon, 14 Dec 2015 18:58: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 00D9361D35; Mon, 14 Dec 2015 18:58:45 +0000 (UTC) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by lists.linaro.org (Postfix) with ESMTPS id B70AC61D03 for ; Mon, 14 Dec 2015 18:58:26 +0000 (UTC) Received: by lbbcs9 with SMTP id cs9so112448227lbb.1 for ; Mon, 14 Dec 2015 10:58:25 -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=MVtDXkitnBtCiVCaZEKqVDSEQdjBkiA18QgqP1+5SbI=; b=EuGEkfHRsOmKqsxGfC3BR4yVXXlGNLzg1YaDWP+aSacDtpxNPJfaaxbZaRwJDKWCJA fEUzui3GnwYJwrHmMDIwXF3HBmOlIQnfN2W0vv3sY9+IZZxu9p3HY3bB+q7+yu7V2R9p ZzvYhWpwaEhA7iHfQlkZZ0MSpFBEvqsk8GqbE= 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=MVtDXkitnBtCiVCaZEKqVDSEQdjBkiA18QgqP1+5SbI=; b=GOnv2Jvt1qzPpG6rh8FA+OQXgBp56LRk9OD4qoroaaU5iNqNyPWAu/IPSqrQ80ZH0e i0sgZc/vu4XQ+sUrpbmCckBDF1jen+ygME6WONg5yWZCUhcunXlPO1oD/kwmeJwZ9FSS fF1EmlP2g9dzuuhHhgPUJtFpzwdhQZQYKuV415tF8VJENGLCzugpfzQGNjGd1axLSXtb By39Cx4Fyysnii7KEY60EFQ8n5tGzfm6LgvG7ZoU7LBV0axVlG5oR5XilHle77+Cfc3o mw50LlSlZJQH7+LoRvdYI3skb1VLN16VMWEV8pxiCaLETU7T+al0nxT3U8OxyoLxw/DA idMg== X-Gm-Message-State: ALoCoQnfazuL0pVIUD2zAeLSI3k/UIDWvyxAkbsM9tG3O39dRKn9CHCwLNR56luWPqd1c97uJGrTBALnellrhMvfni8OAIEYlA== X-Received: by 10.112.180.131 with SMTP id do3mr13537462lbc.123.1450119505569; Mon, 14 Dec 2015 10:58:25 -0800 (PST) Received: from localhost.localdomain ([212.90.60.8]) by smtp.gmail.com with ESMTPSA id o5sm5609246lbw.16.2015.12.14.10.58.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Dec 2015 10:58:24 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Mon, 14 Dec 2015 20:58:12 +0200 Message-Id: <1450119496-21604-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450119496-21604-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1450119496-21604-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH 2/6] performance: pktio_perf: use odp_time_delay() 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_delay() 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..32758c1 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_delay(shutdown_delay); /* indicate to the receivers to exit */ odp_atomic_store_u32(&shutdown, 1);