From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0079.outbound.protection.outlook.com [104.47.36.79]) by dpdk.org (Postfix) with ESMTP id D748B374E for ; Tue, 2 May 2017 07:20:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=axtSm7xtiqVtaxlcmbDhsbWpiFaweDwYGjB1ww+zsIY=; b=cN6sNgIaBMI4fxWyiCde3WiyFYxS0EgZ092yeC3tC+AvhBCx+AUZjJrV4mbhdfmO7GhAqD/Ag0X4v9zQJTogtFM3T0t6orA/QaXVFyY0Q/OJXEiMNAwdlVywCFZMo3JGwmk/1WZxF41+978U92oLAxA+JHa/ri2teqiLKFBudio= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from jerin.domain.name (106.201.122.214) by BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Tue, 2 May 2017 05:20:19 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: thomas@monjalon.net, Jerin Jacob Date: Tue, 2 May 2017 10:49:51 +0530 Message-Id: <20170502051951.25038-1-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170501191207.6480-1-jerin.jacob@caviumnetworks.com> References: <20170501191207.6480-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [106.201.122.214] X-ClientProxiedBy: PS1PR0401CA0036.apcprd04.prod.outlook.com (10.169.107.174) To BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 775bdc0d-a305-4de1-1c7d-08d4911aeda5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 3:WhmoksHVEGrl61OoemAaE+K8W4V8zfOpE/Sw+l2wfScTbos0UicuTp2IApiGXsqhnHUgJBe68TVZYdFbUEDVc0SEXspRLTKDX3djbgvIPWgJUokmHG823UUd31KxTuzS+IE/aapB/6FW7S2NywK1sqn96puRgPcT+ylA3wiD9jxaV+A+yxMMsr1CWYEORnmWwkTpS92CRsbSw0hmLWKchbRZIMAhes6QM6SVK3ctStdQy/SQuFTavESXMG09O+IAG95wd+ZLHiFB79U0ehpyH8Xwqumed528Pow76YPLh5GCC/MBcPjtCq+kBtST/Fa4s9x4zrtV0e0EMQerh+e/kg==; 25:QZcz6L4L6bIA/+YcNXuh7OsqZXsi0j4ei9Gmi4+UsUcFrI9pGU3Y9yS/gTVpNF0ougcj23Wfw1idRpNbBuAICXIGm5VrmEIPNMW5ICRdFeaIFOAmeJ51YlCacejfI9YUkvM7Jiyxa0NFRZNItgYD7w2Lz87TDr5BlJMKu6KD/B2Up0GVciJ1GKXY5WA9L6xiLIjSTa5YCNUzX/dB/vHg5JeArgTdZnKEKxKBxFyy7vWl6TRUQ61RQcfHXKrAiRaR+bxNK4huslS6Y3B674CIXr1GoUEcaqn+1nV1CnyNQkkXLAsCMbYObMQrGBqUppwDI31FpVL4sR5jnvjUw64AFBIFevRiIqNNZhflKExUcM/DCpKO20xL1ftVK53S5Uwo40YrBOxBduRDX/ArUrpFD+uK7BrY++bapBBNkKggHPMRqHSZZ3bXA3FQTJQ72nbX6SSaJjl39Iw7ln5C6UucLw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 31:l3czo8RDBqYEHANMjifko1T8z//FB4rJbR4m1Nd0R/7lZQRiCsrWRXeCbDDAOLzj6doWYxpEf+AaOT6Yo8aPrAp0JjBIwORsuMdkxaYxy6N5ILHDVIJcPHyASNINdfaZZbjJKLpX3s1l89ozRxhNXt4Lb6Mw6cXhOHY1QVpuyFlWHnGbZ8OxAiRqlmVcPubFbffeT1PLV++Ltc53snTy59xt7jrh/X+ZM/I02Eb03BiW1Xk3QgvuMkAA11HylJ1q; 20:TwekO85gHNhnTQydAeVsXyjcjfizUJo+wHYZLLz4w4dlrKo6PmLRdksUm+uvjdIZnqQzquNB387HZsV18inGCGf5tmOEkq9qCzo0u7fMNrIHd0Aj1X2CE+hgXgqCrtjVWM7SpwJEPqWNwhWn2sbG/rhjjLg8CuHiFnxApzNLuC+2n9hQsrWqJFWaShTVf+iYp8Q95WDT4ktn7amIveX7WKPzK6y344toX9CxOk2YeToQrHbciu1EKN9JeVSONwOeWR3Rhsmc2bx7nSVaeybFbRD2H0766OnKQC/8uhn/83y46eSTC+mRwlKGRDAXyAdngR4Ssd6D7EKK7bQKEyAJqPhHipy5j0BVYgwRGudJgAnPWEyHXXymcn6us6KNy9gKABHccPz3RMUFBBegyPSV7oNEt8GtsXDtW1Bmyy5BoY8WCyk7biQX7QAdLjBValjQhZvWpMu7I457HABCFF8QzbdEYXWSq0ugmXZHMFs9TVGHsPinki1HcQCR9eg2gNUY7qouI+bbONwiCzr5hAp2Brg3hjh82B3XU+YYyUQaPO3TS1xfRqh6rubJA7H4gLu30Bo52sFzbVgYTDcqCLOIMI1SS5fkGRIbc+rw3UJ4Ahs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(3002001)(10201501046)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:BLUPR0701MB1713; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 4:2w+grZb0z2gUoHDmsr8lYqyL27uhR7bcZUUhYW9FeRsV6VzTrDJDCxkbjfGtJzbODEQZ+HZiT3m7MgxhxsWFANbGx8wpQg+NHRAz/ORbzJsb7nq924FaFlnq/A5MCllyPcqU5H1flz5p8LZMp5vqS+zGFJRGuDEgtOxsqmx+PDh7/8Noi63ciargZmyKBE9HWJ2cJ9lCoUQSauKUGgaSSC04qEFpMAhlP0HZDSxHiCRvADD8+vDPFBXRO1LqjLhgau+JnllucDdP0kJcarOYD1v2hDJy3HL/bOpe9HZdlAaEYcdNb9Tntlo8CpibsnJNHkAsGoy8AT0MIrrJHr8hj0x6EGUyixlXuygGBI/9Q+bXA/ZSQbtnsKXeFQjecbqIS7nZw/87ebw8bcp6cWovDOBbnytsd9jfRVb3Rx/k1uheDgXE8fwh72P441MA95z342mpbN8a2PTGpRohuXA99oTPwFhw+5a8xscMmn3496by9n0/e1oLpJL1x5jpDzFSYO4rVpQv9mvDgTBnph2Ld8BzqHLOLBg3O3+E368a1fsrvtTN5lqGMA8qjvG14ZPgmIP/ofTvELGJ+12kdFZE7iqp9J3hjtRdenYw1QAKO/fl0L6bsBN7yhXIGvU+JmAvJup5AAcUzjcLcZ8LU1f38977Zf8qjlVoSPr2wkQ/jU4PIpyJV/RSVnkhHK6ed8AZpMbS9elCu+qSHSIGClgAOXzJEh3QF+Oql392i5Jyjnww85DSyrWJcsImjKPz7nEgD+ctGn401ixCvPOOv39AOg== X-Forefront-PRVS: 02951C14DC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39840400002)(39850400002)(39400400002)(39410400002)(6116002)(50986999)(53936002)(33646002)(2351001)(6512007)(81166006)(1076002)(76176999)(4326008)(3846002)(42186005)(53416004)(8676002)(5660300001)(50466002)(6916009)(2361001)(110136004)(42882006)(5003940100001)(48376002)(25786009)(2950100002)(38730400002)(5009440100003)(6666003)(6486002)(107886003)(189998001)(7736002)(305945005)(66066001)(478600001)(36756003)(6506006)(47776003)(2906002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1713; H:jerin.domain.name; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1713; 23:nJhuwsKPXxW2JKhl7iFrkrpcej+oWnvdnFHC7ya?= =?us-ascii?Q?lvjaKe9Uk8AhdDVTHStfBPXY67TH3iAwsoXcFthTwaliVY932byF0gsWVaUL?= =?us-ascii?Q?V+BeOl8rGNG2/Xs2MGy3Z1gCl3C2YRPWlmY+gJChH4jXTmDGBpzCavV57ank?= =?us-ascii?Q?G/I7Fe+fgOlB1OYTOKWHutMKJgBvi/ZjhQokE1NIVdQa1qzfvRgQzttHAisn?= =?us-ascii?Q?CVopQ7JF5NnMnR0Ooi84ruH1L5OGvdeE6Idim/murTAE6CGs9WU/VuaQDPrq?= =?us-ascii?Q?6OywRT6GKpPZaYOkuOjN3SjHKSEC8+Vea8GXkG0SoQf9vWcJIJPPh5Md4HiV?= =?us-ascii?Q?7TNnTaB10M1TvUzWiPeVSqNJRxe0NdlXVCKD9Vx3pXPxs3cpkRe5Z/qJpgIw?= =?us-ascii?Q?F6XSfVZ3Iw8HN9fm2bvoY8/l+PTL5cCdCtfE3h6wuKbQa4sYU0Lk7Nh/8cvY?= =?us-ascii?Q?pPsV4C0wfQBk158zYjSk+7EM5MAToY7ObJTF1js6D2tGSlvombCWB5TDT8fM?= =?us-ascii?Q?URCvu9qB8VB2/WQB0C08Qm2QD1fPMei12EyIazI9dr1iGmcBhgN6ybZskOkQ?= =?us-ascii?Q?gWIoACN9r5yBed2m/9Nz/wWGn4t22bMPCdLxB4MnuxGLlCsqBZc/48D7JY9A?= =?us-ascii?Q?ZAkFybQ7sXFUdYHZHedNwXSN+3xBnyz3Lg7hF5aju8Pzty+DUjFXoPA4f/kD?= =?us-ascii?Q?97q3ybEfaGwvFqWAXTmW/2WXnHOrtEq2A4ALQXyG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06Jemh3ni622KA03uEXC45JlHQWCc1gYpU7WUcfEQuMNJ4KYvtvA==; 5:5akyntcaA1AMMTbg7YdLgOtHOWXl/CDPI/PEQZnCQt0jJ0u58q8dJM+vfQQCWdRL6MffCN5aQLVscCLeFHDsg3kiWL/dBB5vVitzBb1HVWvxmA+9mIRioIE/tMA7jl3x92jzBdrfI8bXgeN4tzM+FA==; 24:GRn9/HfvISRO6AZ7GZXL8M0qGtDvcOKT0gWidxLKZsihV7peuT5fL6soudl7i3pP/kF/MFroEQYVgLQ+a5emVgEtBaxv8L2Z8eaVJyrhmBU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 7:GvI2qBBTTzR+96N9+3GRzhfpdh95p8wZulKq6IZUq9fgAfnZ50XTndS2BwMKv3PJP93dUK6RYHKUQUvkNpQyj+NTg5eO4YZa68tFzUvSi5zyCBlfO3NUPgx22EWXStK2I9HC5kjVA279x6aC04tbOMExNXZvoaMbIkBhRVZnaqNvtzT+ZAcv2PFVS6EQo53uotgq83qVI+CAOcx0qNRZegF2UYIUbb0UQVkbiUpAKkEel/lZP6hr5ay7dWFXbW9mmQ83+BhXDdfdvMYZrNTNLzFQ845Ecd30j3Eu3zokmnpgojNIspEP4wiNSfvqk0CZlMNcEdp5PZLse//ywAeW1A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2017 05:20:19.0935 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1713 Subject: [dpdk-dev] [PATCH v2] eal: optimize timer routines 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: Tue, 02 May 2017 05:20:23 -0000 Since DPDK has only two timer sources, Avoid &eal_timer_source memory read and followed by the switch case statement when RTE_LIBEAL_USE_HPET is not defined. Signed-off-by: Jerin Jacob --- v2: - Rearrage the ifdef to avoiding the #else part by "unifdef" the first occurence of rte_get_tsc_cycles(Thomas) --- lib/librte_eal/common/include/generic/rte_cycles.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/include/generic/rte_cycles.h b/lib/librte_eal/common/include/generic/rte_cycles.h index 00103ca9f..0e645c2c4 100644 --- a/lib/librte_eal/common/include/generic/rte_cycles.h +++ b/lib/librte_eal/common/include/generic/rte_cycles.h @@ -150,15 +150,17 @@ int rte_eal_hpet_init(int make_default); static inline uint64_t rte_get_timer_cycles(void) { +#ifdef RTE_LIBEAL_USE_HPET switch(eal_timer_source) { case EAL_TIMER_TSC: +#endif return rte_get_tsc_cycles(); - case EAL_TIMER_HPET: #ifdef RTE_LIBEAL_USE_HPET + case EAL_TIMER_HPET: return rte_get_hpet_cycles(); -#endif default: rte_panic("Invalid timer source specified\n"); } +#endif } /** @@ -170,15 +172,17 @@ rte_get_timer_cycles(void) static inline uint64_t rte_get_timer_hz(void) { +#ifdef RTE_LIBEAL_USE_HPET switch(eal_timer_source) { case EAL_TIMER_TSC: +#endif return rte_get_tsc_hz(); - case EAL_TIMER_HPET: #ifdef RTE_LIBEAL_USE_HPET + case EAL_TIMER_HPET: return rte_get_hpet_hz(); -#endif default: rte_panic("Invalid timer source specified\n"); } +#endif } /** * Wait at least us microseconds. -- 2.12.2