harmony/iobench/dash/iobench-dash-v1.py
Jean-Gabriel Gill-Couture fd8f643a8f
All checks were successful
Run Check Script / check (pull_request) Successful in 1m3s
feat: Add iobench project and python dashboard
2025-08-14 10:37:30 -04:00

110 lines
3.3 KiB
Python

from dash import Dash, dcc, html, Input, Output
import plotly.graph_objects as go
import pandas as pd
# Load the CSV data
df = pd.read_csv("iobench.csv") # Replace with the actual file path
# Initialize Dash app
app = Dash(__name__)
# Layout
app.layout = html.Div(
[
html.H1("IOBench Results Viewer", style={"textAlign": "center"}),
# Filters
html.Div(
[
html.Label("Filter by Label:"),
dcc.Dropdown(
id="label-filter",
options=[{"label": label, "value": label} for label in df["label"].unique()],
value=df["label"].unique().tolist(),
multi=True,
),
html.Label("Filter by Test Name:"),
dcc.Dropdown(
id="test-filter",
options=[{"label": test, "value": test} for test in df["test_name"].unique()],
value=df["test_name"].unique().tolist(),
multi=True,
),
],
style={"width": "25%", "display": "inline-block", "verticalAlign": "top", "padding": "10px"},
),
# Graphs
html.Div(
[
dcc.Graph(id="throughput-graph"),
dcc.Graph(id="latency-graph"),
],
style={"width": "70%", "display": "inline-block", "padding": "10px"},
),
]
)
# Callbacks
@app.callback(
[Output("throughput-graph", "figure"), Output("latency-graph", "figure")],
[Input("label-filter", "value"), Input("test-filter", "value")],
)
def update_graphs(selected_labels, selected_tests):
# Filter data
filtered_df = df[df["label"].isin(selected_labels) & df["test_name"].isin(selected_tests)]
# Throughput Graph
throughput_fig = go.Figure()
for label in filtered_df["label"].unique():
subset = filtered_df[filtered_df["label"] == label]
throughput_fig.add_trace(
go.Bar(
x=subset["test_name"],
y=subset["iops"],
name=f"{label} - IOPS",
)
)
throughput_fig.add_trace(
go.Bar(
x=subset["test_name"],
y=subset["bandwidth_kibps"],
name=f"{label} - Bandwidth (KiB/s)",
)
)
throughput_fig.update_layout(
title="Throughput (IOPS and Bandwidth)",
xaxis_title="Test Name",
yaxis_title="Value",
barmode="group",
)
# Latency Graph
latency_fig = go.Figure()
for label in filtered_df["label"].unique():
subset = filtered_df[filtered_df["label"] == label]
latency_fig.add_trace(
go.Scatter(
x=subset["test_name"],
y=subset["latency_mean_ms"],
mode="markers+lines",
name=f"{label} - Latency Mean (ms)",
error_y=dict(
type="data",
array=subset["latency_stddev_ms"],
visible=True,
),
)
)
latency_fig.update_layout(
title="Latency with Standard Deviation",
xaxis_title="Test Name",
yaxis_title="Latency (ms)",
)
return throughput_fig, latency_fig
if __name__ == "__main__":
app.run_server(debug=True)