DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] eal: optimize timer routines
Date: Mon, 01 May 2017 21:52:44 +0200	[thread overview]
Message-ID: <1783111.z13ClxBXEf@xps> (raw)
In-Reply-To: <20170501191207.6480-1-jerin.jacob@caviumnetworks.com>

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

  reply	other threads:[~2017-05-01 19:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01 19:12 Jerin Jacob
2017-05-01 19:52 ` Thomas Monjalon [this message]
2017-05-02  5:19 ` [dpdk-dev] [PATCH v2] " Jerin Jacob
2017-05-05 13:28   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1783111.z13ClxBXEf@xps \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).