[dpdk-dev] How can I calculate/estimate pps(packet per seocond) and bps(bit per second) in DPDK pktg

Wiles, Keith keith.wiles at intel.com
Tue Nov 3 15:11:57 CET 2015


On 11/3/15, 12:25 AM, "dev on behalf of 최익성" <dev-bounces at dpdk.org on behalf of pnk003 at 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






More information about the dev mailing list