diff --git a/ratemon/scripts/tput_rxmits.py b/ratemon/scripts/iperf_metrics.py similarity index 61% rename from ratemon/scripts/tput_rxmits.py rename to ratemon/scripts/iperf_metrics.py index 0e2ba86..155b6e3 100755 --- a/ratemon/scripts/tput_rxmits.py +++ b/ratemon/scripts/iperf_metrics.py @@ -10,7 +10,10 @@ def parse_args(): parser = argparse.ArgumentParser( - description="Calculate average throughput and retransmission count" + description=( + "Parse iperf3 sender JSON log file to determine " + "average throughput, retransmission count, and CPU utilization." + ) ) parser.add_argument( "--in-file", @@ -32,7 +35,17 @@ def main(args): bps = res["end"]["sum_sent"]["bits_per_second"] rxmits = res["end"]["sum_sent"]["retransmits"] - msg = f"Throughput: {bps / 1e9:.2f} Gbps\nRetransmits: {rxmits}" + cpu_total = res["end"]["cpu_utilization_percent"]["host_total"] + cpu_user = res["end"]["cpu_utilization_percent"]["host_user"] + cpu_system = res["end"]["cpu_utilization_percent"]["host_system"] + + msg = ( + f"throughput (Gbps):{bps / 1e9:.2f}\n" + f"retransmits (total):{rxmits}\n" + f"cpu total (%):{cpu_total:.2f}\n" + f"cpu user (%):{cpu_user:.2f}\n" + f"cpu system (%):{cpu_system:.2f}" + ) print(msg) with open(args.out_file, "w", encoding="utf-8") as fil: fil.write(msg)