From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB36DA04DD; Tue, 26 Nov 2019 06:01:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F4313195; Tue, 26 Nov 2019 06:01:18 +0100 (CET) Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by dpdk.org (Postfix) with ESMTP id C959428EE; Tue, 26 Nov 2019 06:01:17 +0100 (CET) Received: by mail-il1-f193.google.com with SMTP id o18so16397945ils.12; Mon, 25 Nov 2019 21:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tv0ZpXJUlS02yYNRXsIqEaP/jpCTI62FE0IYjmQDbtg=; b=HAYoKjHi3UbtLH5ML/fRQ5NsYBfy54tXt/vMwLRXB9aGdfb0S5XUELbyTVwTpKnc0O uBDbDU82kPiMEJTKdK13H8IhycdNqvN+eC/87zGXdOIZmwLB6nuNeMFlw9TCMNTDUwz6 bIM5nk8zKMBV6NXAiEAMcz9j24tlYZh9A7szE2p8qm7uLSw5ExfDmiLBHMops9+s4qSn bZ/zucEAgpKcx1A13Zm88ohtAuQWsDa0Knq8u6NLNx9zxjeky5xGfJSNgS2/m9HOOFrY 9UCnxI8sdDvoMNr7KG+o5pRPpEZJ5eORdG7as8DCwrWMIXNeQ78oFGm2zN+5kQtdv8Tk vRZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tv0ZpXJUlS02yYNRXsIqEaP/jpCTI62FE0IYjmQDbtg=; b=YU94QXLBA8C/VynYThd0Ykbl9dBOMfIoZ4kN/Al9LqVvTc2UJ+vwIgjT4KlDU3Pej+ kad30lByqRHqyCDQDhblwydXjr4DSF0Ys8dmSQ0ZhpTDGRlL1PDO+5yyEHvCaygrOvD/ GHDPJGeMbd2K4Fp5Crh6DT+Q4wW3TTXTpOY0uryxd+wSoNU7wXYk4RnhseAee0vOHvuF Jd+1g8w/p0IztLueBFjuEs/WMGDppiEjIciVOdJRG65CrRVV4+mTKOp6ruglESjWqqlG g8qdyhHnG8nvxMMHkwLSDuW2TlWlXuRumLeDqRRZi62U1iSwJas4kibFgUwwCk/tobUV y1Cw== X-Gm-Message-State: APjAAAWacQPrtJexcToyvgq/5gY/45Gp0ZPx2XUKQ8eCvby/QiOhf77U vQ3RnJTEibQ5x0bblXPjkp0QaOfZeVIeg0tukoq1j/upgyO+zQ== X-Google-Smtp-Source: APXvYqzeTzAsBr3ktAWN8oVHYSYrqcPDObKWU64TslYxhdZ14e/uXTB7v1SSoT2TAexMfcvbu3IxE77AzNm5drn01fM= X-Received: by 2002:a92:aa48:: with SMTP id j69mr37860700ili.162.1574744476754; Mon, 25 Nov 2019 21:01:16 -0800 (PST) MIME-Version: 1.0 References: <20191121192240.12326-1-pbhagavatula@marvell.com> In-Reply-To: <20191121192240.12326-1-pbhagavatula@marvell.com> From: Jerin Jacob Date: Tue, 26 Nov 2019 14:01:00 +0900 Message-ID: To: Pavan Nikhilesh Cc: Jerin Jacob , dpdk-dev , dpdk stable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/2] app/test-eventdev: fix possible divide by zero 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, Nov 22, 2019 at 4:22 AM wrote: > > From: Pavan Nikhilesh > > Fix possible divide by zero condition when calculating percentages. > > Coverity Issue: 277205 > Coverity Issue: 277234 > Fixes: d008f20bce23 ("app/eventdev: add event timer adapter as a producer") > Cc: stable@dpdk.org > > Signed-off-by: Pavan Nikhilesh Applied to dpdk-next-eventdev/master. Thanks. > --- > app/test-eventdev/test_perf_common.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c > index e7cf75a7d..b3af4bfec 100644 > --- a/app/test-eventdev/test_perf_common.c > +++ b/app/test-eventdev/test_perf_common.c > @@ -133,8 +133,9 @@ perf_event_timer_producer(void *arg) > fflush(stdout); > rte_delay_ms(1000); > printf("%s(): lcore %d Average event timer arm latency = %.3f us\n", > - __func__, rte_lcore_id(), (float)(arm_latency / count) / > - (rte_get_timer_hz() / 1000000)); > + __func__, rte_lcore_id(), > + count ? (float)(arm_latency / count) / > + (rte_get_timer_hz() / 1000000) : 0); > return 0; > } > > @@ -194,8 +195,9 @@ perf_event_timer_producer_burst(void *arg) > fflush(stdout); > rte_delay_ms(1000); > printf("%s(): lcore %d Average event timer arm latency = %.3f us\n", > - __func__, rte_lcore_id(), (float)(arm_latency / count) / > - (rte_get_timer_hz() / 1000000)); > + __func__, rte_lcore_id(), > + count ? (float)(arm_latency / count) / > + (rte_get_timer_hz() / 1000000) : 0); > return 0; > } > > -- > 2.17.1 >