From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 6937C5A98 for ; Mon, 1 May 2017 21:52:46 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C893D20994; Mon, 1 May 2017 15:52:45 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Mon, 01 May 2017 15:52:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=alyy5pwiERjM406 426gIXker4b/EcPtbnOYOwEOR5nY=; b=HjVhfmwn4aats6B2ZWqnxCI2RtXz6yb L30hHdo16uEBMr4O16G/ZPJe0DHVLzNf8qHxd4uM4qirYxsQbMTfxKh4q132AQ96 JfOpIm8HvjeEZgnSDXXRBTCi/hq9++HiQg7oC/VIQkg0BG7drCZIbK3SO7uS4TzF InI+1PuTOGss= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=alyy5pwiERjM406426gIXker4b/EcPtbnOYOwEOR5nY=; b=KDyQ0oz+ aCHD5G/7kOD3tq4AI6z/iOKXHCSKOCt7BPhOX26BEBDBEM0O9gV5Kc/eraTpo2fH r7PzEEZgsd78a9oPuxPc0VZE2FomCnwUlUYkngfL0V9oqSLYTdFKq1sBFVhm9Ml3 jxm3Cpd1ISREDSiA6Nc8gk0LpZuy3q3V7kftP9BxVex/d9e9w7EAmYgZjn8zafyi pj6hV7tPPtZHCMCPQ4li4XElKfskBYjb2lS7+VM2nRdrSW3GDc82Umrn2sYktEi9 h59gO2bGHyF313zu7MmjGcpZWWs5yJCh1UJCMP0iin6zOdlp87rP9hBf1M9kyk4T AKOjwj+hGBx0Mg== X-ME-Sender: X-Sasl-enc: /YqPbPyhpqgP2gZL0mQhZ6LYYZBJVBpUYBgRInHy6upx 1493668365 Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 7C5A77E21D; Mon, 1 May 2017 15:52:45 -0400 (EDT) From: Thomas Monjalon To: Jerin Jacob Cc: dev@dpdk.org Date: Mon, 01 May 2017 21:52:44 +0200 Message-ID: <1783111.z13ClxBXEf@xps> In-Reply-To: <20170501191207.6480-1-jerin.jacob@caviumnetworks.com> References: <20170501191207.6480-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] 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: Mon, 01 May 2017 19:52:46 -0000 01/05/2017 21:12, Jerin Jacob: > 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. [...] > static inline uint64_t > rte_get_timer_cycles(void) > { > +#ifdef RTE_LIBEAL_USE_HPET > switch(eal_timer_source) { > case EAL_TIMER_TSC: > return rte_get_tsc_cycles(); > case EAL_TIMER_HPET: > -#ifdef RTE_LIBEAL_USE_HPET > return rte_get_hpet_cycles(); > -#endif > default: rte_panic("Invalid timer source specified\n"); > } > +#else > + return rte_get_tsc_cycles(); > +#endif I think I would prefer avoiding the #else part by "unifdef" the first occurence of rte_get_tsc_cycles: 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(); #ifdef RTE_LIBEAL_USE_HPET case EAL_TIMER_HPET: return rte_get_hpet_cycles(); default: rte_panic("Invalid timer source specified\n"); } #endif