记录
This commit is contained in:
parent
10a33ee50d
commit
3fa88b16dd
26
run.py
Normal file
26
run.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import json
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
# 读取 json 文件
|
||||||
|
with open('real.json', 'r') as f:
|
||||||
|
data = json.load(f)
|
||||||
|
|
||||||
|
intervals = data['intervals']
|
||||||
|
times = [i['sum']['start'] for i in intervals]
|
||||||
|
bandwidth = [i['sum']['bits_per_second'] / 1e6 for i in intervals] # 转为 Mbps
|
||||||
|
loss = [i['sum']['lost_percent'] for i in intervals]
|
||||||
|
|
||||||
|
# 绘图
|
||||||
|
fig, ax1 = plt.subplots()
|
||||||
|
|
||||||
|
ax1.set_xlabel('Time (s)')
|
||||||
|
ax1.set_ylabel('Bandwidth (Mbps)', color='tab:blue')
|
||||||
|
ax1.plot(times, bandwidth, color='tab:blue', label='Bandwidth')
|
||||||
|
ax1.set_ylim(0, 25) # 20M带宽建议坐标上限设为25
|
||||||
|
|
||||||
|
ax2 = ax1.twinx()
|
||||||
|
ax2.set_ylabel('Loss (%)', color='tab:red')
|
||||||
|
ax2.plot(times, loss, color='tab:red', linestyle='--', label='Loss %')
|
||||||
|
|
||||||
|
plt.title('iperf3 UDP 20M Pull Test')
|
||||||
|
plt.show()
|
||||||
@ -1,4 +1,3 @@
|
|||||||
nohup: ignoring input
|
|
||||||
{
|
{
|
||||||
"start": {
|
"start": {
|
||||||
"connected": [{
|
"connected": [{
|
||||||
100905
udp/A-S2-B.json
Normal file
100905
udp/A-S2-B.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
|||||||
nohup: ignoring input
|
|
||||||
{
|
{
|
||||||
"start": {
|
"start": {
|
||||||
"connected": [{
|
"connected": [{
|
||||||
100905
udp/S2-B.json
Normal file
100905
udp/S2-B.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user