[Simple Patch] Edit Pktgen for Result

Semidragon·2023년 4월 10일
0

DPDK-Pktgen is a packet generator tool that is part of the Data Plane Development Kit (DPDK) software suite. It is designed to generate high-speed network traffic at line rate, allowing users to test and measure the performance of their network infrastructure.

However, The Pktgen does not have availabilty to save the results.

Thus, I had made a slight change on the Pktgen to save results on a .csv file.

How to Use

This Change was made on Pktgen v.20.09

1. Change the pktgen-stats.c file

With the updated .c file given, overwrite the pktgen-stats.c at:
Pktgen-DPDK-pktgen-20.09.0/app/pktgen-stats.c

If designated pktgen version is not 20.09.0 simply add:

    FILE *fp;
    fp = fopen("data.csv", "a");
    // ADD TO CSV FILE
    fprintf(fp, "%d,%lu,%lu,%lu,%lu\n",
                (&info->seq_pkt[SINGLE_PKT])->pktSize + PG_ETHER_CRC_LEN, info->rate_stats.ipackets,
                iBitsTotal(info->rate_stats) / Million, info->rate_stats.opackets,
                oBitsTotal(info->rate_stats) / Million);
    // ADD TO CSV FILE
    fclose(fp);

2. Recompile Pktgen

Recompile Pktgen using meson and ninja:

sudo meson setup --wipe build
sudo ninja -C build install

3. Run Pktgen

Now, when running Pktgen, a file named data.csv will be generated as below:
Each columns mean: Pkt Size / Rx Bytes / Rx Packets / Tx Bytes / Tx Packets

*This example was done on the Tx side, thus Tx byte/packet change as packet size change.

4. Analyze Data

Lastly, We can analyze the data using the given python file via:

python3 average.py data.csv

This will result like:

For better results, it only takes into accoun the middle 50% of the data, and ignores data with value 0.

Code Explanation

TBD

Throughly looking at the code, simple patch on

Average.py

profile
Semidragon's network [CS undergrad @ Sungkyunkwan University | Networks + System @ CSI]

0개의 댓글