From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F006AA034C; Tue, 14 Dec 2021 17:10:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7ECC40042; Tue, 14 Dec 2021 17:10:17 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id E131540041 for ; Tue, 14 Dec 2021 17:10:15 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id m15so17676344pgu.11 for ; Tue, 14 Dec 2021 08:10:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lKaIeert/DN3sjIo2MoKrHdntgHYzUGGYuOE9T3V3oQ=; b=TMvEdX4+MbyKRWwIk6Zs51ZsAb4rUeQLADTizuz0/XPy4vvRSwgwLpd70TNZKBUWR+ eFZhaBdEyQ1yDiAhw4mmMkGfKDqU5bz0X5xBe4NeaAdoZqvGMlG9qOHZIXsYkgeBlhML MObZVHn3ZOKdaVl9G6f5UtXM8ZhTm33mzFLC2Eiuw+s1CTFG0Mbee3H/cehoJ5Hq/6p3 zaJxqBWibpsRUKGLIM31XY0PZuuBxp+kVZ0zFO4q0+IHMgpEC4xCzRAukPSIy+SigjRe LCRLVdFtunc6FDunTWpvh66nn+gcUgnZ6pivbtmmh8iw1reBzUyRi9zIDc7mwYWyaO3+ WJSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lKaIeert/DN3sjIo2MoKrHdntgHYzUGGYuOE9T3V3oQ=; b=CzqTdrEaV+qt+ro4tD+e4sts/BFzbHq4ETHrztLU2C2f/zPGm8vY499U7fsm1PTKro ViEgQK+3K8ZulZ5rvjjbqjlyyXcqGE/ZvBSOMxITeJdDEhYBA2/+gcd/Hiw215o0aGLm KTB53jt8af/eIY4j+EWDXEj2WVIoFrTI/iKBoGg7hHYX5C5kVdpMkYhUTsxvlxeNnL1S m4L5KdcECcBfjh/sQWwH3D8d7O6VVrVqRipbGLbH0wDQwPJlkcB4H+Z8T9PNcGnLuuEL 8UYmlxiShDsTce9bsYH46l8BqDvVQjHjadWhz1Knd6GCYiQ0FV3hSF4QuX8mrXEyqn4e Bdzw== X-Gm-Message-State: AOAM5329saf1nj7RpIW54v8Qq3Z6d4ORiDO0vSVpwSfFZ4JzvWdfQnqw O7JzvCtdseapqRAhfnTxdLJ5YymU0atxiQ== X-Google-Smtp-Source: ABdhPJwg/M7s8itKE5B3vmn5lkV3rluU5RIJKr5470hYA2kjIfJzAekwrTXt4wIVBtuvqpEzKbOVoQ== X-Received: by 2002:a65:590e:: with SMTP id f14mr4215749pgu.609.1639498215144; Tue, 14 Dec 2021 08:10:15 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id b15sm287285pfl.118.2021.12.14.08.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 08:10:14 -0800 (PST) Date: Tue, 14 Dec 2021 08:10:11 -0800 From: Stephen Hemminger To: Ronan Randles Cc: dev@dpdk.org, harry.van.haaren@intel.com Subject: Re: [PATCH 12/12] examples/generator: line rate limiting Message-ID: <20211214081011.774b2769@hermes.local> In-Reply-To: <20211214141242.3383831-13-ronan.randles@intel.com> References: <20211214141242.3383831-1-ronan.randles@intel.com> <20211214141242.3383831-13-ronan.randles@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 14 Dec 2021 14:12:42 +0000 Ronan Randles 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?