From patchwork Thu Aug 23 12:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 144929 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp92211ljw; Thu, 23 Aug 2018 05:04:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzWKxkaEaYeeRnCrqVZzDuQ/Dlu381c38pKKBOu/3Du2ZKtEP51xD6U6RLd1pHwDEP/4LFz X-Received: by 2002:a37:9a05:: with SMTP id c5-v6mr22407923qke.162.1535025855520; Thu, 23 Aug 2018 05:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535025855; cv=none; d=google.com; s=arc-20160816; b=N6vNYCYSA+5Mr4MZ9nPXlpV7cDNihwtTYqtlTkU0fe5fa41/zd+Yp0ISQP9WHfO9xq 5UQrfflmDFkRJppiYPxb+5m9ab37m3l+XCyhtYoa7pUgqE3GBeWnNNREoCsK8Vwud/Mw DuZ+KDIhjuZbVE9m3MS+3zI3LpOxCAaB8zTNlmd7bWFUfGis3HW7avPWtgeuRX0FE7fM GURgzdGftWgMGvaaRYDBGtdSiPlZdBzbGjPGa5XH/ctak5QhJjyNUVESQpeYLgK5Pu/1 2HOGfI/jUXMfejdR0FMLv6rwo8YS8qacrQA/NtaDfwRrOWNYuvW5T/bt3LfSdM0i0GRo XS4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Vu8kGLtIyi3YLAz5K2fSfkKdThrvrIzIMVaMFFs6gKA=; b=egNDnXG1wlry5awlwryy7XXBjHRh5BGHiNJ/AdvVYsYnyomLmAYg+xvA412guXkE0K vHoS3qJzU9T2Zv+31T+7v2mTl47riST84s7wwB335h7qGxEtqsD4ni4kY7Kfh956Ki9R bmu1SNxESPZEql4irlvXeTGsYn0CKZMV1RoEAxF7tsTdNdhsgsuVFCh/ArdAOqY71WTT YLG0kvVupU3uFaba7Qrhwhe9sDcm8uL7gaECuy8eob+86qwPImk9+K9nsfcgo8N3fkXr THMeRhXL6ZUnFraWl4kP7bSpZMjGcMo3fllmoN9Rj7mzx83zr8AyiCwbgzL8GusdLfoy vWpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id c12-v6si3581602qvn.173.2018.08.23.05.04.15; Thu, 23 Aug 2018 05:04:15 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 3D9AB68632; Thu, 23 Aug 2018 12:04:15 +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=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 AC2A26863A; Thu, 23 Aug 2018 12:02:16 +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 2FF1D6863B; Thu, 23 Aug 2018 12:02:05 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 1AEA768648 for ; Thu, 23 Aug 2018 12:00:13 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 6462A18681A for ; Thu, 23 Aug 2018 15:00:11 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id yvC3MG1sXC-0BmqqufG; Thu, 23 Aug 2018 15:00:11 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Vxq9GCjZFV-0ASqZWAo; Thu, 23 Aug 2018 15:00:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 23 Aug 2018 12:00:07 +0000 Message-Id: <1535025607-21626-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535025607-21626-1-git-send-email-odpbot@yandex.ru> References: <1535025607-21626-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 680 Subject: [lng-odp] [PATCH v1 3/3] test: queue_perf: add burst_size option 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Added option to select maximum burst size. Changed to multi-dequeue and enqueue functions. Signed-off-by: Petri Savolainen --- /** Email created from pull request 680 (psavol:master-test-queue-perf-multithread) ** https://github.com/Linaro/odp/pull/680 ** Patch: https://github.com/Linaro/odp/pull/680.patch ** Base sha: 1c36bf726387b291d73bee1448cf163527cf5fb0 ** Merge commit sha: cce6d22c7a83b846bd9589a48869c664f75980ae **/ test/performance/odp_queue_perf.c | 45 ++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/test/performance/odp_queue_perf.c b/test/performance/odp_queue_perf.c index 0cda5879b..09c8592b9 100644 --- a/test/performance/odp_queue_perf.c +++ b/test/performance/odp_queue_perf.c @@ -20,6 +20,7 @@ typedef struct test_options_t { uint32_t num_queue; uint32_t num_event; uint32_t num_round; + uint32_t max_burst; odp_nonblocking_t nonblock; int single; int num_cpu; @@ -59,6 +60,7 @@ static void print_usage(void) " -c, --num_cpu Number of worker threads. Default: 1\n" " -q, --num_queue Number of queues. Default: 1\n" " -e, --num_event Number of events per queue. Default: 1\n" + " -b, --burst_size Maximum number of events per operation. Default: 1\n" " -r, --num_round Number of rounds\n" " -l, --lockfree Lockfree queues\n" " -w, --waitfree Waitfree queues\n" @@ -74,22 +76,24 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options) int ret = 0; static const struct option longopts[] = { - {"num_cpu", required_argument, NULL, 'c'}, - {"num_queue", required_argument, NULL, 'q'}, - {"num_event", required_argument, NULL, 'e'}, - {"num_round", required_argument, NULL, 'r'}, - {"lockfree", no_argument, NULL, 'l'}, - {"waitfree", no_argument, NULL, 'w'}, - {"single", no_argument, NULL, 's'}, - {"help", no_argument, NULL, 'h'}, + {"num_cpu", required_argument, NULL, 'c'}, + {"num_queue", required_argument, NULL, 'q'}, + {"num_event", required_argument, NULL, 'e'}, + {"burst_size", required_argument, NULL, 'b'}, + {"num_round", required_argument, NULL, 'r'}, + {"lockfree", no_argument, NULL, 'l'}, + {"waitfree", no_argument, NULL, 'w'}, + {"single", no_argument, NULL, 's'}, + {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0} }; - static const char *shortopts = "+c:q:e:r:lwsh"; + static const char *shortopts = "+c:q:e:b:r:lwsh"; test_options->num_cpu = 1; test_options->num_queue = 1; test_options->num_event = 1; + test_options->max_burst = 1; test_options->num_round = 1000; test_options->nonblock = ODP_BLOCKING; test_options->single = 0; @@ -110,6 +114,9 @@ static int parse_options(int argc, char *argv[], test_options_t *test_options) case 'e': test_options->num_event = atoi(optarg); break; + case 'b': + test_options->max_burst = atoi(optarg); + break; case 'r': test_options->num_round = atoi(optarg); break; @@ -165,6 +172,7 @@ static int create_queues(test_global_t *global) printf(" num rounds %u\n", num_round); printf(" num queues %u\n", num_queue); printf(" num events per queue %u\n", num_event); + printf(" max burst size %u\n", test_options->max_burst); for (i = 0; i < num_queue; i++) queue[i] = ODP_QUEUE_INVALID; @@ -350,8 +358,8 @@ static int run_test(void *arg) { uint64_t c1, c2, cycles, nsec; odp_time_t t1, t2; - odp_event_t ev; uint32_t rounds; + int num_ev; test_stat_t *stat; test_global_t *global = arg; test_options_t *test_options = &global->options; @@ -363,6 +371,8 @@ static int run_test(void *arg) int thr = odp_thread_id(); int ret = 0; uint32_t i = 0; + uint32_t max_burst = test_options->max_burst; + odp_event_t ev[max_burst]; stat = &global->stat[thr]; @@ -379,20 +389,20 @@ static int run_test(void *arg) if (i == num_queue) i = 0; - ev = odp_queue_deq(queue); + num_ev = odp_queue_deq_multi(queue, ev, max_burst); - if (odp_unlikely(ev == ODP_EVENT_INVALID)) + if (odp_unlikely(num_ev <= 0)) num_retry++; - } while (ev == ODP_EVENT_INVALID); + } while (num_ev <= 0); - if (odp_queue_enq(queue, ev)) { + if (odp_queue_enq_multi(queue, ev, num_ev) != num_ev) { printf("Error: Queue enq failed %u\n", i); ret = -1; goto error; } - events++; + events += num_ev; } c2 = odp_cpu_cycles(); @@ -452,7 +462,7 @@ static int start_workers(test_global_t *global) static void print_stat(test_global_t *global) { int i, num; - double events_ave, nsec_ave, cycles_ave, retry_ave; + double rounds_ave, events_ave, nsec_ave, cycles_ave, retry_ave; test_options_t *test_options = &global->options; int num_cpu = test_options->num_cpu; uint64_t rounds_sum = 0; @@ -475,6 +485,7 @@ static void print_stat(test_global_t *global) return; } + rounds_ave = rounds_sum / num_cpu; events_ave = events_sum / num_cpu; nsec_ave = nsec_sum / num_cpu; cycles_ave = cycles_sum / num_cpu; @@ -501,6 +512,8 @@ static void print_stat(test_global_t *global) printf("------------------------------------------\n"); printf(" duration: %.3f msec\n", nsec_ave / 1000000); printf(" num cycles: %.3f M\n", cycles_ave / 1000000); + printf(" evenst per dequeue: %.3f\n", + events_ave / rounds_ave); printf(" cycles per event: %.3f\n", cycles_ave / events_ave); printf(" deq retries per sec: %.3f k\n",