From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0061.outbound.protection.outlook.com [104.47.41.61]) by dpdk.org (Postfix) with ESMTP id 01C507CCD for ; Sun, 28 May 2017 22:01:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jwvmxOQc4lmPZZc/mGab0p4n4LXQ4oXKJ6ujcX8AAIc=; b=f/M4AVme3rWfcvVo+hgTCA4tAzBOOKka5KQmAgVVAGyHsF4/StXi1DprOuB1BKr/rpbavvig0tRHxmHGa7Xu6rJhqmiEvQ3XO/npsF1E2McuDwmY8yV4GQKjQoOObuUVTLdqRfaEL4S/l2OtsZ5i3yqGP55O+zpxmFk8q3/ipz8= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from jerin.domain.name (111.93.218.67) by CY1PR0701MB1725.namprd07.prod.outlook.com (10.163.21.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Sun, 28 May 2017 20:01:54 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, narender.vangati@intel.com, nikhil.rao@intel.com, gprathyusha@caviumnetworks.com, Jerin Jacob Date: Mon, 29 May 2017 01:28:44 +0530 Message-Id: <20170528195854.6064-24-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170528195854.6064-1-jerin.jacob@caviumnetworks.com> References: <20170528195854.6064-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BMXPR01CA0003.INDPRD01.PROD.OUTLOOK.COM (10.174.214.141) To CY1PR0701MB1725.namprd07.prod.outlook.com (10.163.21.14) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR0701MB1725: X-MS-Office365-Filtering-Correlation-Id: ace6bd2d-a01f-494d-a339-08d4a604657a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY1PR0701MB1725; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1725; 3:nPlnVsxPjJG7Rs5f1YKtp2HNufoeUgrDz+mdik7ASxzn0Fk8Qz9OaGGLVKXbsb0dc+JtWVv6vs1/fx6VLs1Mn96Ez0MkFFc/h785X69BzD3m4Gofwe297Ytu6im0LMi34xWDiuK6HApPnSN8G1ooMval8du+3puWYXD/KSTRhGH2TzxQi7ZKZVM03zopQVLrP2y50USAVQ7rQ3BLNTw2HK6qgpzRowAE/OFMtEiwtR+y9grp1Ncc/GR7SbyVdICqmjtRjQ4Di36tawJq/Lv1PJbRc/EaDMQKN9aWq2w7cHJF1d7FPMnWRfNnvDYjovoAS0ampOhN5W+Hn2gkvmOSmw==; 25:J5aWQlafdZZwdi8k0n6vbXbNsjXT+r8djUBGL+qs3/6W9U6zObSUWMH+snSTTsbESqQXMtr+EU9WzBgrEvn0G8jHTcaRDibY1H8gDYIB/g0lsekL8GbEqHaSuLQA4PpIErymwmYx/Z0OpaIY+7BEQsfC+YgZjiz5GlQf3eddwxuyc3m26jujlIy29ZrYr1/WrjLQqyTgR3bWSNNTGSEtfxveXMpN3J/j6QUHCCV6w/DEDypjpWqKMlsygm31r0JothkmU0s7aOOTb7M2KFh+2IFTQmcLOzYWggeSz+TyGMon1LzYeMavlLOSxNdHCPQmLTdKxyjXqK5W9zGvHE48P5R+d9O9zQ/ZN4up/s6wf+MXtdymL2gjzaCWAuqX3X8Js6jfbKkn5GipwFPOEbHG6URw4Njpv2JoQgsYrUG4qv1kXf0n8QJNvqvm9Y6HfHhs9/NPfoV+36wKjqUeh4fW/hLHJn9ZpE4C1M+naYaZXC0= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1725; 31:vGFEppT4pw/Mwbdtkpzu5xMHoB/PtAhc4G0c5xG6uc0B/pVt5RkOuQpV/Vw5WmxZ4jr3cxMuvi9+xAPcYIe4eVyJnHEr4zXRU9RvtfwebdwyxSt0nYg0GqEG2aV2dSp0BRQ1a0LcEjumAfGK2TK8YQa9zNSQX1AAye66NNxd+uHYHTypEgyIUaHNk/+t2k373gGjZjzv8SuGq0//PXohBJx+WyOpC09C+vcHiBOf028=; 20:gUE6JY9caGzC6GLqFYXj+rtwBwiXBztfW7MF8HmLSMzflkBv0JJgcZiu1hH/pvB5PXazi2xLenR8tt6sG5KjrIvkeEeXCJuQuafK/cOZqAk8OBJvQReLikbRF7NNLpbhbXqCdix4cALCXFHyhIHzvv1tJhy+jkRL0CZLtkV2kyqpCWKwXHdzCVhYbrppOOaNqk8mN1oZeaZnQtGzNUE1R8lPWVOCEUdpl3+Z5ZIBYDyN4k5vaQ2XnYirTs8O3oG+XuZI5gMslYGWVMRtn27SP1vIQKwQUPjZB50Fz8wnvacgxS7j2WXreneDeb1peUwavbA/sryr6Zji0O6Cv3NLFQw+VOcm5fXdORX6IJP/ED/W54WnpU1F3tcymgZ0fnFawaXV0piK9VSdlnrFVisWXebY3t6aT774NY8bFW92UZQTARNQNbQoLZF871PMrwHCbrG0ZecFHeDtRQoF0RBjuuRvroSFLlJmBPHWU6Cj8u26o2Sv+IxRL9ovEYpPMWAvl8S6jmnfh+jDxI8xyoStNBm91HcYim7qUJtYxiEk8227XrwT49Efz6o0rGwvgVOB8N/BU4vpOn6X2WUxjx4C8r7H/5dwoqWn+UKGfGJ0OV8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700073)(100105000095)(100000701073)(100105300095)(100000702073)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(100000703073)(100105400095)(6041248)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(100000704073)(100105200095)(100000705073)(100105500095); SRVR:CY1PR0701MB1725; BCL:0; PCL:0; RULEID:(100000800073)(100110000095)(100000801073)(100110300095)(100000802073)(100110100095)(100000803073)(100110400095)(100000804073)(100110200095)(100000805073)(100110500095); SRVR:CY1PR0701MB1725; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB1725; 4:4vo6k72cldRv9Er8u19ADl/l+uYZXS+H+RfBtsuP?= =?us-ascii?Q?OpzXo12KVtE6bmnB+x/QBrgyDQiGC6ycdN/tvGBmd5Wo+7F7/mpytt48J5he?= =?us-ascii?Q?3AJl0qp/xTUwPzc+s2MHCqGqmRvbZh4/pe5BRF+jIE9uv8uQQkXc2T1KQBkk?= =?us-ascii?Q?tp4Cas+8DLp7OYygcaA5C7eRB75oE9oW4hxl7rEwueBmopgCBoVjaPFCoTr3?= =?us-ascii?Q?wCVz0wl8z/N5cSspzL+8d6OuWvu2YU+Peohg1omh/43V2gGUT0SEhXK3apVW?= =?us-ascii?Q?yh8qY+xEvDAWHPTNVskPL0QgyevEfUcMkZwAOjcLjBbE58L3lY4nAjBQxx5U?= =?us-ascii?Q?mC8DNkAtNWGwJxIEiI3qvXlEkYkiro6Tujo4nh5VEIprtrRvAurjKb7p4UUf?= =?us-ascii?Q?7bTMkqhI7w0DEQLwGclV+rqm4Un+8ec7AWgQCPmqXutUETuIU1phAANBaQtR?= =?us-ascii?Q?MvNu+CSzgSMfcPuNR0+i6fQ+ddD3xKYiXbowca5FK1ZwQn76MktJA93ySkp6?= =?us-ascii?Q?Q7/mTYIgYGyDXOidkdNs7vAmM5MolCiZf8pyPMqWSeqU9SLdHCzUeQgWahhe?= =?us-ascii?Q?LdMTndq9DRT9EE8I0PPGbMF8tzxOXEl5m6QQmpY793pcPWdgSLTwx8NzKHFp?= =?us-ascii?Q?4ziKEjBQ6INpqSK6bjDTKfy/kTmrux9WlNqDOmvP2zcP37wnWcqLwxUqZjwA?= =?us-ascii?Q?kvHELA+inG8C2HcgqZSephUy/dqamyKqFQO1d0Z1waPQDGi0NjNHu/XLYnIh?= =?us-ascii?Q?0fhUg9JAlj3LaAem0SpXNUBWyP0/YbRfjjkhmhFgzq9XcXxE6EHZUZi7ubez?= =?us-ascii?Q?OqoQdv1J1TGBuN3w+Am4mNuCeMCHyLs8SRZm7xwfp/nSoGUgz25wEiVMHuzk?= =?us-ascii?Q?pzGZGkNjZtcAkIXxJTwgO7gcH9gdvdqxPTcm3wAc/tSjOf9RGks6pVn/enIb?= =?us-ascii?Q?nVtGGo6KSmHCMvyoFHVeE0u/f4IWrmfvHLbq2TyMx2t2PpOfL6kFLs1tRXAz?= =?us-ascii?Q?cUbD0OMCf23hvRF8NbMptRSNoxz3fmU/9+a6ZhQ1nonLU4tInYBhMbkl5o3U?= =?us-ascii?Q?zAubHDaiEolkonocgVolafRaC/o5VM3aaVFLFv0pMRqt3Iu7imSFU29OgPw8?= =?us-ascii?Q?sTCBsp0aXpw=3D?= X-Forefront-PRVS: 03218BFD9F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39850400002)(39410400002)(39840400002)(39400400002)(81166006)(6486002)(66066001)(4326008)(50986999)(76176999)(50226002)(189998001)(72206003)(36756003)(6506006)(38730400002)(5003940100001)(5009440100003)(110136004)(107886003)(42186005)(53416004)(7736002)(8676002)(48376002)(50466002)(1076002)(3846002)(6116002)(6512007)(2361001)(305945005)(2906002)(6666003)(478600001)(25786009)(5660300001)(2351001)(6916009)(42882006)(2950100002)(33646002)(8656002)(47776003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1725; H:jerin.domain.name; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB1725; 23:pEUs2GiukRQGA2l2Zb29jBLp06sJILePDrlddE5?= =?us-ascii?Q?HrskNY4F4uNzr1gpLdJaTGkT+6wNB/NFmmkMuA+/Y2FFcxsW7y/AKuNrhho5?= =?us-ascii?Q?CwyrL8gpJWl3dETW3RYdfcRGnBM9rp+eNM+mBdfMCWzrwP/4WCQfSjR3ueEI?= =?us-ascii?Q?/4wY+IBDOgR622uSF03tl3mWQvA00VtPIxWReTIZHAV4deeE+LgDI3iHQv7j?= =?us-ascii?Q?lh5LMfEEb48m5/I7shTlInuBP2lJ9a8OJQW1MHEXwi3+wHGDcMdtU2pOFfmx?= =?us-ascii?Q?GGLXWt1LR4ueZvZvVn6PzkHV/NJwOBig2FLJfgi24K5Sj0LZc8sH6xhTH875?= =?us-ascii?Q?htmelusgA7/90Z5IYftVyr3JsALme4clGmexEbkLOvA4SvAtbULDukvAqHzb?= =?us-ascii?Q?WHR0y+mvAji094zXQCjgfDKAKEluAfnSMx0kguWRz7kI9eClTnf+whLS/HF2?= =?us-ascii?Q?jydU2udkkBW/00fehIFJB8gezdIGaBGua0yZBEUbQBZX6XggMlsTJ9+1jN6m?= =?us-ascii?Q?ffppEH7leK857cZkguJgXnbsrYbzTSZ4dsB3kg4bl7LqgN+nwbIWZecq39xC?= =?us-ascii?Q?U8Z1x5blV/1dYIy1Umug/iL00PwgWlT2zSC4JULTS92IIGTtW8270DrXcdjg?= =?us-ascii?Q?zMcH9aoxPPd9iLEVQ8u7KggsJlEQcotlRey4/urHptq4S0s3NF+man017iBV?= =?us-ascii?Q?Y30ApgwZLIJ5I3iTZsqQ/4t1sw31Slf0eGrJYKbqQ+7WNtYLWC7UmXifc2to?= =?us-ascii?Q?t/VfISHU/k2omm2tc0g9RNqQGt9+SFN3aUaaYBMACt/vttuiSLEs7C1P9p0b?= =?us-ascii?Q?OVjq9I+UkuIyusWUH5xby4/Dl2ytpgr8QfMLNlt2KDeTYQLI7syeD8T3NUxr?= =?us-ascii?Q?ip8+v+Ww4dX7af66btlEq8wq25LKupHOuoyetsxFx1XF6gbDGWgd7ptN2uXz?= =?us-ascii?Q?8nD0LS7YmRkmRHQdEOcK+/T62v1/+srGonmqu9LfN4k1sW1VGTzYk2pmViZJ?= =?us-ascii?Q?nhrSacx+iTIpEXLKYVFZ8rqB3dNLhPEA8DMSwJ7Lln7qSsgvceFCCx3uZrm0?= =?us-ascii?Q?/KkXu44KV11YosWvXZtJxYt8TObxA70B2l0Zx5YdH7NP46ipFqoufqlxx69T?= =?us-ascii?Q?g9pVUHJ/6HnOTv7KgSlPQSvZzXAHniTIcK/SDuk86pJ/t1svRueCXoHR48lh?= =?us-ascii?Q?NZMchhfngXD5Fe0AaFLtsyn48mFHzeviuDurp?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1725; 6:JvzrPQ42pMaHZLEjgN9ql/2kR2xTqn678x6TS2h0Z7wsfkC1y7ppUcdGxmE12diEZl094NIiqhp4DUUcfTjabLSmXdrQ0Q7mZxBIWuin973VxBBG21ieZdyLN5Dbocr7CsHIXDJwwUTz6WqTXIvpDxTl1WN4t70xsB5foedBUcqytKTjWIX8Kz3QaEWEr/CYvaEYZKKaXUrpMafvfl3LXZeKSbUER4b95Gy+/bCl+6GWHWEwWKS9VhpFgaq96vzo3+onGMLIVgh5vHlaJuwdn/xDEucrFt4NdU28XnAIG+rbDeotRzGB4Wg79TCNjA2ATJRssIOUzwVGsRzrhjkOMiyTmnrsgs3BHudNwwKmXEjVY/smfl+kZLQr5ErtmAHLqPGcpZdLQ5tM+tjKy19+4rChBEjOQhcf3hMNLOe/hU8Trk2Ojf2L3mjYpPzDhnrBBxGjxI728ljZGzvOTSLNiUdRZl8e2jqF6Eu1FJI6+Gwc555LsnWnJrtSplBG/hISnNCr9dzVirEXK5GqIdr9Fg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1725; 5:RC0mWDceHsqj0QX4Wip02Tt7n+2Od1dvI2pjdbMusd/87cHy2jH/rOOnE0+BqIO/Dqomod493aKwtg/E8aZbZMdcLylg0tVSWWO/ErX8l+7P9+dJNq6uS2ByLDZp/7aqGX0BSqACnJoS4gJUsSbvG8+hQkH8zskzkG8gBaQx2m7egalQI7Ewog3uTVf+5Ts1NRoD8K/PBsgGkqxLIgqzLwq8QKpYUMJ0N0dGud4VInjRTR5A1P/M6QDoLm7RVt2CCRUrcTLQcSEEHMxORFpBjmpL6R/3MMO8qsa1TWwRzJVVlq7B6lb5aHxDF7RdGwSf0a00JAXAI89nzG8/hF8aL75o5vC07ACVypv7U1WUk3WDi9d3PRLVF74s/ASuLX90h5vxUWY4dTe+kddePvcjs7GID1rZ8X5A6isC/WkRd+N5AdPZ8mcechnpT5CRTzn3U1bTetBTIKBBoEsasp9BHfmCUStVV0EsxyUnUghtnMJdCz48kauzJpZlx6qK+b5n; 24:uhjKldvBRmuqvApeL/KBRDSca/J7e79ByUPrsbuhBPU1jJPhog3j2iIjsjT0xr44kGHi8mwYY55m/CxkeUDCPyLdSI2zdRMnr0zpNBZTo5Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1725; 7:FgM8K619xQrzLSrJQkAoGKqr6iHnNO0EX+4VXI2mlI8+GnSvoKpO5umKxR1FwWvXS07O7Bpdx0aC6hceMMee7czIyQ2vgneYtKxG0EoG2T3lke/qa3wA7mNhq52DFM13UHCk5TXbA6jhPDjdxeJ0g1fr9gW8toGc11Lj47scLL2ZaRCy6qfhgButECn+sE+spHqALEvbMqQsJQJY3YUwFwS51wqS5x8nLNi9AqVAVrRk8Y6WkT9V+lerLz7PtjpY4lTZyqo+2D0jRSVI7EJvu3WJqDRjPgSHW+NYJpqXPpPE4xF/WYR+MPAiwSsqykZexMJdue6eHmJtzfXwI7Cayw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2017 20:01:54.0938 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1725 Subject: [dpdk-dev] [PATCH 23/33] app/testeventdev: perf: launch lcores X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 May 2017 20:01:59 -0000 The event producer and master lcore's test termination and the logic to print the mpps and latency are common for the queue and all types queue test. Move them as the common function. Signed-off-by: Jerin Jacob --- app/test-eventdev/test_perf_common.c | 197 +++++++++++++++++++++++++++++++++++ app/test-eventdev/test_perf_common.h | 2 + 2 files changed, 199 insertions(+) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 6ebb16a43..f33e98b17 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -41,6 +41,203 @@ perf_test_result(struct evt_test *test, struct evt_options *opt) return t->result; } +static inline int +perf_producer(void *arg) +{ + struct prod_data *p = arg; + struct test_perf *t = p->t; + struct evt_options *opt = t->opt; + const uint8_t dev_id = p->dev_id; + const uint8_t port = p->port_id; + struct rte_mempool *pool = t->pool; + const uint64_t nb_pkts = t->nb_pkts; + const uint32_t nb_flows = t->nb_flows; + uint32_t flow_counter = 0; + uint64_t count = 0; + struct perf_elt *m; + struct rte_event ev; + + if (opt->verbose_level > 1) + printf("%s(): lcore %d dev_id %d port=%d queue %d\n", __func__, + rte_lcore_id(), dev_id, port, p->queue_id); + + ev.event = 0; + ev.op = RTE_EVENT_OP_NEW; + ev.queue_id = p->queue_id; + ev.sched_type = t->opt->sched_type_list[0]; + ev.priority = RTE_EVENT_DEV_PRIORITY_NORMAL; + ev.event_type = RTE_EVENT_TYPE_CPU; + ev.sub_event_type = 0; /* stage 0 */ + + while (count < nb_pkts && t->done == false) { + if (rte_mempool_get(pool, (void **)&m) < 0) + continue; + + ev.flow_id = flow_counter++ % nb_flows; + ev.event_ptr = m; + m->timestamp = rte_get_timer_cycles(); + while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) { + if (t->done) + break; + rte_pause(); + m->timestamp = rte_get_timer_cycles(); + } + count++; + } + + return 0; +} + +static inline int +scheduler(void *arg) +{ + struct test_perf *t = arg; + const uint8_t dev_id = t->opt->dev_id; + + while (t->done == false) + rte_event_schedule(dev_id); + + return 0; +} + +static inline uint64_t +processed_pkts(struct test_perf *t) +{ + uint8_t i; + uint64_t total = 0; + + rte_smp_rmb(); + for (i = 0; i < t->nb_workers; i++) + total += t->worker[i].processed_pkts; + + return total; +} + +static inline uint64_t +total_latency(struct test_perf *t) +{ + uint8_t i; + uint64_t total = 0; + + rte_smp_rmb(); + for (i = 0; i < t->nb_workers; i++) + total += t->worker[i].latency; + + return total; +} + + +int +perf_launch_lcores(struct evt_test *test, struct evt_options *opt, + int (*worker)(void *)) +{ + int ret, lcore_id; + struct test_perf *t = evt_test_priv(test); + + int port_idx = 0; + /* launch workers */ + RTE_LCORE_FOREACH_SLAVE(lcore_id) { + if (!(opt->wlcores[lcore_id])) + continue; + + ret = rte_eal_remote_launch(worker, + &t->worker[port_idx], lcore_id); + if (ret) { + evt_err("failed to launch worker %d", lcore_id); + return ret; + } + port_idx++; + } + + /* launch producers */ + RTE_LCORE_FOREACH_SLAVE(lcore_id) { + if (!(opt->plcores[lcore_id])) + continue; + + ret = rte_eal_remote_launch(perf_producer, &t->prod[port_idx], + lcore_id); + if (ret) { + evt_err("failed to launch perf_producer %d", lcore_id); + return ret; + } + port_idx++; + } + + /* launch scheduler */ + if (!evt_has_distributed_sched(opt->dev_id)) { + ret = rte_eal_remote_launch(scheduler, t, opt->slcore); + if (ret) { + evt_err("failed to launch sched %d", opt->slcore); + return ret; + } + } + + const uint64_t total_pkts = opt->nb_pkts * + evt_nr_active_lcores(opt->plcores); + + uint64_t dead_lock_cycles = rte_get_timer_cycles(); + int64_t dead_lock_remining = total_pkts; + const uint64_t dead_lock_sample = rte_get_timer_hz() * 5; + + uint64_t perf_cycles = rte_get_timer_cycles(); + int64_t perf_remining = total_pkts; + const uint64_t perf_sample = rte_get_timer_hz(); + + static float total_mpps; + static uint64_t samples; + + const uint64_t freq_mhz = rte_get_timer_hz() / 1000000; + int64_t remining = t->outstand_pkts - processed_pkts(t); + + while (t->done == false) { + const uint64_t new_cycles = rte_get_timer_cycles(); + + if ((new_cycles - perf_cycles) > perf_sample) { + const uint64_t latency = total_latency(t); + const uint64_t pkts = processed_pkts(t); + + remining = t->outstand_pkts - pkts; + float mpps = (float)(perf_remining - remining)/1000000; + + perf_remining = remining; + perf_cycles = new_cycles; + total_mpps += mpps; + ++samples; + if (opt->fwd_latency) { + printf(CLGRN"\r%.3f mpps avg %.3f mpps [avg fwd latency %.3f us] "CLNRM, + mpps, total_mpps/samples, + (float)(latency/pkts)/freq_mhz); + } else { + printf(CLGRN"\r%.3f mpps avg %.3f mpps"CLNRM, + mpps, total_mpps/samples); + } + fflush(stdout); + + if (remining <= 0) { + t->done = true; + t->result = EVT_TEST_SUCCESS; + rte_smp_wmb(); + break; + } + } + + if (new_cycles - dead_lock_cycles > dead_lock_sample) { + remining = t->outstand_pkts - processed_pkts(t); + if (dead_lock_remining == remining) { + rte_event_dev_dump(opt->dev_id, stdout); + evt_err("No schedules for seconds, deadlock"); + t->done = true; + rte_smp_wmb(); + break; + } + dead_lock_remining = remining; + dead_lock_cycles = new_cycles; + } + } + printf("\n"); + return 0; +} + int perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, uint8_t stride, uint8_t nb_queues) diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index 06e887b98..f8246953a 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -99,6 +99,8 @@ int perf_test_setup(struct evt_test *test, struct evt_options *opt); int perf_mempool_setup(struct evt_test *test, struct evt_options *opt); int perf_event_dev_port_setup(struct evt_test *test, struct evt_options *opt, uint8_t stride, uint8_t nb_queues); +int perf_launch_lcores(struct evt_test *test, struct evt_options *opt, + int (*worker)(void *)); void perf_opt_dump(struct evt_options *opt, uint8_t nb_queues); void perf_test_destroy(struct evt_test *test, struct evt_options *opt); void perf_eventdev_destroy(struct evt_test *test, struct evt_options *opt); -- 2.13.0