From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>,
<stable@dpdk.org>
Subject: [dpdk-stable] [dpdk-dev] [PATCH] test/event: fix timeout accuracy
Date: Sun, 7 Mar 2021 01:56:58 +0530 [thread overview]
Message-ID: <20210306202659.9091-1-pbhagavatula@marvell.com> (raw)
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Round timeout ticks when converting from nanoseconds, this prevents
loss of accuracy and deviation from requested timeout value.
Fixes: d1f3385d0076 ("test: add event timer adapter auto-test")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
app/test/test_event_timer_adapter.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/test/test_event_timer_adapter.c b/app/test/test_event_timer_adapter.c
index ad3f4dcc2..b536ddef4 100644
--- a/app/test/test_event_timer_adapter.c
+++ b/app/test/test_event_timer_adapter.c
@@ -3,6 +3,8 @@
* Copyright(c) 2017-2018 Intel Corporation.
*/
+#include <math.h>
+
#include <rte_atomic.h>
#include <rte_common.h>
#include <rte_cycles.h>
@@ -46,7 +48,7 @@ static uint64_t global_info_bkt_tck_ns;
static volatile uint8_t arm_done;
#define CALC_TICKS(tks) \
- ((tks * global_bkt_tck_ns) / global_info_bkt_tck_ns)
+ ceil((double)(tks * global_bkt_tck_ns) / global_info_bkt_tck_ns)
static bool using_services;
--
2.17.1
next reply other threads:[~2021-03-06 20:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 20:26 pbhagavatula [this message]
2021-03-08 17:20 ` Carrillo, Erik G
2021-03-08 18:09 ` Jerin Jacob
2021-03-16 11:46 ` Pavan Nikhilesh Bhagavatula
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=20210306202659.9091-1-pbhagavatula@marvell.com \
--to=pbhagavatula@marvell.com \
--cc=dev@dpdk.org \
--cc=erik.g.carrillo@intel.com \
--cc=jerinj@marvell.com \
--cc=stable@dpdk.org \
/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).