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 82218A0562; Mon, 3 May 2021 19:37:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6AD1D40150; Mon, 3 May 2021 19:37:29 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2080.outbound.protection.outlook.com [40.107.94.80]) by mails.dpdk.org (Postfix) with ESMTP id 7DBDD4014E for ; Mon, 3 May 2021 19:37:27 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oAP84fNJE8/2w86Tv5N+t77zUIJ8LrokkuvvkOr64Bh4rUB5RwQcedx/rMiHrek1l9v+7jGuI4ZOL/l9D+shOtFicPgqmIrA0ZaFCuasRZXSCioKHDsH9b4ha6mDzRq9ExnvmkBfqEOwQ2mlfcoMawISV1DQm+O/NnsyWIc6lvZxiNnySLb5dzFGZLVhKNI78knw8Br+BAcz8im1nTt2dDPJehfuPvIVrLg6nrQvICSmgzrmwo06ZNaDZ2/+HHuSG06/HiK2q6xFRXBPIdvoLrrTaES+U40/4lU/v7fVdeBUZcLZZ8EJ9K/0FTnsCkWcIR/4g7DReiKnp0eZNeniGg== 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=GcT7NME0xOmNiNQF1WKhqwUubLwBxobh8fGLaViVKqo=; b=S3eTMbMhRhjmzV/Tc8mpI6SI3c4DzFP8acCHHuhSbm6gy1VFKmt+1o5p2kF7qFlTRt2Ac8bvzCi2gBAmUY/WVVh61FJ4WIS1SOmJmuZQglqF5aI2ngX0Jmbyh43QKnIUsAD697AqCbTl4+ijr0+Nms55vcFQEa+X2AK+FwOaRzgkg5cIjTzBmaj54ZDCtVVCyll5XaQoT6wX+ndWVTe29lBdq6hJMyuMXtGm1Y/lOz7YAXBgGb1H0IPPyE67KCEcarBPGgPyR/qGMR9vZKzUJ9edY5grBxs/ddhASlmtGbRRqnisLuLQdB0fOKRmufHSlpOqfwzVTVX4D9b9L0VJYg== 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=GcT7NME0xOmNiNQF1WKhqwUubLwBxobh8fGLaViVKqo=; b=ngSqdJrJLSnrNQc/d9eeVyYUYo/2MvgwFhCUjqiUjnNcbESKMi30l6JCHhZye8CGkhpURHY+92fodZSsd+yeqBbCbjyP57BVCH7xD7DQmcTNyVJfBOdXGOlrqwgLTtC8Ne/y2PeI6YTTGJ5XEMgDvNSVfa92CKzddwM8AnBA9jhvICgw3p2Z4zzXv6hOkBLfBdiX+LzzEOVix1oc7T7K6GJDJ+z/gRRQNgZMzMcC52DpE1IIl3WJ7RvIdqOBTMITQvKSOorpmOCihL/GCLB4HntzB6G/9EJUfm+SxQE8fNtSLAtlFkxeYgOMnEpzzf0Vq701WgbLnLSPDbGG1CXxmA== Received: from DM4PR12MB5389.namprd12.prod.outlook.com (2603:10b6:5:39a::7) by DM4PR12MB5168.namprd12.prod.outlook.com (2603:10b6:5:397::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.38; Mon, 3 May 2021 17:37:25 +0000 Received: from DM4PR12MB5389.namprd12.prod.outlook.com ([fe80::70df:ef1e:d98c:ce4]) by DM4PR12MB5389.namprd12.prod.outlook.com ([fe80::70df:ef1e:d98c:ce4%6]) with mapi id 15.20.4087.044; Mon, 3 May 2021 17:37:24 +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" , "konstantin.ananyev@intel.com" Thread-Topic: [PATCH v9 04/10] eal/Windows: add clock_gettime on Windows Thread-Index: AQHXPemiCsylce13/EWO6PU6f70+varSB4zg Date: Mon, 3 May 2021 17:37:24 +0000 Message-ID: References: <1619553721-5220-1-git-send-email-jizh@linux.microsoft.com> <1619805162-10684-1-git-send-email-jizh@linux.microsoft.com> <1619805162-10684-5-git-send-email-jizh@linux.microsoft.com> In-Reply-To: <1619805162-10684-5-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.16.219] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6f94b200-efbe-4d4b-afc0-08d90e5a1d0b x-ms-traffictypediagnostic: DM4PR12MB5168: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3826; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dIHQjk9sKaXnw45vaAGu223UpKHrtrA7O0a7/1fwnqbr9XVAYK6pX+9YzhWuQzLOd6HRK1erFNYsnYXi+4NheS9pwGx4Xp21z+bPao7he3GrLSgvIry0ZEMJINYtdqAxAVaRmzxqoi9xjamPvWFgqCe0a1ZTKob+Z68/hIRF2p5Ji1TxuASMu6avK1pqkFOw2pRLOpL4vZtxLLNokfqzsDXRmSh0rB6IGIv5SyitNVsol6BIyzdh9gHAUVrALgGk+1HxCgENSmLx2w+Dmo3j/FdDT+TD06mm5phsBYD7Ip4GNhybxQYguqNNLxjgGda/8pjaYD85itcwzvVoyrKpE5jgOkX3+3alMEZQtYT3BuCeK/ZN3E7oRko4DI0CUIYFlVN3WeBrz++o4aNRQl1CqYoxauFh7DJZnUCnhXWSPCVuXNo+UR4zKFd2lCksib3sTZzzQJbjNGyn9cUBQGAvNpXIfUj+SkHD7S+JTaO3MTJY/nJARcdAloSSg7bjOhobjd5jzoYBQOq6rB+81sojXNocwawB8fEyM4DbX0UBStZ+yNwMzdtyG8ldAUiz90TwyBP5R2nD1y88cv1pumYTCQc+7AY6qU2nMLjHbYDTfLA= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5389.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(376002)(366004)(346002)(396003)(52536014)(66946007)(66556008)(64756008)(2906002)(33656002)(66476007)(6506007)(66446008)(4326008)(71200400001)(38100700002)(86362001)(186003)(7696005)(76116006)(122000001)(7416002)(8676002)(83380400001)(8936002)(54906003)(5660300002)(55016002)(110136005)(316002)(478600001)(9686003)(26005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?55G06+bLZQxy+c9xdMu6VC0+0d7G3VSvhHerhejzFpRbW8mpU7TBRIv1fm6H?= =?us-ascii?Q?81uu/LMrQrTXuvPL2Z2aq996x0bWaxoE4CGs0toCSJ6lZog7xmVbWNphMW2L?= =?us-ascii?Q?ckpD5GakMs0VZtPPP5JHBx/WCFRC1DBguQKzZEsAQ0Vm8xUvIbyIBEmFwOb7?= =?us-ascii?Q?AhZGtI2pY/p+MoHIYdF52dqWHiE3xPDOA4+3QJXg2/1CPyUWJBObpmdfUP1q?= =?us-ascii?Q?AfjqqkKsf4HQignZT+aOfoGndNY+kKQX09yRGEkhp30sXzOzOPl0E9Q5IIW1?= =?us-ascii?Q?Qy86RBV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p6zEu5dsyQlCF/?= =?us-ascii?Q?Vx0cPz3E5YToy2wI7wtwejLf5INx7Agtk6FrztZnqdLk/V8b+FHF+WusPhGc?= =?us-ascii?Q?2njkZwPB5WP/lQlJuvkALLVKsx8H8oJM270UldAqfyuzNgP14lsJp54ehyj2?= =?us-ascii?Q?olk=3D?= x-ms-exchange-transport-forked: True 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: DM4PR12MB5389.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f94b200-efbe-4d4b-afc0-08d90e5a1d0b X-MS-Exchange-CrossTenant-originalarrivaltime: 03 May 2021 17:37:24.6039 (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: 6RHKfLYMMUCx7mso93rSJk/gJhiiVFQ0C9QdZGQnWPXz6qMoKXG/kFhpjYu1wmt676FETd2wsKPR0ukgXVaGzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5168 Subject: Re: [dpdk-dev] [PATCH v9 04/10] eal/Windows: add clock_gettime on Windows 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: [PATCH v9 04/10] eal/Windows: add clock_gettime on Windows >=20 > External email: Use caution opening links or attachments >=20 >=20 > Add clock_gettime on Windows in rte_os_shim.h >=20 > Signed-off-by: Jie Zhou > Signed-off-by: Jie Zhou > --- > app/test-pmd/config.c | 1 + Unneeded change > lib/eal/windows/include/rte_os_shim.h | 38 > +++++++++++++++++++++++++++ > 2 files changed, 39 insertions(+) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > e189062ef..0e86ed02f 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -205,6 +205,7 @@ 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) { > uint64_t ns; >=20 > diff --git a/lib/eal/windows/include/rte_os_shim.h > b/lib/eal/windows/include/rte_os_shim.h > index e60f27400..ec1087290 100644 > --- a/lib/eal/windows/include/rte_os_shim.h > +++ b/lib/eal/windows/include/rte_os_shim.h > @@ -75,4 +75,42 @@ rte_timespec_get(struct timespec *now, int base) >=20 > #endif /* RTE_TOOLCHAIN_GCC */ >=20 > +/* Identifier for system-wide realtime clock. */ > +#define CLOCK_REALTIME 0 > +/* Monotonic system-wide clock. */ > +#define CLOCK_MONOTONIC 1 > +/* High-resolution timer from the CPU. */ > +#define CLOCK_PROCESS_CPUTIME_ID 2 > +/* Thread-specific CPU-time clock. */ > +#define CLOCK_THREAD_CPUTIME_ID 3 > + > +#define NS_PER_SEC 1E9 > + > +typedef int clockid_t; > + > +static inline int > +rte_clock_gettime(clockid_t clock_id, struct timespec *tp) { > + LARGE_INTEGER pf, pc; > + LONGLONG nsec; > + switch (clock_id) { > + case CLOCK_REALTIME: > + if (timespec_get(tp, TIME_UTC) !=3D TIME_UTC) > + return -1; > + return 0; > + case CLOCK_MONOTONIC: > + 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; > + default: > + return -1; > + } > +} > +#define clock_gettime(clock_id, tp) rte_clock_gettime(clock_id, tp) > + > #endif /* _RTE_OS_SHIM_ */ > -- > 2.30.0.vfs.0.2