[PATCH 12/12] examples/generator: line rate limiting
Stephen Hemminger
stephen at networkplumber.org
Tue Dec 14 17:10:11 CET 2021
On Tue, 14 Dec 2021 14:12:42 +0000
Ronan Randles <ronan.randles at intel.com> wrote:
> + /* Track time since last token add and calculate number
> + * of tokens to give per second to implement line rate limiting
> + */
> + uint64_t now = rte_rdtsc();
> + uint64_t tsc_delta = now - token_last_add_tsc;
> + float token_scalar = (float)tsc_delta / tsc_hz_f;
> + float add_tokens = args->target_tx_pps * token_scalar;
floating point math is slow, could you do this fixed point with
reciprocal divide?
More information about the dev
mailing list