From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CDC09A046B for ; Wed, 21 Aug 2019 19:17:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A11761BF04; Wed, 21 Aug 2019 19:17:07 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id DD6A01BEFE for ; Wed, 21 Aug 2019 19:17:05 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 10:17:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="178563327" Received: from jrharri1-skx.ch.intel.com (HELO [127.0.1.1]) ([143.182.137.73]) by fmsmga008.fm.intel.com with ESMTP; 21 Aug 2019 10:17:04 -0700 From: Jim Harris To: dev@dpdk.org, anatoly.burakov@intel.com Date: Wed, 21 Aug 2019 03:11:59 -0700 Message-ID: <156638231931.9280.8609519357170012878.stgit@jrharri1-skx> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH] timer: remove check_tsc_flags() 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" This code was added 7+ years ago (commit fb022b85ba), presumably when variant TSCs were still somewhat common? But this code doesn't do anything except print a warning, and the warning doesn't give any kind of advice to the user, so let's just remove it. While the warning has no functional meaning, the /proc/cpuinfo parsing consumes a non-trivial amount of time which is especially noticeable in secondary processes. On my test system, it consumes 21ms out of the 66ms total execution time for rte_eal_init() in a secondary process. Signed-off-by: Jim Harris --- lib/librte_eal/linux/eal/eal_timer.c | 36 ---------------------------------- 1 file changed, 36 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_timer.c b/lib/librte_eal/linux/eal/eal_timer.c index 76ec17034..a904a8297 100644 --- a/lib/librte_eal/linux/eal/eal_timer.c +++ b/lib/librte_eal/linux/eal/eal_timer.c @@ -192,41 +192,6 @@ rte_eal_hpet_init(int make_default) } #endif -static void -check_tsc_flags(void) -{ - char line[512]; - FILE *stream; - - stream = fopen("/proc/cpuinfo", "r"); - if (!stream) { - RTE_LOG(WARNING, EAL, "WARNING: Unable to open /proc/cpuinfo\n"); - return; - } - - while (fgets(line, sizeof line, stream)) { - char *constant_tsc; - char *nonstop_tsc; - - if (strncmp(line, "flags", 5) != 0) - continue; - - constant_tsc = strstr(line, "constant_tsc"); - nonstop_tsc = strstr(line, "nonstop_tsc"); - if (!constant_tsc || !nonstop_tsc) - RTE_LOG(WARNING, EAL, - "WARNING: cpu flags " - "constant_tsc=%s " - "nonstop_tsc=%s " - "-> using unreliable clock cycles !\n", - constant_tsc ? "yes":"no", - nonstop_tsc ? "yes":"no"); - break; - } - - fclose(stream); -} - uint64_t get_tsc_freq(void) { @@ -263,6 +228,5 @@ rte_eal_timer_init(void) eal_timer_source = EAL_TIMER_TSC; set_tsc_freq(); - check_tsc_flags(); return 0; }