Add a hover probe and a profile build to break down a frame (#27)
CI / core (pull_request) Successful in 42s
CI / core (push) Successful in 1m10s

scripts/hover-probe.ps1 posts synthetic mouse moves across the champion
table rows, 240 per second, without moving the real cursor, and reports
the UI thread's CPU and input latency against an idle phase, with the
machine and build like the move probe.

A `profile` Cargo feature, off by default, enables GPUI's profiler: with
ARENA_TRACKER_PROFILE the app appends each frame's phases, presentation
and views' own time to a CSV, and ARENA_TRACKER_HIDE removes parts of
the page so that each part's cost is measured by removal. Normal builds
compile none of it. Both are documented in docs/performance.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #37.
This commit is contained in:
nessarandClaude Opus 5.5 authored and nessar committed 2026-11-17 20:11:32 +01:00
1 parent c9f5b264e6
commit 2c1dde684c
7 files changed
+556 -92

No files matched your search

+143 -92
View File
@@ -16,6 +16,7 @@ use gpui_kit::component::select::{Select, SelectEvent, SelectItem, SelectState};
use gpui_kit::component::tab::{Tab, TabBar};
use gpui_kit::component::table::{DataTable, TableState};
use gpui_kit::component::{ActiveTheme as _, Disableable as _, IndexPath, Sizable as _};
use gpui_kit::prelude::FluentBuilder as _;
use gpui_kit::*;
use crate::champion_table::ChampionTable;
@@ -29,6 +30,32 @@ const CHART_HEIGHT: f32 = 150.;
/// While an import runs, the page is recomputed at most this often.
const RELOAD_EVERY: Duration = Duration::from_secs(1);
/// Hides page parts for issue #27 measurements only with `--features profile`.
#[inline]
pub fn shown(part: &str) -> bool {
#[cfg(feature = "profile")]
{
static HIDDEN: std::sync::OnceLock<Vec<String>> = std::sync::OnceLock::new();
!HIDDEN
.get_or_init(|| {
std::env::var("ARENA_TRACKER_HIDE")
.unwrap_or_default()
.split(',')
.map(str::trim)
.filter(|part| !part.is_empty())
.map(str::to_owned)
.collect()
})
.iter()
.any(|hidden| hidden == part)
}
#[cfg(not(feature = "profile"))]
{
let _ = part;
true
}
}
pub enum PageEvent {
OpenSettings,
}
@@ -730,7 +757,11 @@ impl Render for StatsPage {
let mut cards = vec![
card(
"Répartition des Placements",
placements_chart(charts),
if shown("placements") {
placements_chart(charts)
} else {
Some(div().size_full().into_any_element())
},
NO_MATCH,
border,
muted,
@@ -741,7 +772,11 @@ impl Render for StatsPage {
cards.push(
card(
"Champions validés au fil de la Saison",
completed_chart(charts),
if shown("completed") {
completed_chart(charts)
} else {
Some(div().size_full().into_any_element())
},
"Aucun champion validé",
border,
muted,
@@ -751,7 +786,11 @@ impl Render for StatsPage {
cards.push(
card(
"Tentatives pour valider",
attempts_chart(charts),
if shown("attempts") {
attempts_chart(charts)
} else {
Some(div().size_full().into_any_element())
},
"Aucun champion validé",
border,
muted,
@@ -767,95 +806,107 @@ impl Render for StatsPage {
.size_full()
.gap_3()
.p_3()
.child(
// The selectors give way first (down to their minimum width), then the buttons
// wrap onto a second line: nothing is ever clipped.
div()
.h_flex()
.flex_wrap()
.items_center()
.justify_between()
.gap_x_3()
.gap_y_2()
.child(
div()
.h_flex()
.items_center()
.gap_3()
.min_w_0()
.child(
Select::new(&self.account_select)
.id("account")
.placeholder("Aucun Compte")
.w(px(260.))
.min_w(px(150.)),
)
.children(self.stale().then(|| {
div()
.text_sm()
.whitespace_nowrap()
.text_color(muted)
.child("Non mis à jour")
}))
.child(
Select::new(&self.season_select)
.id("season")
.w(px(220.))
.min_w(px(130.)),
)
.child(
Select::new(&self.format_select)
.id("format")
.w(px(220.))
.min_w(px(130.)),
),
)
.child(
div()
.h_flex()
.items_center()
.gap_3()
.flex_shrink_0()
.child(
div()
.text_sm()
.whitespace_nowrap()
.text_color(muted)
.child(status_line),
)
.child(
Button::new("refresh")
.label("Actualiser")
.disabled(busy)
.on_click(cx.listener(|this, _, _, cx| this.begin_refresh(cx))),
)
.child(Button::new("settings").label("Paramètres").on_click(
cx.listener(|_, _, _, cx| cx.emit(PageEvent::OpenSettings)),
)),
),
)
.child(div().v_flex().gap_1().children(self.banners()))
.children(challenge.map(|c| challenge_tiles(c, self.official(), border, muted)))
.when(shown("header"), |page| {
page.child(
// The selectors give way first (down to their minimum width), then the buttons
// wrap onto a second line: nothing is ever clipped.
div()
.h_flex()
.flex_wrap()
.items_center()
.justify_between()
.gap_x_3()
.gap_y_2()
.child(
div()
.h_flex()
.items_center()
.gap_3()
.min_w_0()
.child(
Select::new(&self.account_select)
.id("account")
.placeholder("Aucun Compte")
.w(px(260.))
.min_w(px(150.)),
)
.children(self.stale().then(|| {
div()
.text_sm()
.whitespace_nowrap()
.text_color(muted)
.child("Non mis à jour")
}))
.child(
Select::new(&self.season_select)
.id("season")
.w(px(220.))
.min_w(px(130.)),
)
.child(
Select::new(&self.format_select)
.id("format")
.w(px(220.))
.min_w(px(130.)),
),
)
.child(
div()
.h_flex()
.items_center()
.gap_3()
.flex_shrink_0()
.child(
div()
.text_sm()
.whitespace_nowrap()
.text_color(muted)
.child(status_line),
)
.child(
Button::new("refresh")
.label("Actualiser")
.disabled(busy)
.on_click(
cx.listener(|this, _, _, cx| this.begin_refresh(cx)),
),
)
.child(Button::new("settings").label("Paramètres").on_click(
cx.listener(|_, _, _, cx| cx.emit(PageEvent::OpenSettings)),
)),
),
)
})
.when(shown("banners"), |page| {
page.child(div().v_flex().gap_1().children(self.banners()))
})
.when(shown("tiles"), |page| {
page.children(challenge.map(|c| challenge_tiles(c, self.official(), border, muted)))
})
.child(div().h_flex().gap_3().children(cards))
.child(
TabBar::new("state-filter")
.segmented()
.selected_index(selected.unwrap_or(0))
.children(options.iter().map(|(label, _)| Tab::new().label(*label)))
.on_click(cx.listener(|this, ix: &usize, _, cx| {
let in_season = matches!(this.season, SeasonScope::Season(_));
if let Some((_, filter)) = filters(in_season).get(*ix) {
this.filter = *filter;
this.refresh_table(cx);
cx.notify();
}
})),
)
.child(
div()
.flex_1()
.min_h(px(240.))
.child(DataTable::new(&self.table).stripe(true)),
)
.when(shown("tabs"), |page| {
page.child(
TabBar::new("state-filter")
.segmented()
.selected_index(selected.unwrap_or(0))
.children(options.iter().map(|(label, _)| Tab::new().label(*label)))
.on_click(cx.listener(|this, ix: &usize, _, cx| {
let in_season = matches!(this.season, SeasonScope::Season(_));
if let Some((_, filter)) = filters(in_season).get(*ix) {
this.filter = *filter;
this.refresh_table(cx);
cx.notify();
}
})),
)
})
.when(shown("table"), |page| {
page.child(
div()
.flex_1()
.min_h(px(240.))
.child(DataTable::new(&self.table).stripe(true)),
)
})
}
}