From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 2A21F11A4 for ; Sat, 16 Mar 2019 08:05:55 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2G701MJ014360; Sat, 16 Mar 2019 00:05:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=7xl5GVciG32mgCvJTaGSYXFNBWhPQMMg5pAcSHBfkzo=; b=mjfHiK/qPnxkiaxJt+tFrFvMX4oionAiZc7hS7g959BY5I2dYKY4ID3fiKjCicORZouh kXvrrWUj9mM4gpOkWF5+cjK86LrGzUZM2jDiP+o+nOgx2tIeF/dQCd8Wirf9wj1jbL0q JY+dfCkt3rf4h0y236EF4qEoGTIwQ4BKjT6leoG0A14up5wk8mKAvJGZNm+CI/RK15if pmlIeUJCmJBTJuKzbdh8udZs+P/FkE5xQKyd0Xo0ghUOmdxhlfdi3HYkuWYgOqxugrW0 jwnP+QSKcuET7phCMl+zOVtcdpM2rU5yJ2uN8AKnMzfMfRZhvDBNyOy6+jfjNepBPAUo uQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2r8kaa0y8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 16 Mar 2019 00:05:54 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 16 Mar 2019 00:03:38 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.55) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sat, 16 Mar 2019 00:03:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7xl5GVciG32mgCvJTaGSYXFNBWhPQMMg5pAcSHBfkzo=; b=ft7CJV+F0ztNJQpaa89tnH0S/LKJhbT8suFKmZygTLpg9ER9Z/3VGqMcsgYp4FN8BOpkcOtO5lGdDmFQm2xg5SQmtF6OXNoTqxE5iu7/IDgCJ+tC/KETBU7Y/GOPr+TLF5nSaV8/FZ7yRXYWQMF0XlWH1z4VdsZHV0pVp1r4yJM= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1815.namprd18.prod.outlook.com (10.165.88.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.19; Sat, 16 Mar 2019 07:03:36 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::286d:5e93:974e:8bfa]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::286d:5e93:974e:8bfa%2]) with mapi id 15.20.1709.011; Sat, 16 Mar 2019 07:03:36 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "stephen@networkplumber.org" , "thomas@monjalon.net" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula Thread-Topic: [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it Thread-Index: AQHU28ZfRUfyFSEKwUiYLm/lxX2a+w== Date: Sat, 16 Mar 2019 07:03:36 +0000 Message-ID: <20190316070302.32432-2-pbhagavatula@marvell.com> References: <20181129083138.23029-1-pbhagavatula@caviumnetworks.com> <20190316070302.32432-1-pbhagavatula@marvell.com> In-Reply-To: <20190316070302.32432-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0072.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::12) To CY4PR1801MB1863.namprd18.prod.outlook.com (2603:10b6:910:7a::14) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [122.167.180.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b6b1e01e-5a12-4efa-981c-08d6a9dd81ba x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:CY4PR1801MB1815; x-ms-traffictypediagnostic: CY4PR1801MB1815: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; CY4PR1801MB1815; 23:jsWklhxcO2h14GKuqsnbP5f/Xm8xPIZtKAJIy?= =?iso-8859-1?Q?q2vcBsE1Xf5gZd4WVzVrV3rBk+k+znX1MLzbePNGoIq89H+VPSBkSHcm3D?= =?iso-8859-1?Q?CgwKrjWSc9N2OzlP7s8ScoLklWrV4ZddyLylqu1wPgBVNZV+9cOcSh+0yU?= =?iso-8859-1?Q?7F9MmfTpM5CN5E6Axf5eLmw5M3n9nYrDKtAtRsgxb44sj58YOxe19QjB6L?= =?iso-8859-1?Q?Juc9tqFrtv8mcgBE2ywCgb1Bfzi3PSB5SdWoif6B23vaGnyX0EpwL0upSj?= =?iso-8859-1?Q?XWUMuRn1qX6Q+jhy1n87A/R+TAu9xox34bwHpWToHpi5mt2Zr9mZmaf2Mf?= =?iso-8859-1?Q?3L54AA4Aggm6uHhLYqujaAScUtj4dgmr+EF8OQ6tRutQxBMrMrPXMtjiA0?= =?iso-8859-1?Q?w3n+/tpAjqlej5qj17Gv70OwBpUiWnijzHgtDQkMbUwYITflOrcoP3qL3b?= =?iso-8859-1?Q?YnikhXBQBib9p3eNh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D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09781D4C35 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(346002)(376002)(396003)(39860400002)(199004)(189003)(1076003)(81156014)(305945005)(6506007)(316002)(386003)(2501003)(8676002)(476003)(105586002)(106356001)(102836004)(99286004)(11346002)(7736002)(256004)(6486002)(26005)(54906003)(71190400001)(478600001)(86362001)(97736004)(71200400001)(5660300002)(14454004)(2201001)(2616005)(6436002)(53936002)(52116002)(6512007)(8936002)(486006)(68736007)(446003)(36756003)(4326008)(107886003)(50226002)(3846002)(110136005)(76176011)(2906002)(6116002)(78486014)(186003)(66066001)(25786009)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1815; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: zhKpSUfdHf//JczIwOFYoSxl7OlD8tG+7H+4kdHXSZ2iiM6/28wJJunpxotweK9D+HRDbdH5a+uTZf2DZANuSdVBqE3S7/2iCAqmn2JmNYQc3QfAB4P4QPByix8YK9vC+W+adgjBYEVdIDZMIhAkqvNgX9U87/GDO2Uifsjtl/rMJKDfhQclOM2pG+QVMniT/4VzgwjdEF7qh7KQ4RY+yUp1aTLKvjS8iC+Mtw4V3AAJY80eLCL9BKoUrj3YkIL/kPZmXDqbmAIGpoAcfcjEbax5uW0/1FBmIf/DZUj6ZKLWmJMlv8iZ+abuCTDTF0Eby5zSVf5LhX0YC5HeUzEj+w0VALbFAL2HkPvNgSLb/SRhzym5kMsZJTWlW4+qFG/z87D9IsdHvM9TfO/KywA9rex/O9jiiR9gPh/XBqFUfFg= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b6b1e01e-5a12-4efa-981c-08d6a9dd81ba X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2019 07:03:36.0848 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1815 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-16_05:, , signatures=0 Subject: [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Mar 2019 07:05:55 -0000 From: Pavan Nikhilesh When estimating tsc frequency using sleep/gettime round it up to the nearest multiple of 10Mhz for more accuracy. Signed-off-by: Pavan Nikhilesh --- Useful in case of ARM64 if we enable RTE_ARM_EAL_RDTSC_USE_PMU, get_tsc_freq_arch() will return 0 as there is no instruction to determine the clk of PMU and eal falls back to sleep(1). lib/librte_eal/common/eal_common_timer.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_timer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/comm= on/eal_common_timer.c index dcf26bfea..1358bbed0 100644 --- a/lib/librte_eal/common/eal_common_timer.c +++ b/lib/librte_eal/common/eal_common_timer.c @@ -69,7 +69,7 @@ estimate_tsc_freq(void) /* assume that the sleep(1) will sleep for 1 second */ uint64_t start =3D rte_rdtsc(); sleep(1); - return rte_rdtsc() - start; + return RTE_ALIGN_MUL_NEAR(rte_rdtsc() - start, 1E7); } void @@ -83,7 +83,7 @@ set_tsc_freq(void) if (!freq) freq =3D estimate_tsc_freq(); - RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000); + RTE_LOG(INFO, EAL, "TSC frequency is ~%" PRIu64 " Hz\n", freq); eal_tsc_resolution_hz =3D freq; } diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c b/lib/librte_eal/linux= app/eal/eal_timer.c index bc8f05199..864d6ef29 100644 --- a/lib/librte_eal/linuxapp/eal/eal_timer.c +++ b/lib/librte_eal/linuxapp/eal/eal_timer.c @@ -248,7 +248,7 @@ get_tsc_freq(void) double secs =3D (double)ns/NS_PER_SEC; tsc_hz =3D (uint64_t)((end - start)/secs); - return tsc_hz; + return RTE_ALIGN_MUL_NEAR(tsc_hz, 1E7); } #endif return 0; -- 2.21.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 945F9A0096 for ; Sat, 16 Mar 2019 08:05:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0C4D91BE0; Sat, 16 Mar 2019 08:05:57 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 2A21F11A4 for ; Sat, 16 Mar 2019 08:05:55 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2G701MJ014360; Sat, 16 Mar 2019 00:05:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=7xl5GVciG32mgCvJTaGSYXFNBWhPQMMg5pAcSHBfkzo=; b=mjfHiK/qPnxkiaxJt+tFrFvMX4oionAiZc7hS7g959BY5I2dYKY4ID3fiKjCicORZouh kXvrrWUj9mM4gpOkWF5+cjK86LrGzUZM2jDiP+o+nOgx2tIeF/dQCd8Wirf9wj1jbL0q JY+dfCkt3rf4h0y236EF4qEoGTIwQ4BKjT6leoG0A14up5wk8mKAvJGZNm+CI/RK15if pmlIeUJCmJBTJuKzbdh8udZs+P/FkE5xQKyd0Xo0ghUOmdxhlfdi3HYkuWYgOqxugrW0 jwnP+QSKcuET7phCMl+zOVtcdpM2rU5yJ2uN8AKnMzfMfRZhvDBNyOy6+jfjNepBPAUo uQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2r8kaa0y8h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 16 Mar 2019 00:05:54 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 16 Mar 2019 00:03:38 -0700 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.55) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sat, 16 Mar 2019 00:03:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7xl5GVciG32mgCvJTaGSYXFNBWhPQMMg5pAcSHBfkzo=; b=ft7CJV+F0ztNJQpaa89tnH0S/LKJhbT8suFKmZygTLpg9ER9Z/3VGqMcsgYp4FN8BOpkcOtO5lGdDmFQm2xg5SQmtF6OXNoTqxE5iu7/IDgCJ+tC/KETBU7Y/GOPr+TLF5nSaV8/FZ7yRXYWQMF0XlWH1z4VdsZHV0pVp1r4yJM= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.14) by CY4PR1801MB1815.namprd18.prod.outlook.com (10.165.88.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.19; Sat, 16 Mar 2019 07:03:36 +0000 Received: from CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::286d:5e93:974e:8bfa]) by CY4PR1801MB1863.namprd18.prod.outlook.com ([fe80::286d:5e93:974e:8bfa%2]) with mapi id 15.20.1709.011; Sat, 16 Mar 2019 07:03:36 +0000 From: Pavan Nikhilesh Bhagavatula To: Jerin Jacob Kollanukkaran , "stephen@networkplumber.org" , "thomas@monjalon.net" CC: "dev@dpdk.org" , Pavan Nikhilesh Bhagavatula Thread-Topic: [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it Thread-Index: AQHU28ZfRUfyFSEKwUiYLm/lxX2a+w== Date: Sat, 16 Mar 2019 07:03:36 +0000 Message-ID: <20190316070302.32432-2-pbhagavatula@marvell.com> References: <20181129083138.23029-1-pbhagavatula@caviumnetworks.com> <20190316070302.32432-1-pbhagavatula@marvell.com> In-Reply-To: <20190316070302.32432-1-pbhagavatula@marvell.com> Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0072.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00::12) To CY4PR1801MB1863.namprd18.prod.outlook.com (2603:10b6:910:7a::14) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [122.167.180.250] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b6b1e01e-5a12-4efa-981c-08d6a9dd81ba x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:CY4PR1801MB1815; x-ms-traffictypediagnostic: CY4PR1801MB1815: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; CY4PR1801MB1815; 23:jsWklhxcO2h14GKuqsnbP5f/Xm8xPIZ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OeLCaxbJ+hh9nUj77PUHecM4TCMuhH0V6ty3YOjWx8?= =?iso-8859-1?Q?/tTz2yZYKMlkz3jLWIB9EHgqJL+B3sY/ITliDpvRdnIh3fJOH8otmKckAZ?= =?iso-8859-1?Q?M+L9nirtQA9iSsR7cSm8Z6YkhGT+/e8F4ye4ZJBFlE6qiEjeEsLGqx3tKH?= =?iso-8859-1?Q?8XD/D+VQk7zfUm1BcP85YjJQT4VTDQa/n4TEY9+M4kzcSRrB6jcpK8TVoK?= =?iso-8859-1?Q?AE7tN4Acr8hBsV9sVuTqiaGXzTx62U9y+NkSsQX06UwxiaG1JWZKN4cZpn?= =?iso-8859-1?Q?RH4yJjpu+twZZ7BGl0zZc8gYHO71CatieF1F+mTgJQkhTJnf8BPD1XMj8b?= =?iso-8859-1?Q?LhSFQFyDHVZR0XMmx3BZRVK121hxuj5y2/oeApL91iKMlrGcV1gy9s+klw?= =?iso-8859-1?Q?JSF0XnVpFjCbaZKVSdDKMF417FQGaSBwgNYQoYxkAbaaMoA=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09781D4C35 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(346002)(376002)(396003)(39860400002)(199004)(189003)(1076003)(81156014)(305945005)(6506007)(316002)(386003)(2501003)(8676002)(476003)(105586002)(106356001)(102836004)(99286004)(11346002)(7736002)(256004)(6486002)(26005)(54906003)(71190400001)(478600001)(86362001)(97736004)(71200400001)(5660300002)(14454004)(2201001)(2616005)(6436002)(53936002)(52116002)(6512007)(8936002)(486006)(68736007)(446003)(36756003)(4326008)(107886003)(50226002)(3846002)(110136005)(76176011)(2906002)(6116002)(78486014)(186003)(66066001)(25786009)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1815; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: zhKpSUfdHf//JczIwOFYoSxl7OlD8tG+7H+4kdHXSZ2iiM6/28wJJunpxotweK9D+HRDbdH5a+uTZf2DZANuSdVBqE3S7/2iCAqmn2JmNYQc3QfAB4P4QPByix8YK9vC+W+adgjBYEVdIDZMIhAkqvNgX9U87/GDO2Uifsjtl/rMJKDfhQclOM2pG+QVMniT/4VzgwjdEF7qh7KQ4RY+yUp1aTLKvjS8iC+Mtw4V3AAJY80eLCL9BKoUrj3YkIL/kPZmXDqbmAIGpoAcfcjEbax5uW0/1FBmIf/DZUj6ZKLWmJMlv8iZ+abuCTDTF0Eby5zSVf5LhX0YC5HeUzEj+w0VALbFAL2HkPvNgSLb/SRhzym5kMsZJTWlW4+qFG/z87D9IsdHvM9TfO/KywA9rex/O9jiiR9gPh/XBqFUfFg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b6b1e01e-5a12-4efa-981c-08d6a9dd81ba X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2019 07:03:36.0848 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1815 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-16_05:, , signatures=0 Subject: [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Message-ID: <20190316070336.b46m86gbHX7aW6FE6E6nGJ-YpT_UVUtf5GrWZqSC1V0@z> From: Pavan Nikhilesh When estimating tsc frequency using sleep/gettime round it up to the nearest multiple of 10Mhz for more accuracy. Signed-off-by: Pavan Nikhilesh --- Useful in case of ARM64 if we enable RTE_ARM_EAL_RDTSC_USE_PMU, get_tsc_freq_arch() will return 0 as there is no instruction to determine the clk of PMU and eal falls back to sleep(1). lib/librte_eal/common/eal_common_timer.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_timer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/comm= on/eal_common_timer.c index dcf26bfea..1358bbed0 100644 --- a/lib/librte_eal/common/eal_common_timer.c +++ b/lib/librte_eal/common/eal_common_timer.c @@ -69,7 +69,7 @@ estimate_tsc_freq(void) /* assume that the sleep(1) will sleep for 1 second */ uint64_t start =3D rte_rdtsc(); sleep(1); - return rte_rdtsc() - start; + return RTE_ALIGN_MUL_NEAR(rte_rdtsc() - start, 1E7); } void @@ -83,7 +83,7 @@ set_tsc_freq(void) if (!freq) freq =3D estimate_tsc_freq(); - RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq / 1000); + RTE_LOG(INFO, EAL, "TSC frequency is ~%" PRIu64 " Hz\n", freq); eal_tsc_resolution_hz =3D freq; } diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c b/lib/librte_eal/linux= app/eal/eal_timer.c index bc8f05199..864d6ef29 100644 --- a/lib/librte_eal/linuxapp/eal/eal_timer.c +++ b/lib/librte_eal/linuxapp/eal/eal_timer.c @@ -248,7 +248,7 @@ get_tsc_freq(void) double secs =3D (double)ns/NS_PER_SEC; tsc_hz =3D (uint64_t)((end - start)/secs); - return tsc_hz; + return RTE_ALIGN_MUL_NEAR(tsc_hz, 1E7); } #endif return 0; -- 2.21.0