forked from maratishe/e2eprobe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_igi.py
More file actions
38 lines (28 loc) · 1.09 KB
/
plot_igi.py
File metadata and controls
38 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
input_gaps = np.linspace(10, 200, 20)
threshold = 100
output_gaps = []
for g in input_gaps:
if g < threshold:
output_gaps.append(g + (threshold - g) * 0.5)
else:
output_gaps.append(g)
output_gaps = np.array(output_gaps)
plt.figure(figsize=(8, 5))
plt.plot(input_gaps, output_gaps, marker='o', color='#E53935', label="Observed Output Gap")
plt.plot(input_gaps, input_gaps, linestyle='--', color='#1E88E5', label="Ideal (No Congestion)")
plt.axvline(x=threshold, color='#43A047', linestyle=':', linewidth=2, label="Available Bandwidth Point")
plt.fill_between(input_gaps, input_gaps, output_gaps,
where=(output_gaps > input_gaps), alpha=0.15, color='red',
label="Congestion Region")
plt.xlabel("Input Packet Gap (µs)")
plt.ylabel("Output Packet Gap (µs)")
plt.title("Initial Gap Increasing: Input Gap vs Observed Output Gap")
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig("igi_plot.png", dpi=150)
print("Plot saved to igi_plot.png")