From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 019BDA0547; Sun, 18 Apr 2021 19:20:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8105410E5; Sun, 18 Apr 2021 19:20:48 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.63]) by mails.dpdk.org (Postfix) with ESMTP id 1A8A0410D7 for ; Sun, 18 Apr 2021 19:20:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqiANy4UT3hLF3a9wVvsuHOOASXNagZ7sGRnvZsrZtmZ8fuNElvTNJHkB8cYNdTnymkYx/UcF1KoX1aj3XNX0SX/5k1y4CqkAK4wjGJ/8zSHQxaMROGkeKeJNlBFv79rbq+mpTwrvdL/6nu82vzSR/QiPhnmkNAjqJDWSgMm5AcZNDC4fJpRuK4Y72ORJaP3EvvV5x9zmufTfQVaSeY2HVWhoY67DaMMswLOkZVTYpB4ztbFCQTmabeoXNYK4VfOvcVgvw2zGg2zvpyKA6Ag4i2cr5Mi4UbSl2qI9KQrdt4ySLOeb0vJM5PBrsFfhpgsRzhOgDCSjUKSD94YfkuI9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+MbdfHG0+Jm5qtXCNf36Kd6JLWjxEblCptz5UXb0BwQ=; b=FB54/7NVteviLX/OLnpHBf0s1bzLRCeWH86kFn1FlCBXdyv8pgGnoDAeNF9V4fRdPM2JEOYbQQ+fNzWhnDWjNWGnueKX9GGKr6sd9UXVnUVeBteAtghGXsKQrB4wdUbEZBwNL4w66zwJfbvfgHY2kqIQDACw5WQd0uH9+8LEAN4Kr4Rn5oDdkdEvnQaRk37uMzgZO3p5LXMHEdLmuEcyRLBILowoMGck3E7DIaOKS7yYd2j6lvr+SnvXgdRrUoNLxNHev9v7hoa61UrW5yfs1H9wQglQsCMsFdxTYA/S5bkaTMP6a4VpuNSB70Vain1YeNxqAr93BLT1kPVe3c2Vog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+MbdfHG0+Jm5qtXCNf36Kd6JLWjxEblCptz5UXb0BwQ=; b=Azs8xfaoQ9UiWr+ua2BYW5kHSRlqyeersiUHskpCZ9pl1oPmtX2k+0AwKmb6ExcbM/tzO3iFp2kIePtUqWRs/mpi3FSitV/A2WiKtq8HMF3mNgbWg8mqgU8hoBgp8pr7J+IQ/D4+/N3AZXonIn+fxgiI5+Brp3WTgQyRvH3KruHjnb0abk5Cr0ZYXXVtV/IAhTh73l0/QZC3FekXiXFD1YYcNIuv+cGLa2jitlK2CtyJmJoI3H5kTV2IhBRJLWgqa3KtP6qtMPQiwsGOfsU6J+uRK880+Ss4pRH4AjHiHM0Pc7U0HRK7NuaXNFQ1MdU4fPoqJH3w830t2jQo67SHxA== Received: from DM6PR12MB3945.namprd12.prod.outlook.com (2603:10b6:5:1c2::27) by DM5PR1201MB0074.namprd12.prod.outlook.com (2603:10b6:4:57::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.20; Sun, 18 Apr 2021 17:20:42 +0000 Received: from DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::9d62:2f16:264b:285d]) by DM6PR12MB3945.namprd12.prod.outlook.com ([fe80::9d62:2f16:264b:285d%5]) with mapi id 15.20.4042.024; Sun, 18 Apr 2021 17:20:42 +0000 From: Tal Shnaiderman To: Jie Zhou , "dev@dpdk.org" CC: "dmitry.kozliuk@gmail.com" , "xiaoyun.li@intel.com" , "roretzla@microsoft.com" , "pallavi.kadam@intel.com" , NBU-Contact-Thomas Monjalon , "bruce.richardson@intel.com" , "ferruh.yigit@intel.com" Thread-Topic: [dpdk-dev] [PATCH v5 5/9] app/testpmd: add clock_gettime_monotonic Thread-Index: AQHXMuodV2g2xxYw4kyo/O0wvShzvqq6hf1A Date: Sun, 18 Apr 2021 17:20:42 +0000 Message-ID: References: <1618594501-23795-10-git-send-email-jizh@linux.microsoft.com> <1618595864-27839-1-git-send-email-jizh@linux.microsoft.com> <1618595864-27839-6-git-send-email-jizh@linux.microsoft.com> In-Reply-To: <1618595864-27839-6-git-send-email-jizh@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux.microsoft.com; dkim=none (message not signed) header.d=none;linux.microsoft.com; dmarc=none action=none header.from=nvidia.com; x-originating-ip: [5.29.61.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 35f3f83e-8889-46e5-4b64-08d9028e4b8e x-ms-traffictypediagnostic: DM5PR1201MB0074: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-transport-forked: True x-ms-oob-tlc-oobclassifiers: OLM:364; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LNFy07gr4h6i/j/naJ3hpIkY77WoH/ZdwWGxfWrJ+rl+M4DFo/atCHLJ3DtQRoVG1+uPUBC1xL1IVIwLt+MrDgsZCRSTWqhqsttVbwBAt8Un2QU6m8elXCVY83VYhzejpgE7Vkho0meP4afV8LZg5FJf+4SROsOtw0eSNkTccSycku+n4dHH+ozCd/gXoUvVpAcLM24bINLkdfskWMLSOYar3yiVfLSAwlOFhDebu/MGfMOzdhbsyXEuQl8KT6Hy+16d16EujN+B03w3I1vSivbwAQDaKcgrmPA1JPfFegwi4u/jMZrb1vMN4xRXl5Xzku+IPijAdZzW4/TGEskWrW35WChgyZ5ciIeBklrmZuGpfGSWVNVTRFkLxDHJLPrxC5veWwvvzWqXE7r8T0sZVtxQpXlQ4yjGMY5S1Gn7Vi/TQj9hK7hSBLsgYpZEbkUcXzCCQV382pObANyPQaalb+2LeE3W9E16CAr+TwDiqhPuNeyqQsKD5KMdotaf/GTPu9poHZSTox7rsk4OqWgo1k5HvANpkybLcKL+SkzxpigU2Bpu5EHCUD6LSnEqXkJgJkb+J74FtaQbJ4WQtI9kmgJgKudM0YsTGTfesVoeEAg= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3945.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(39860400002)(346002)(396003)(366004)(478600001)(8936002)(26005)(316002)(66946007)(66476007)(66556008)(186003)(122000001)(33656002)(86362001)(5660300002)(76116006)(83380400001)(4326008)(64756008)(66446008)(38100700002)(52536014)(8676002)(54906003)(9686003)(110136005)(6506007)(7696005)(55016002)(71200400001)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?SmZyHRRkDGpxCx9SQ7pfjPUD/6UfpKDhVu5h7k3bFLrwOySiBjbjfiHeVJbE?= =?us-ascii?Q?0d7hLOQQ/KVLy1YncYnjgIuaRpRh1vBBcrJD9zYB11GrXfhfQ1uo+uMG9jw+?= =?us-ascii?Q?ifalDmuKtMMCPzekJuR7u5ycl+1BZMe1KRu4d/vGdSC+IZlBoIFSit2i7Y4N?= =?us-ascii?Q?WFDGZB5nIEpLM5abLJDwGY2299OUVCm+8AQithCKRgywE9SoikQH47fxie3s?= =?us-ascii?Q?SDqDFhy8Pu809CBQ28MqiaD2PvkZIigOHJwBNLm3pBSK6D9W9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P0LRlx8mSsTsNFm692ty4ntCvJViDIw?= =?us-ascii?Q?INminTZFC1ZzarJgoEqdFMx8lF+cG8Q5DbBJrc+ZyiuTTQZVYPOUP8oqhWsS?= =?us-ascii?Q?Mw+kpqFs7CxJkTML0jkSusBXemxp6NqT4ILv9bixX06yvrCr+9EGAJefvZHs?= =?us-ascii?Q?Le4=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3945.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35f3f83e-8889-46e5-4b64-08d9028e4b8e X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2021 17:20:42.4234 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8BjcgEMgLFNhzx6+VGbjjjPGPamPZ+ObOhw57yiZDLBJErRz0Pa1azOqv1TumLlatuqZVStJIPkRuv1zRpF+lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0074 Subject: Re: [dpdk-dev] [PATCH v5 5/9] app/testpmd: add clock_gettime_monotonic 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" > Subject: [dpdk-dev] [PATCH v5 5/9] app/testpmd: add > clock_gettime_monotonic >=20 > External email: Use caution opening links or attachments >=20 >=20 > Add clock_gettime_monotonic for testpmd on Windows >=20 > Signed-off-by: Jie Zhou > Signed-off-by: Jie Zhou > --- > app/test-pmd/config.c | 33 ++++++++++++++++++++++++++++++++- > 1 file changed, 32 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > ef0b9784d..a5f8fec5b 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -63,6 +63,12 @@ >=20 > #define NS_PER_SEC 1E9 >=20 > +#ifdef RTE_EXEC_ENV_WINDOWS > +#define _clock_gettime_monotonic(cur_time) > +clock_gettime_monotonic(&cur_time) > +#else > +#define _clock_gettime_monotonic(cur_time) > clock_gettime(CLOCK_TYPE_ID, > +&cur_time) #endif > + I think this change should be in EAL: rte_get_time_monotonic(&cur_time) Windows implementation in windows\eal_timer.c Unix implementation in unix\eal_unix_timer.c > static char *flowtype_to_str(uint16_t flow_type); >=20 > static const struct { > @@ -170,6 +176,27 @@ print_ethaddr(const char *name, struct > rte_ether_addr *eth_addr) > printf("%s%s", name, buf); > } >=20 > +#ifdef RTE_EXEC_ENV_WINDOWS > +static int > +clock_gettime_monotonic(struct timespec *tp) { > + LARGE_INTEGER pf, pc; > + LONGLONG nsec; > + > + if (QueryPerformanceFrequency(&pf) =3D=3D 0) > + return -1; > + > + if (QueryPerformanceCounter(&pc) =3D=3D 0) > + return -1; > + > + nsec =3D pc.QuadPart * NS_PER_SEC / pf.QuadPart; > + tp->tv_sec =3D nsec / NS_PER_SEC; > + tp->tv_nsec =3D nsec - tp->tv_sec * NS_PER_SEC; > + > + return 0; > +} > +#endif > + > void > nic_stats_display(portid_t port_id) > { > @@ -186,6 +213,8 @@ nic_stats_display(portid_t port_id) >=20 > static const char *nic_stats_border =3D "########################= "; >=20 > + int ret; > + > if (port_id_is_invalid(port_id, ENABLED_WARN)) { > print_valid_ports(); > return; > @@ -202,7 +231,9 @@ nic_stats_display(portid_t port_id) > "%-"PRIu64"\n", stats.opackets, stats.oerrors, stats.obyte= s); >=20 > diff_ns =3D 0; > - if (clock_gettime(CLOCK_TYPE_ID, &cur_time) =3D=3D 0) { > + > + ret =3D _clock_gettime_monotonic(cur_time); > + if (ret =3D=3D 0) { > uint64_t ns; >=20 > ns =3D cur_time.tv_sec * NS_PER_SEC; > -- > 2.30.0.vfs.0.2