SlideShare a Scribd company logo
IPerf3 Log Parser
How to analysis iperf log tput value
By ChenChih, 20250627
Content
โ€ข Case1: parse max throughput, filter [Sum] string
โ€ข Case3: parse bidirectional, filter [SUM][RX-C] and [SUM][TX-C]
โ€ข Case4: parse both case1 and case2 (more convenient)
โ€ข Case7: split large bidirectional logfile into small part by
โ€ข Debug: some debug setting
Link:https://github.com/chenchih/5G_automationLinux/tree/main/
Iperflog_parser
What will you gain or learn
โ€ข Read and write file using python
โ€ข Regular expression to capture or filter log
โ€ข Convert txt file into excel, create sheet in excel
โ€ข Plot graph base on excel file
โ€ข Using progress bar to show running status
โ€ข File management, move result into new folder
Understand the log file
โ€ข Case1 (Max Throughput) filter [SUM]
โ€ข Case4: Bidirectional filter
โ€ข [SUM][TX โ€“C]
โ€ข [SUM][RX โ€“C]
Filter Tput value
Filter date and time
Will look like this after filter
Filter Tput value
RX
TX
Case1: Unidirectional
Run one directional either UL or DL
Source:
https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_
parser/1.parse_mbit_to_gb_excel
Description
โ€ข Need to provide Iperf log file to analysis, and extract the throughput
result
โ€ข Will generate excel file for extract the datetime, and tput value
โ€ข Will not draw graph, user have to manual draw graph
Step of code
โ€ข Step1:Put your elog file example
โ€ข Step2: Enter your logname (ex: DL_dailyTpt_SFP.log)
โ€ข Step3: will start to read and analysis your log and save result into
excel file.
Output
โ€ข Run command: py parse_mbit_to_gb_excel_v3.1.py
Enter your log filename
Enter for default filename, or enter save file name
Iperf Log Structure
โ€ข Iperf command
โ€ข iperf3 -c 192.168.1.150 -i 1 -P 48 -t 600 --timestamp --logfile UL_dailyTpt.log
โ€ข Filter str: [SUM]
โ€ข Log output: will display Gbit
Analysis Log file
โ€ข Filter these string:
โ€ข Date time: datetime
โ€ข Filter String:
โ€ข [SUM]: UL or DL information
โ€ข Throughput Value: Get the throughput value
Filter and matching string
โ€ข Match [SUM]
โ€ข re.match(r"(w{3} w{3}s+d{1,2} d{2}:d{2}:d{2} d{4}) [SUM].*?([d.]+)
(bits|Mbits|Gbits)/sec",line)
โ€ข Get the result:
if match:
date_str = match.group(1)
transfer_str = match.group(2)
unit = match.group(3)
Gbit/mbit/bit
Single date
Convert the Unit type to gbit
โ€ข Solution is to covert to same unit, since gbit contain the most of it. If
match mbit or gbit then divide by 1000 which will convert to gbit unit
type.
โ€ข Code:
if unit == "Mbits":
transfer_value /= 1000.0
elif unit == "bits":
transfer_value /= 1000000000.0
Case3:Bidirectional
Run Uplink and downlink, and get the result of both value
Source code:
https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_
parser/3.parse_bidirectional
Step of code
โ€ข Step1:Put your elog file in the same working directory
โ€ข Step2: Enter your logname (ex: iperf3_bidirectional.log)
โ€ข Step3: will start to read and analysis your log and save result into
excel file.
โ€ข Step4: create folder and move your result into folder
โ€ข Step5: calculate the datetime of your logfile for test duration
Output:
capture the iperf log tput and save excel
โ€ข bidirectional_v3.py
Type your iperf
bidirectional log
Iperf Command with iperf log file
โ€ข Iperf client command:
โ€ข iperf3 -c 192.168.1.150 -P 32 -t 2400 --bidir -b 36M --timestamp --logfile
iperf3_bidirectional.log
โ€ข Filter str: [SUM]
โ€ข Log
--timestamp --logfile: will generate log file
--bidir: bidirectional
Analysis Log file
โ€ข Filter these string:
โ€ข Date time: datetime
โ€ข Filter String:
โ€ข [SUM][TX-C]: UL information
โ€ข [SUM][RX-C]: DL information
โ€ข Throughput Value: Get the throughput value
Filter and matching string
โ€ข Match [SUM][RX-C] or [SUM][TX-C]
โ€ข re.match(r"(w{3} w{3}s+d{1,2} d{2}:d{2}:d{2} d{4}) [SUM][(RX-C|TX-C)].*?([d.]
+) (bits|Mbits|Gbits)/sec", line_str)
โ€ข Get the result:
if match:
date_str = match.group(1)
rx_tx = match.group(2)
transfer_str = match.group(3)
unit = match.group(4)
Convert the Unit type to gbit
โ€ข If you notice iperf log, some throughput will occur gbit, mbit, or even
bit. If you plot graph, the unit is inconsistency will make the graph
look incorrect.
Convert the Unit type to gbit
โ€ข Solution is to covert to same unit, since gbit contain the most of it. If match
mbit or gbit then divide by 1000 which will convert to gbit unit type.
โ€ข Code:
if unit == "Mbits":
transfer_value /= 1000.0
elif unit == "bits":
transfer_value /= 1000000000.0
if rx_tx == "RX-C":
rx_data.append([formatted_date, transfer_value, "gbps"])
else:
tx_data.append([formatted_date, transfer_value, "gbps"])
Extend Feature: plot data from excel
# --- Create Plot ---
fig, ax = plt.subplots(figsize=(18, 8)) # Use subplots for more control, slightly wider figsize
# Plot data
ax.plot(times, tput, label=f'{direction_label} Throughput (gbps)', marker='', linestyle='-', markersize=5)
# Set Title and Labels with increased font size
ax.set_title(f'{direction_label} Throughput', fontsize=16)
ax.set_xlabel("Time", fontsize=14)
ax.set_ylabel("Throughput (gbps)", fontsize=14)
# --- Y-axis Limits ---
ax.set_ylim(bottom=0) # Set the lower limit of the y-axis to 0
ax.xaxis.set_major_locator(mdates.MinuteLocator(interval=30)) # Minute Intervals,
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y%m%d_%H:%M:%S')) # Multi-line format
# Increase tick label size and rotate
plt.setp(ax.get_xticklabels(), rotation=90, ha='right', fontsize=12)
plt.setp(ax.get_yticklabels(), fontsize=12)
# Adjust layout to prevent labels overlapping
fig.tight_layout()
plt.savefig(output_image_file, dpi=300) # Save the plot (dpi for resolution)
Case4: Parse Log working
directory
Parse iperf log both [SUM] or [SUM][TX-C] [RX-C]
Source code:
https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_
parser/4.parse_log_workingdir
Description
โ€ข This script will help you parse both bidirectional or unidirectional iperf
log file. Essential as long as you put .log or .txt it will help you filter
the tput value
โ€ข No need to type your logfile
โ€ข It will also help you plot graph
โ€ข This is all in one script help you do everything. Unlike previous two
example will analysis individual
โ€ข Note: Excel sheet will use your iperf log file name
Feature
โ€ข Allow to check all iperf log either max tput or bidirectional (verson1)
โ€ข Iperf log file name will be your excel sheet name
โ€ข Allow user to add y axis in case future you performance is more than
5 Gb you can adjust your graph axis (version2)
โ€ข Implement average of throughput( version3.1)
โ€ข Improvement average throughput- add threshold to compare. Iperf
log name will determine which test item you test and able to compare
average threshold and display pass fail criteria (version 3.2)
Step of code
โ€ข Step1: check current directory file with .txt or .log file and read it
โ€ข Step2: read each file and search for related string
โ€ข [SUM]:UL or DL Tput
โ€ข [SUM][RX-X] and [SUM][TX-X]: bidirectional Tput
โ€ข Step3: analysis the log
โ€ข Convert data unit
โ€ข save each file into excel sheet rename as log file name
โ€ข Save excel
โ€ข Calculate duration time (only with log contain [SUM][TX-X] or [RX-C]; bidirectional log)
โ€ข Step4: plot date into line graph
โ€ข Step5 create a folder and move all your result into folder
V3.2
display_average_using_input
โ€ข Feature:
โ€ข Implement user add threshold average to compare base on different
condition base on iperflog file. Log file name must contain:
โ€ข Bidirectional tput: log file name must contain these string
โ€ข SFP or POE (max TPT)
Iperf log Filename threshold
bidirectional-poe or bi-poe >= 1.1 PASS
bidirectional-sfp or bi-sfp >= 1.7 PASS
bidirectional >= 1.1 PASS
Iperf log Filename threshold
poe >= 2.5 PASS
sfp >= 3.5 PASS
IPERF log file will check the threshold
The throughput manual test value
โ€ข SFP max throughput (unidirectional) will reach about 3.5~4GB
โ€ข POE max throughput (unidirectional) will reach about 2.5Gb
โ€ข POE Bidirectional: will reach about 1.1 GB
โ€ข SFP Bidirectional: will reach about 1.7 GB
โ€ข In this script which allow to put max throughput log, and bidirectional log file. But if
you want to compare the pass fail criterial then you need to compare your test item
with the value. So in this case I use the log file as my test item to compare the average
โ€ข POE or SFP : these keyword will be Max TPT
โ€ข Bidirectional keyword:
โ€ข bidirectional or bi-poe or bidirectional-poe: either of keyword mean bidirectional poe
โ€ข bidirectional-sfp or bi-sfp: either of keyword mean bidirectional sfp
V3.2: output
Compare with log file name
Example:
โ€ข file contain bidirectional-poe or bidirectional or bi-poe:
average threshold will be 1.1. if less than it Fail
โ€ข file contain poe: average will be 2.5 less than it fail
โ€ข file contain sfp: average will be 3.5 less than it fail
V3.2: Code condition compare threshold
V3.1 average
implement average tput
โ€ข Implement average line to check the average performance, below the
red line is the average
V3.1
flexibility of y axis and x axis tick
โ€ข Allow user to adjust flexible y axis. This will be useful in future if your
performance can reach more than 4gb and can adjust gap of graph.
Y axis , support axis range
Enter to use the default value
User enter range of y axis control TPT axis. You
cam leave empty to use default 0 as min, 5 as
max
V3.1 flexible y axis
โ€ข Original
โ€ข Change: adjust user enter y axis for max and min
V2.2
flexibility of y axis and x axis tick
โ€ข Allow to adjust x axis time tick. There is a condition to show the time
display
duration Time x axis
<=15minute Add every 30 second
<=2 hours Add every 5minute
<=6 hours Add every 10minute
<=1days Add every 30 minute
<=3 days Add every 3 hours
<=1days Add every 30 minute
Tick Every 10 minute
Iperf run 2hrs 30 min
V2.2
โ€ข I have set some setting with the x axis datetime with this condition:
โ€ข duration <=5 minute: set interval as 5 second
โ€ข duration <=15 minute: set interval as 30 second
โ€ข duration <=30 minute: set interval as 1 minute
โ€ข duration <=2 hours: set interval as 5 minute
โ€ข duration <=6 hours: set interval as 10 minute
โ€ข duration <=1 day: set interval as 30 minute
Duration 15 minute,
Interval as 15 second
V2.2
flexibility of y axis and x axis tick
โ€ข Code for condition y axis tick
Calculate time duration only bidirectional log
Logfile and excel sheet output
โ€ข Run command: py parse_alllog_excelSheet_plot_v3.py
All result put in this directory
each sheet place each result Output result
Case7
Split_LargeFile_smallFile
Split large logfile to multiple file for reading
Source:
https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_
parser/7.Split_LargeFile_smallFile
Description
โ€ข This feature is only if you want to split a large file into smaller. For
example if you run bidirectional for over weekend about 3-4 days
then the log file will be about more than 2 gb. Text edior might not be
able to open( notepad++ only support 2~3gb) then you need to use
my script.
โ€ข I will split into N line, into smaller file, then you can open by text edior
Split line
Enter split line,
Default 4000000
Write line into txt file
output
Size of logfile
1.46GB
Debug tool
Some tool for debug while using manual parsing
Covert date and time to specific format
โ€ข Script Name: convertdateFormat.py
โ€ข Datedata.txt: copy your datetime into this file like below
Datedata.txt
Ouput.txt
Read your log file and capture datetime
with open(input_file, 'r', encoding='utf-8', errors='ignore') as
infile:
for line in infile:
if "[SUM]" in line:
match = re.match(r"(w{3} w{3}s+d{1,2} d{2}:
d{2}:d{2} d{4}) [SUM][(RX-C|TX-C)].*?([d.]+) (bits|Mbits|
Gbits)/sec", line)
if match:
print(match.group(1))
else:
print(f"No match found in line: {line.strip()}")
Capture log datetime, and print date time
Calculate logโ€™s running test duration
โ€ข timeduration_calculate.py
Additional Information
Additional Note
โ€ข Build python to executable
โ€ข window
โ€ข pyinstaller --onefile --icon=sheet.ico .parse_alllog_excelSheet_plot_v3.1.py
โ€ข Linux :
โ€ข pyinstaller --onefile parse_alllog_excelSheet_plot_v3.1.py
โ€ข Icon download(window):
โ€ข https://www.flaticon.com/free-icon
Thank you !!!

More Related Content

Recently uploaded (20)

PDF
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
PPTX
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
ย 
PDF
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
PPT
Information Communication Technology Concepts
LOIDAALMAZAN3
ย 
PDF
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
ย 
PPTX
Seamless-Image-Conversion-From-Raster-to-wrt-rtx-rtx.pptx
Quick Conversion Services
ย 
PDF
>Wondershare Filmora Crack Free Download 2025
utfefguu
ย 
PDF
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
ย 
PPTX
computer forensics encase emager app exp6 1.pptx
ssuser343e92
ย 
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
ย 
PDF
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
ย 
PDF
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
ย 
PDF
Building scalbale cloud native apps with .NET 8
GillesMathieu10
ย 
PDF
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
PDF
Alur Perkembangan Software dan Jaringan Komputer
ssuser754303
ย 
PDF
LPS25 - Operationalizing MLOps in GEP - Terradue.pdf
terradue
ย 
PPTX
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
ย 
PDF
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Lionel Briand
ย 
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
ย 
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
ย 
Automated Test Case Repair Using Language Models
Lionel Briand
ย 
Information Communication Technology Concepts
LOIDAALMAZAN3
ย 
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
ย 
Seamless-Image-Conversion-From-Raster-to-wrt-rtx-rtx.pptx
Quick Conversion Services
ย 
>Wondershare Filmora Crack Free Download 2025
utfefguu
ย 
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
ย 
computer forensics encase emager app exp6 1.pptx
ssuser343e92
ย 
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
ย 
Cloud computing Lec 02 - virtualization.pdf
asokawennawatte
ย 
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
ย 
Building scalbale cloud native apps with .NET 8
GillesMathieu10
ย 
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
Alur Perkembangan Software dan Jaringan Komputer
ssuser754303
ย 
LPS25 - Operationalizing MLOps in GEP - Terradue.pdf
terradue
ย 
Quality on Autopilot: Scaling Testing in Uyuni
Oscar Barrios Torrero
ย 
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Lionel Briand
ย 

Featured (20)

PDF
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
ย 
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
ย 
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
ย 
PDF
Skeleton Culture Code
Skeleton Technologies
ย 
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
ย 
PDF
Content Methodology: A Best Practices Report (Webinar)
contently
ย 
PPTX
How to Prepare For a Successful Job Search for 2024
Albert Qian
ย 
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
ย 
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
ย 
PDF
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ย 
PDF
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
ย 
PDF
Getting into the tech field. what next
Tessa Mero
ย 
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
ย 
PDF
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
ย 
PDF
Introduction to Data Science
Christy Abraham Joy
ย 
PDF
Time Management & Productivity - Best Practices
Vit Horky
ย 
PDF
The six step guide to practical project management
MindGenius
ย 
PDF
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
ย 
PDF
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
ย 
PDF
12 Ways to Increase Your Influence at Work
GetSmarter
ย 
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
ย 
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
ย 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
ย 
Skeleton Culture Code
Skeleton Technologies
ย 
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
ย 
Content Methodology: A Best Practices Report (Webinar)
contently
ย 
How to Prepare For a Successful Job Search for 2024
Albert Qian
ย 
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
ย 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
ย 
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ย 
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
ย 
Getting into the tech field. what next
Tessa Mero
ย 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
ย 
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
ย 
Introduction to Data Science
Christy Abraham Joy
ย 
Time Management & Productivity - Best Practices
Vit Horky
ย 
The six step guide to practical project management
MindGenius
ย 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
ย 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
ย 
12 Ways to Increase Your Influence at Work
GetSmarter
ย 
Ad

Automatic_Iperf_Log_Result_Excel_visual_v2.pptx

  • 1. IPerf3 Log Parser How to analysis iperf log tput value By ChenChih, 20250627
  • 2. Content โ€ข Case1: parse max throughput, filter [Sum] string โ€ข Case3: parse bidirectional, filter [SUM][RX-C] and [SUM][TX-C] โ€ข Case4: parse both case1 and case2 (more convenient) โ€ข Case7: split large bidirectional logfile into small part by โ€ข Debug: some debug setting Link:https://github.com/chenchih/5G_automationLinux/tree/main/ Iperflog_parser
  • 3. What will you gain or learn โ€ข Read and write file using python โ€ข Regular expression to capture or filter log โ€ข Convert txt file into excel, create sheet in excel โ€ข Plot graph base on excel file โ€ข Using progress bar to show running status โ€ข File management, move result into new folder
  • 4. Understand the log file โ€ข Case1 (Max Throughput) filter [SUM] โ€ข Case4: Bidirectional filter โ€ข [SUM][TX โ€“C] โ€ข [SUM][RX โ€“C] Filter Tput value Filter date and time Will look like this after filter Filter Tput value RX TX
  • 5. Case1: Unidirectional Run one directional either UL or DL Source: https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_ parser/1.parse_mbit_to_gb_excel
  • 6. Description โ€ข Need to provide Iperf log file to analysis, and extract the throughput result โ€ข Will generate excel file for extract the datetime, and tput value โ€ข Will not draw graph, user have to manual draw graph
  • 7. Step of code โ€ข Step1:Put your elog file example โ€ข Step2: Enter your logname (ex: DL_dailyTpt_SFP.log) โ€ข Step3: will start to read and analysis your log and save result into excel file.
  • 8. Output โ€ข Run command: py parse_mbit_to_gb_excel_v3.1.py Enter your log filename Enter for default filename, or enter save file name
  • 9. Iperf Log Structure โ€ข Iperf command โ€ข iperf3 -c 192.168.1.150 -i 1 -P 48 -t 600 --timestamp --logfile UL_dailyTpt.log โ€ข Filter str: [SUM] โ€ข Log output: will display Gbit
  • 10. Analysis Log file โ€ข Filter these string: โ€ข Date time: datetime โ€ข Filter String: โ€ข [SUM]: UL or DL information โ€ข Throughput Value: Get the throughput value
  • 11. Filter and matching string โ€ข Match [SUM] โ€ข re.match(r"(w{3} w{3}s+d{1,2} d{2}:d{2}:d{2} d{4}) [SUM].*?([d.]+) (bits|Mbits|Gbits)/sec",line) โ€ข Get the result: if match: date_str = match.group(1) transfer_str = match.group(2) unit = match.group(3) Gbit/mbit/bit Single date
  • 12. Convert the Unit type to gbit โ€ข Solution is to covert to same unit, since gbit contain the most of it. If match mbit or gbit then divide by 1000 which will convert to gbit unit type. โ€ข Code: if unit == "Mbits": transfer_value /= 1000.0 elif unit == "bits": transfer_value /= 1000000000.0
  • 13. Case3:Bidirectional Run Uplink and downlink, and get the result of both value Source code: https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_ parser/3.parse_bidirectional
  • 14. Step of code โ€ข Step1:Put your elog file in the same working directory โ€ข Step2: Enter your logname (ex: iperf3_bidirectional.log) โ€ข Step3: will start to read and analysis your log and save result into excel file. โ€ข Step4: create folder and move your result into folder โ€ข Step5: calculate the datetime of your logfile for test duration
  • 15. Output: capture the iperf log tput and save excel โ€ข bidirectional_v3.py Type your iperf bidirectional log
  • 16. Iperf Command with iperf log file โ€ข Iperf client command: โ€ข iperf3 -c 192.168.1.150 -P 32 -t 2400 --bidir -b 36M --timestamp --logfile iperf3_bidirectional.log โ€ข Filter str: [SUM] โ€ข Log --timestamp --logfile: will generate log file --bidir: bidirectional
  • 17. Analysis Log file โ€ข Filter these string: โ€ข Date time: datetime โ€ข Filter String: โ€ข [SUM][TX-C]: UL information โ€ข [SUM][RX-C]: DL information โ€ข Throughput Value: Get the throughput value
  • 18. Filter and matching string โ€ข Match [SUM][RX-C] or [SUM][TX-C] โ€ข re.match(r"(w{3} w{3}s+d{1,2} d{2}:d{2}:d{2} d{4}) [SUM][(RX-C|TX-C)].*?([d.] +) (bits|Mbits|Gbits)/sec", line_str) โ€ข Get the result: if match: date_str = match.group(1) rx_tx = match.group(2) transfer_str = match.group(3) unit = match.group(4)
  • 19. Convert the Unit type to gbit โ€ข If you notice iperf log, some throughput will occur gbit, mbit, or even bit. If you plot graph, the unit is inconsistency will make the graph look incorrect.
  • 20. Convert the Unit type to gbit โ€ข Solution is to covert to same unit, since gbit contain the most of it. If match mbit or gbit then divide by 1000 which will convert to gbit unit type. โ€ข Code: if unit == "Mbits": transfer_value /= 1000.0 elif unit == "bits": transfer_value /= 1000000000.0 if rx_tx == "RX-C": rx_data.append([formatted_date, transfer_value, "gbps"]) else: tx_data.append([formatted_date, transfer_value, "gbps"])
  • 21. Extend Feature: plot data from excel # --- Create Plot --- fig, ax = plt.subplots(figsize=(18, 8)) # Use subplots for more control, slightly wider figsize # Plot data ax.plot(times, tput, label=f'{direction_label} Throughput (gbps)', marker='', linestyle='-', markersize=5) # Set Title and Labels with increased font size ax.set_title(f'{direction_label} Throughput', fontsize=16) ax.set_xlabel("Time", fontsize=14) ax.set_ylabel("Throughput (gbps)", fontsize=14) # --- Y-axis Limits --- ax.set_ylim(bottom=0) # Set the lower limit of the y-axis to 0 ax.xaxis.set_major_locator(mdates.MinuteLocator(interval=30)) # Minute Intervals, ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y%m%d_%H:%M:%S')) # Multi-line format # Increase tick label size and rotate plt.setp(ax.get_xticklabels(), rotation=90, ha='right', fontsize=12) plt.setp(ax.get_yticklabels(), fontsize=12) # Adjust layout to prevent labels overlapping fig.tight_layout() plt.savefig(output_image_file, dpi=300) # Save the plot (dpi for resolution)
  • 22. Case4: Parse Log working directory Parse iperf log both [SUM] or [SUM][TX-C] [RX-C] Source code: https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_ parser/4.parse_log_workingdir
  • 23. Description โ€ข This script will help you parse both bidirectional or unidirectional iperf log file. Essential as long as you put .log or .txt it will help you filter the tput value โ€ข No need to type your logfile โ€ข It will also help you plot graph โ€ข This is all in one script help you do everything. Unlike previous two example will analysis individual โ€ข Note: Excel sheet will use your iperf log file name
  • 24. Feature โ€ข Allow to check all iperf log either max tput or bidirectional (verson1) โ€ข Iperf log file name will be your excel sheet name โ€ข Allow user to add y axis in case future you performance is more than 5 Gb you can adjust your graph axis (version2) โ€ข Implement average of throughput( version3.1) โ€ข Improvement average throughput- add threshold to compare. Iperf log name will determine which test item you test and able to compare average threshold and display pass fail criteria (version 3.2)
  • 25. Step of code โ€ข Step1: check current directory file with .txt or .log file and read it โ€ข Step2: read each file and search for related string โ€ข [SUM]:UL or DL Tput โ€ข [SUM][RX-X] and [SUM][TX-X]: bidirectional Tput โ€ข Step3: analysis the log โ€ข Convert data unit โ€ข save each file into excel sheet rename as log file name โ€ข Save excel โ€ข Calculate duration time (only with log contain [SUM][TX-X] or [RX-C]; bidirectional log) โ€ข Step4: plot date into line graph โ€ข Step5 create a folder and move all your result into folder
  • 26. V3.2 display_average_using_input โ€ข Feature: โ€ข Implement user add threshold average to compare base on different condition base on iperflog file. Log file name must contain: โ€ข Bidirectional tput: log file name must contain these string โ€ข SFP or POE (max TPT) Iperf log Filename threshold bidirectional-poe or bi-poe >= 1.1 PASS bidirectional-sfp or bi-sfp >= 1.7 PASS bidirectional >= 1.1 PASS Iperf log Filename threshold poe >= 2.5 PASS sfp >= 3.5 PASS IPERF log file will check the threshold
  • 27. The throughput manual test value โ€ข SFP max throughput (unidirectional) will reach about 3.5~4GB โ€ข POE max throughput (unidirectional) will reach about 2.5Gb โ€ข POE Bidirectional: will reach about 1.1 GB โ€ข SFP Bidirectional: will reach about 1.7 GB โ€ข In this script which allow to put max throughput log, and bidirectional log file. But if you want to compare the pass fail criterial then you need to compare your test item with the value. So in this case I use the log file as my test item to compare the average โ€ข POE or SFP : these keyword will be Max TPT โ€ข Bidirectional keyword: โ€ข bidirectional or bi-poe or bidirectional-poe: either of keyword mean bidirectional poe โ€ข bidirectional-sfp or bi-sfp: either of keyword mean bidirectional sfp
  • 28. V3.2: output Compare with log file name Example: โ€ข file contain bidirectional-poe or bidirectional or bi-poe: average threshold will be 1.1. if less than it Fail โ€ข file contain poe: average will be 2.5 less than it fail โ€ข file contain sfp: average will be 3.5 less than it fail
  • 29. V3.2: Code condition compare threshold
  • 30. V3.1 average implement average tput โ€ข Implement average line to check the average performance, below the red line is the average
  • 31. V3.1 flexibility of y axis and x axis tick โ€ข Allow user to adjust flexible y axis. This will be useful in future if your performance can reach more than 4gb and can adjust gap of graph. Y axis , support axis range Enter to use the default value User enter range of y axis control TPT axis. You cam leave empty to use default 0 as min, 5 as max
  • 32. V3.1 flexible y axis โ€ข Original โ€ข Change: adjust user enter y axis for max and min
  • 33. V2.2 flexibility of y axis and x axis tick โ€ข Allow to adjust x axis time tick. There is a condition to show the time display duration Time x axis <=15minute Add every 30 second <=2 hours Add every 5minute <=6 hours Add every 10minute <=1days Add every 30 minute <=3 days Add every 3 hours <=1days Add every 30 minute Tick Every 10 minute Iperf run 2hrs 30 min
  • 34. V2.2 โ€ข I have set some setting with the x axis datetime with this condition: โ€ข duration <=5 minute: set interval as 5 second โ€ข duration <=15 minute: set interval as 30 second โ€ข duration <=30 minute: set interval as 1 minute โ€ข duration <=2 hours: set interval as 5 minute โ€ข duration <=6 hours: set interval as 10 minute โ€ข duration <=1 day: set interval as 30 minute Duration 15 minute, Interval as 15 second
  • 35. V2.2 flexibility of y axis and x axis tick โ€ข Code for condition y axis tick
  • 36. Calculate time duration only bidirectional log
  • 37. Logfile and excel sheet output โ€ข Run command: py parse_alllog_excelSheet_plot_v3.py All result put in this directory each sheet place each result Output result
  • 38. Case7 Split_LargeFile_smallFile Split large logfile to multiple file for reading Source: https://github.com/chenchih/5G_automationLinux/tree/main/Iperflog_ parser/7.Split_LargeFile_smallFile
  • 39. Description โ€ข This feature is only if you want to split a large file into smaller. For example if you run bidirectional for over weekend about 3-4 days then the log file will be about more than 2 gb. Text edior might not be able to open( notepad++ only support 2~3gb) then you need to use my script. โ€ข I will split into N line, into smaller file, then you can open by text edior
  • 40. Split line Enter split line, Default 4000000 Write line into txt file
  • 42. Debug tool Some tool for debug while using manual parsing
  • 43. Covert date and time to specific format โ€ข Script Name: convertdateFormat.py โ€ข Datedata.txt: copy your datetime into this file like below Datedata.txt Ouput.txt
  • 44. Read your log file and capture datetime with open(input_file, 'r', encoding='utf-8', errors='ignore') as infile: for line in infile: if "[SUM]" in line: match = re.match(r"(w{3} w{3}s+d{1,2} d{2}: d{2}:d{2} d{4}) [SUM][(RX-C|TX-C)].*?([d.]+) (bits|Mbits| Gbits)/sec", line) if match: print(match.group(1)) else: print(f"No match found in line: {line.strip()}") Capture log datetime, and print date time
  • 45. Calculate logโ€™s running test duration โ€ข timeduration_calculate.py
  • 47. Additional Note โ€ข Build python to executable โ€ข window โ€ข pyinstaller --onefile --icon=sheet.ico .parse_alllog_excelSheet_plot_v3.1.py โ€ข Linux : โ€ข pyinstaller --onefile parse_alllog_excelSheet_plot_v3.1.py โ€ข Icon download(window): โ€ข https://www.flaticon.com/free-icon

Editor's Notes