cleaned up the output (drastically)

This commit is contained in:
Niklas Halle 2025-06-06 08:24:47 +00:00
parent d11d6afd40
commit a1fda3bd3e
2 changed files with 865 additions and 164897 deletions

View file

@ -35,7 +35,7 @@ def e2e_breakdown_type_hist(items: List[E2EBreakdownItem]):
return fig
def e2e_breakdown_stack(*paths: List[E2EBreakdownItem]):
def e2e_breakdown_stack(*paths: List[E2EBreakdownItem], name: str = ""):
"""
Plot a timeseries of stacked DDS/Idle/CPU latencies from `paths`.
Each path has to be the same length
@ -44,8 +44,8 @@ def e2e_breakdown_stack(*paths: List[E2EBreakdownItem]):
"""
fig: Figure
ax: Axes
fig, ax = plt.subplots(num="E2E type breakdown stackplot")
fig.suptitle("Detailed E2E Latency Path Breakdown")
fig, ax = plt.subplots(num=f"E2E type breakdown stackplot {name}")
fig.suptitle(f"Detailed E2E Latency Path Breakdown {name}")
if not paths:
return fig
@ -56,11 +56,13 @@ def e2e_breakdown_stack(*paths: List[E2EBreakdownItem]):
type_durations = {}
for type in plot_types:
durations = [sum([item.duration for i, item in enumerate(path) if i in type_indices[type]]) for path in paths]
durations = [sum([item.duration * 1000 for i, item in enumerate(path) if i in type_indices[type]]) for path in paths]
durations = np.array(durations)
type_durations[type] = durations
labels, duration_arrays = zip(*sorted(list(type_durations.items()), key=lambda pair: pair[1].var(), reverse=False))
ax.stackplot(range(len(paths)), *duration_arrays, labels=labels)
ax.set_ylabel("Latency contribution [ms]")
ax.set_xlabel("Trace Runtime [ms]")
ax.legend()
return fig

File diff suppressed because one or more lines are too long