From patchwork Sat Mar 6 20:26:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 88679 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2C933A0548; Sat, 6 Mar 2021 21:27:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2AB922A3FC; Sat, 6 Mar 2021 21:27:08 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id F287422A3AB; Sat, 6 Mar 2021 21:27:06 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 126KR5eo026520; Sat, 6 Mar 2021 12:27:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=OfNlOEJKCkNqnFIQcj2vLKTcqrS5qYA0++UEZr+67Lg=; b=b2AV1SrspP679Sb+ET/n8i8AVZY+ewTPadkP4e6RGtRMhTtbzTUxBN9sP3RNyV1jMCzf QrJ2zBkMtyZAfpJgQsJzhYHp2Br0KvuqKeg/nQVymWm5dKxWCC4XgqBbGvjfTjhdh/B7 s+k1KwKWWeTkslNiHyE18jASFvJVzMCCZwQLWJbHXGnS9gfUGrz4RQrMXOsLW4+opWoC hCnWTbVlqEx9ch8r5lso1Casz0OmyLzUtQbzEdZVJLOKGjExabv+felVvCOj1zzkiNOV HbDRw/80XSRbV0WqO2F9Ep/lt9ZG3HIVK2PatLIzAEwygpjhK1aH9HXP2WYwIkmNasAq 0w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3747yurrhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 06 Mar 2021 12:27:06 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 6 Mar 2021 12:27:04 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 6 Mar 2021 12:27:04 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 6 Mar 2021 12:27:04 -0800 Received: from BG-LT7430.marvell.com (unknown [10.193.68.121]) by maili.marvell.com (Postfix) with ESMTP id 522FD3F703F; Sat, 6 Mar 2021 12:27:02 -0800 (PST) From: To: , Erik Gabriel Carrillo CC: , Pavan Nikhilesh , Date: Sun, 7 Mar 2021 01:56:58 +0530 Message-ID: <20210306202659.9091-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-06_08:2021-03-03, 2021-03-06 signatures=0 Subject: [dpdk-dev] [PATCH] test/event: fix timeout accuracy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" From: Pavan Nikhilesh 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 Acked-by: Erik Gabriel Carrillo --- 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 + #include #include #include @@ -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;