11#!/usr/bin/env python3
22"""Communication tests analysis page."""
33
4- import sys
54import streamlit as st
65import pandas as pd
7- from pathlib import Path
8- from utils .metrics import extract_core_metrics
9-
10- # Add parent directory to path
11- project_root = Path (__file__ ).parent .parent
12- sys .path .append (str (project_root ))
136
7+ from common import init_page
148from components .header import render_header
15- from utils .data_loader import InfiniMetricsDataLoader , get_friendly_size
9+ from utils .data_loader import get_friendly_size
10+ from utils .metrics import extract_core_metrics
1611from utils .visualizations import (
17- plot_bandwidth_vs_size ,
18- plot_latency_vs_size ,
12+ plot_metric_vs_size ,
1913 plot_comparison_matrix ,
20- create_summary_table ,
2114 create_gauge_chart ,
15+ create_summary_table ,
16+ plot_timeseries_auto ,
17+ create_summary_table_infer ,
2218)
2319
24- # Page configuration
25- st .set_page_config (page_title = "通信测试分析 | InfiniMetrics" , page_icon = "🔗" , layout = "wide" )
26-
27- # Initialize session state
28- if "data_loader" not in st .session_state :
29- st .session_state .data_loader = InfiniMetricsDataLoader ()
20+ init_page ("推理测试分析 | InfiniMetrics" , "🔗" )
3021
3122
3223def main ():
@@ -90,7 +81,7 @@ def main():
9081 # Run selector
9182 st .markdown ("### 选择测试运行" )
9283
93- # ✅ Run ID 模糊搜索(真正生效)
84+ # Run ID Fuzzy search (really works)
9485 run_id_kw = st .text_input (
9586 "🔎 Run ID 模糊搜索(支持前缀 / 子串)" ,
9687 placeholder = "例如:20240109 / abcd1234" ,
@@ -149,8 +140,11 @@ def main():
149140 and metric .get ("data" ) is not None
150141 ):
151142 df = metric ["data" ]
152- fig = plot_bandwidth_vs_size (
153- df , f"带宽分析 - { run ['operation' ]} " , y_log_scale
143+ fig = plot_metric_vs_size (
144+ df = df ,
145+ metric_type = "bandwidth" ,
146+ title = f"带宽分析 - { run ['operation' ]} " ,
147+ y_log_scale = y_log_scale ,
154148 )
155149 st .plotly_chart (fig , use_container_width = True )
156150 break
@@ -172,8 +166,11 @@ def main():
172166 and metric .get ("data" ) is not None
173167 ):
174168 df = metric ["data" ]
175- fig = plot_latency_vs_size (
176- df , f"延迟分析 - { run ['operation' ]} " , y_log_scale
169+ fig = plot_metric_vs_size (
170+ df = df ,
171+ metric_type = "latency" ,
172+ title = f"延迟分析 - { run ['operation' ]} " ,
173+ y_log_scale = y_log_scale ,
177174 )
178175 st .plotly_chart (fig , use_container_width = True )
179176 break
@@ -201,9 +198,9 @@ def main():
201198 f"{ core ['latency_us' ]:.2f} μs" if core ["latency_us" ] else "-" ,
202199 )
203200 c3 .metric (
204- "TTFT" , f"{ core ['ttft_ms' ]:.2f} ms" if core ["ttft_ms" ] else "-"
201+ "测试耗时" ,
202+ f"{ core ['duration_ms' ]:.2f} ms" if core ["duration_ms" ] else "-" ,
205203 )
206-
207204 # Gauge charts for key metrics
208205 if len (selected_runs ) == 1 :
209206 st .markdown ("#### 关键指标" )
0 commit comments