DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wiles, Keith" <keith.wiles@intel.com>
To: 최익성 <pnk003@naver.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] How can I calculate/estimate pps(packet per seocond) and bps(bit per second) in DPDK pktg
Date: Tue, 3 Nov 2015 14:11:57 +0000	[thread overview]
Message-ID: <514E811C-1D85-4BB7-AA9C-C5D2B2ED6043@intel.com> (raw)
In-Reply-To: <c730b82a7e135bd8a1bb98bf514b338@cweb15.nm.nhnsystem.com>

On 11/3/15, 12:25 AM, "dev on behalf of 최익성" <dev-bounces@dpdk.org on behalf of pnk003@naver.com> wrote:

>Dear DPDK experts. 
> 
>Thank you very much for your excellent work and great contributions.
> 
>I have a question about pps(packet per seocond) and bps(bit per second) estimation in DPDK pktgen.
> 
>I can't find the source code which calculates pps and bps for received packets in the DPDK pktgen source code.
> 
>Would you give any information/algorithm to estimate pps and bps?

Please look in the app/pktgen.c file for two functions pktgen_wire_size() and ptkgen_packet_rate(). The first function calculates the wire size of the packet and the second one calculates the packet rate for transmission. These two are used to determine the rate to send packets and the amount of time between delays.

The next part is how you convert the RX/Tx to pps and bps. I have macros that convert the packets per second to bits per second. The code to get the per second values is located in app/pktgen-stat.c and use a timer to grab the values and calculate the delta per second.

The two macros you are looking for are iBitsTotal(info->rate_stats), oBitsTotal(info->rate_stats) in the app/pktgen-stat.c line 297.

Here are the macros in app/pktgen.h

INTER_FRAME_GAP         = 12,
PKT_PREAMBLE_SIZE       = 8,
    FCS_SIZE                = 4,


#define iBitsTotal(_x) \
    (((_x.ipackets * (INTER_FRAME_GAP + PKT_PREAMBLE_SIZE)) + _x.ibytes) << 3)
#define oBitsTotal(_x) \
    (((_x.opackets * (INTER_FRAME_GAP + PKT_PREAMBLE_SIZE)) + _x.obytes) << 3)


Hmm, I just noticed I did not include the FCS bytes. Does the NIC include FCS bytes in the counters? Need to verify that one and if not then it becomes a bit more complex.

But that is how I calculate the values, if you see a problem let me know.

> 
>Thank you very much. 
> 
>Sincerely Yours,
> 
>Ick-Sung Choi.
> 
>


Regards,
Keith





  reply	other threads:[~2015-11-03 14:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03  6:25 최익성
2015-11-03 14:11 ` Wiles, Keith [this message]
2015-11-03 14:30   ` Van Haaren, Harry
2015-11-03 14:33     ` Wiles, Keith
2015-11-03 15:59       ` Polehn, Mike A
2015-11-03 19:00         ` Wiles, Keith
2015-11-03 21:55           ` Polehn, Mike A
2015-11-04  1:45         ` 최익성
2015-11-04 14:21           ` Polehn, Mike A
2015-11-04 23:58             ` 최익성
2015-11-03 22:05     ` Stephen Hemminger
2015-11-03 22:18       ` Kyle Larose
2015-11-03 23:28         ` Stephen Hemminger
2015-11-04 13:13           ` Kyle Larose

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=514E811C-1D85-4BB7-AA9C-C5D2B2ED6043@intel.com \
    --to=keith.wiles@intel.com \
    --cc=dev@dpdk.org \
    --cc=pnk003@naver.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).