DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Raja Zidane <rzidane@nvidia.com>
Cc: dev@dpdk.org, matan@nvidia.com, stable@dpdk.org
Subject: Re: [PATCH] examples/link_status_interrupt: fix stats refresh rate
Date: Sun, 26 Jun 2022 23:22:59 +0200	[thread overview]
Message-ID: <4816203.0YcMNavOfZ@thomas> (raw)
In-Reply-To: <20220530093702.11745-1-rzidane@nvidia.com>

30/05/2022 11:37, Raja Zidane:
> TIMER_MILLISECOND is defined as the number of cpu cycles per millisecond,
> current definition is correct for cores with frequency of 2GHZ, for cores
> with different frequency, it caused different periods between refresh,
> (i.e. the definition is about 14ms on ARM cores).
> 
> Use dpdk API to get CPU frequency, to define TIMER_MILLISECOND.
> 
> Fixes: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raja Zidane <rzidane@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
> --- a/examples/link_status_interrupt/main.c
> +++ b/examples/link_status_interrupt/main.c
>  /* A tsc-based timer responsible for triggering statistics printout */
> -#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */
> +#define TIMER_MILLISECOND (rte_get_tsc_hz() / 1000)

It is preferred to use rte_get_timer_hz().

>  #define MAX_TIMER_PERIOD 86400 /* 1 day max */
> -static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; /* default period is 10 seconds */
> +#define DEFAULT_TIMER_PERIOD 10UL /* default period is 10 seconds */
> +static int64_t timer_period;
[...]
> +	timer_period = DEFAULT_TIMER_PERIOD;

After a quick look, it seems we are missing the operation
	* TIMER_MILLISECOND * 1000
Isn't it?



  reply	other threads:[~2022-06-26 21:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  9:37 Raja Zidane
2022-06-26 21:22 ` Thomas Monjalon [this message]
2022-07-07  8:22 ` [PATCH v2] " Omar Awaysa
2022-07-08 14:47   ` 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=4816203.0YcMNavOfZ@thomas \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rzidane@nvidia.com \
    --cc=stable@dpdk.org \
    /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).