From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
harry.van.haaren@intel.com, hemant.agrawal@nxp.com,
gage.eads@intel.com, nipun.gupta@nxp.com,
gprathyusha@caviumnetworks.com,
Jerin Jacob <jerin.jacob@caviumnetworks.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] app/testeventdev: fix a divide by zero case
Date: Mon, 31 Jul 2017 15:34:52 +0530 [thread overview]
Message-ID: <20170731100452.12647-2-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <20170731100452.12647-1-jerin.jacob@caviumnetworks.com>
pkts == 0 will result in divide by zero case.
Added a check to fix it.
Coverity issue: 158652
Fixes: 9d3aeb185eb4 ("app/testeventdev: launch perf lcores")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
app/test-eventdev/test_perf_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index a5b768c68..7b0929941 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -203,7 +203,7 @@ perf_launch_lcores(struct evt_test *test, struct evt_options *opt,
perf_cycles = new_cycles;
total_mpps += mpps;
++samples;
- if (opt->fwd_latency) {
+ if (opt->fwd_latency && pkts > 0) {
printf(CLGRN"\r%.3f mpps avg %.3f mpps [avg fwd latency %.3f us] "CLNRM,
mpps, total_mpps/samples,
(float)(latency/pkts)/freq_mhz);
--
2.13.3
next prev parent reply other threads:[~2017-07-31 10:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 10:04 [dpdk-dev] [PATCH 1/2] app/testeventdev: fix string overflow Jerin Jacob
2017-07-31 10:04 ` Jerin Jacob [this message]
2017-07-31 10:09 ` [dpdk-dev] [PATCH 2/2] app/testeventdev: fix a divide by zero case Van Haaren, Harry
2017-07-31 10:08 ` [dpdk-dev] [PATCH 1/2] app/testeventdev: fix string overflow Van Haaren, Harry
2017-07-31 20:41 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170731100452.12647-2-jerin.jacob@caviumnetworks.com \
--to=jerin.jacob@caviumnetworks.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=gage.eads@intel.com \
--cc=gprathyusha@caviumnetworks.com \
--cc=harry.van.haaren@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=nipun.gupta@nxp.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).