13 Commits
Author SHA1 Message Date
nessarandClaude Opus 5.5 6d2605adfa Record the final 1.0 benchmark and GPUI's floor for budget 3 (#32)
CI / core (push) Successful in 1m36s
On the reference laptop, the release build of b8e4927 holds the five
budgets. Minimised, the app skips the paint but GPUI's vsync thread still
wakes the window: by the user's decision, budget 3's CPU limit is GPUI's
floor, 1.1 % minimised and 0.35 % hidden. Budget 4 passes at the
scenario's point only: « Défi » with the grid scrolled to its end still
holds 170-174 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:58:01 +01:00
nessarandClaude Opus 5.5 a6b396ab1e Make the 1.0 frame cost budget 1 (#32)
CI / core (push) Successful in 1m33s
An empty page costs GPUI 1.41 ms at the 99th percentile on the reference
laptop, and a window move redraws the whole page without its cached
views: 2 ms could not be held without simplifying the page or changing
GPUI's behaviour. By the user's decision, the limit is the 1.0 value,
6 ms at the 99th percentile for a frame drawn, to lower after 1.0 (#106).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:31:39 +01:00
nessarandClaude Opus 5.5 b8e49276ab Hold only the table's shown portraits (#32)
CI / core (push) Successful in 1m37s
The champion table drew its 128 px portraits through GPUI's app-wide
image cache, which keeps every image it ever loaded: once « Statistiques »
had been scrolled through, all 173 stayed decoded and in the atlas, about
25 MB on the reference laptop (budget 4). The table now reads them
through its own CardImages, as the card grids do: only the rows it paints
keep theirs, and it gives them back when « Défi » or « Paramètres » is
shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:20:30 +01:00
nessarandClaude Opus 5.5 f53db09d3e Skip GPUI's paint while the window is minimised (#32)
CI / core (push) Successful in 1m37s
GPUI's vsync thread invalidates the window at every vsync, minimised too,
and each WM_PAINT went through GPUI, which has no frame to draw then, and
DefWindowProc: the UI thread spent more minimised than visible (budget 3).
A subclass validates the paint while the window is iconic. On the manual
checks machine (240 Hz), minimised: 3.03 % of one core before, 0.22 %
after; the window draws again on restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:17:10 +01:00
nessarandClaude Opus 5.5 6311f01b49 Make GPUI's idle floor budget 2 (#32)
Idle with the window visible, every wake-up is GPUI's vsync thread and
the paint it asks for: 0.7 to 1.1 % of one core on the reference laptop,
which cannot be lowered without modifying GPUI (ADR-0004). As #32
provides, and by the user's decision, the floor becomes the limit:
1.1 %, lowered again as soon as GPUI's floor drops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:17:10 +01:00
nessarandClaude Opus 5.5 245d8ac64a Record the Windows trials of 2026-11-23 (#62)
Trials 1 to 5, 7, 8 and 10 to 13 pass on the build PC, driven from WSL
by posted clicks and window captures, on the maintainer's administrator
account with real data. Trial 9 and the network cut of trial 2 were set
aside; trials 6 and 14 wait for the 1.0.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:16:45 +01:00
nessarandClaude Opus 5.5 c97b9cb4cb Say that Velopack stops the app instead of waiting for it (#62)
Velopack 1.2.161 logs « Access is denied » when it waits for the app at
each apply, although the process can be waited on with SYNCHRONIZE, and
goes straight to force-stopping what runs from the installation. The app
has quit by then, and a forced stop loses no data: config.toml is written
aside then renamed, and Matches are in SQLite transactions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:16:45 +01:00
nessarandClaude Opus 5.5 f6973b162b Record beta 5 (#62)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 10:16:45 +01:00
nessarandClaude Opus 5.5 2b40dcf2d3 Record the 1.0 release benchmark on the reference laptop (#32)
Measured 995f454 (1.0.0-beta.5) on the Ryzen 5 7640U, release build and
its profile build. Budgets 1, 2, 4 and the minimised CPU of budget 3 are
over; budget 5 and the no-rendering part of budget 3 hold. Idle CPU has
a floor set by GPUI's vsync thread, recorded without changing the limit.
The scenarios are written down under Measuring, with
scripts/budget-probe.ps1 to repeat them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3E5kSZykyLnuoXsBC2
2026-11-23 09:52:20 +01:00
nessarandClaude Opus 5.5 995f454a9c Run the channel trials on the installed beta first (#62)
CI / core (pull_request) Successful in 1m32s
CI / core (push) Successful in 1m37s
The build PC already went from beta 3 to beta 4 by « Redémarrer », and
runs beta 4: trials 3 to 5 use it with beta 5 published. Trials that need
a ready update then reinstall A, which updates straight to the latest beta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 08:55:11 +01:00
nessarandClaude Opus 5.5 9c85104161 Try the update path with betas 3, 4 and 5 (#62)
CI / core (pull_request) Successful in 1m34s
Beta 3 was already published when beta 4 was, so beta 1 would now update
straight to beta 4. A is beta 3, B beta 4 and C beta 5, published after
trial 2; B and C carry the on-demand update check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 08:49:22 +01:00
nessarandClaude Opus 5.5 70baa311ae Record beta 2 and document the update check button (#62)
CI / core (pull_request) Successful in 1m34s
B is 1.0.0-beta.2, published on 2026-11-22 with its four files. The user
guide now says that « Rechercher une mise à jour » runs the check on demand
and that a failed check leaves a ready update ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192He3DgZBggc9wJG9c1nqA
2026-11-23 08:46:35 +01:00
nessarandClaude Opus 5.5 fe5683bc59 Document the user guide and the 1.0 release record (#62)
Add a user guide (install, channel choice, « Mise à jour prête »,
« Redémarrer », closing to the notification area, data kept) and the 1.0
release record: versions tried, the access used for trials, the Windows
test protocol with empty results, the #32 gate and the unauthenticated
check of the public release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:46:15 +01:00
15 changed files with 616 additions and 19 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# Arena Tracker
Application de bureau Windows qui suit les Parties d'Arena de League of Legends. Le vocabulaire du domaine est dans `CONTEXT.md` et les décisions d'architecture dans `docs/adr/`.
Application de bureau Windows qui suit les Parties d'Arena de League of Legends. Pour l'installer et l'utiliser : [guide d'utilisation](docs/guide-utilisation.md). Le vocabulaire du domaine est dans `CONTEXT.md` et les décisions d'architecture dans `docs/adr/`.
Règle n°1 : l'application reste fluide et légère, sans jamais donner l'impression de ralentir ni l'application ni l'ordinateur. Ses budgets mesurables (temps par image, CPU au repos, mémoire, travail de fond) et la façon de les mesurer sont dans `docs/performance.md`.
+1
View File
@@ -17,6 +17,7 @@ image = { version = "0.25.10", default-features = false, features = ["jpeg"] }
[target.'cfg(windows)'.dependencies]
raw-window-handle = "0.6"
windows = { version = "0.62", features = [
"Win32_Graphics_Gdi",
"Win32_Security",
"Win32_System_LibraryLoader",
"Win32_System_Registry",
+2 -1
View File
@@ -1,5 +1,6 @@
//! The portraits of a card grid: decoded only for the cards it paints, and freed, in memory and
//! on the GPU, once it paints them no more (rule #1: memory in proportion to what is shown).
//! on the GPU, once it paints them no more (rule #1: memory in proportion to what is shown). The
//! champion table holds its rows' portraits the same way.
//!
//! Each grid owns one `CardImages`, which its cards' `img` elements read through (`provide`),
//! never through GPUI's app-wide asset cache, which keeps every image it ever loaded. A grid may
+85 -2
View File
@@ -9,6 +9,7 @@ use gpui_kit::component::{ActiveTheme as _, Icon, IconName, StyledExt as _};
use gpui_kit::prelude::FluentBuilder as _;
use gpui_kit::*;
use crate::card_images::{self, CardImages};
use crate::text::{decimal, state_label};
struct Spec {
@@ -49,6 +50,9 @@ pub struct ChampionTable {
/// The clicked champion's id: it stays selected through sorting and reloads.
selected: Option<u32>,
scroll: UniformListScrollHandle,
/// The portraits of the rows painted, never GPUI's app-wide cache, which would keep every
/// one scrolled past (budget 4). Created at the first render.
images: Option<Entity<CardImages>>,
/// Guards the cache in tests.
#[cfg(test)]
pub(crate) renders: usize,
@@ -62,11 +66,25 @@ impl ChampionTable {
sort: None,
selected: None,
scroll: UniformListScrollHandle::new(),
images: None,
#[cfg(test)]
renders: 0,
}
}
/// The table is not shown any more: its portraits are given back, in memory and in the
/// window's atlas, and load again when it is drawn.
pub fn release_images(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let released = self
.images
.as_ref()
.is_some_and(|images| images.update(cx, |images, cx| images.release(window, cx)));
if released {
// A cached view replays its last paint unless it is drawn again.
cx.notify();
}
}
/// Replaces the rows (already filtered) and keeps them sorted.
pub fn set_rows(&mut self, rows: Vec<ChampionRow>, in_season: bool) {
self.rows = rows;
@@ -74,6 +92,11 @@ impl ChampionTable {
self.resort();
}
#[cfg(test)]
pub(crate) fn images(&self) -> Option<&Entity<CardImages>> {
self.images.as_ref()
}
#[cfg(test)]
pub(crate) fn names(&self) -> Vec<String> {
self.rows.iter().map(|r| r.champion.name.clone()).collect()
@@ -232,11 +255,15 @@ fn cell_text(row: &ChampionRow, key: SortKey) -> String {
}
impl Render for ChampionTable {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
#[cfg(test)]
{
self.renders += 1;
}
let images = (self.images)
.get_or_insert_with(|| CardImages::new(cx))
.clone();
images.update(cx, |images, cx| images.start_render(window, cx));
let theme = cx.theme();
let (background, border, radius, muted) = (
theme.table,
@@ -265,7 +292,7 @@ impl Render for ChampionTable {
.track_scroll(&self.scroll)
.into_any_element()
};
div()
card_images::provide(div(), images)
.v_flex()
.relative()
.size_full()
@@ -321,6 +348,62 @@ pub(crate) mod tests {
}
}
// Only the rows painted keep their portraits, and none is kept once the table is not shown.
#[gpui::test]
fn the_table_holds_only_the_portraits_of_the_rows_it_paints(cx: &mut gpui_kit::TestAppContext) {
use gpui_kit::{
AppContext as _, Bounds, VisualTestContext, WindowBounds, WindowOptions, point, px,
size,
};
use crate::card_images::tests::{PORTRAIT_JPEG, TestDir};
let dir = TestDir::new("table-portraits");
let rows: Vec<ChampionRow> = (1..=170)
.map(|id| {
let path = dir.path().join(format!("{id}.jpg"));
std::fs::write(&path, PORTRAIT_JPEG).unwrap();
let mut row = row(&format!("Champion {id:03}"));
row.champion.id = id;
row.portrait = Some(path);
row
})
.collect();
cx.update(gpui_kit::init);
let (window, table) = cx.update(|cx| {
let options = WindowOptions {
window_bounds: Some(WindowBounds::Windowed(Bounds {
origin: point(px(0.), px(0.)),
size: size(px(1280.), px(860.)),
})),
..Default::default()
};
gpui_kit::open_window(options, cx, |_, cx| {
cx.new(|_| {
let mut table = ChampionTable::new();
table.set_rows(rows, false);
table
})
})
.unwrap()
});
let cx = &mut VisualTestContext::from_window(window, cx);
cx.update(|window, cx| window.draw(cx).clear(cx));
cx.run_until_parked();
cx.update(|window, cx| window.draw(cx).clear(cx));
let images = table.read_with(cx, |table, _| table.images().cloned().unwrap());
let held = images.read_with(cx, |images, _| images.loaded().len());
// The rows in the window's 860 px at 32 px each, not the 170.
assert!((10..=30).contains(&held), "{held} portraits held");
// Checked before the next frame: here the table is still the window, and draws again.
cx.update(|window, cx| {
table.update(cx, |table, cx| table.release_images(window, cx));
assert!(images.read(cx).held().is_empty());
});
}
#[test]
fn missing_values_show_a_dash() {
let row = row("Ahri");
+2
View File
@@ -8,6 +8,7 @@ mod card_lift;
mod card_order;
mod champion_table;
mod logon;
mod minimized;
mod motion;
mod page;
#[cfg(feature = "profile")]
@@ -342,6 +343,7 @@ fn main() {
gpui_kit::open_window(options, cx, |window, cx| {
single_instance::accept_relaunches(window);
motion::follow_windows_setting(window, cx);
minimized::skip_paint_while_minimized(window);
// The settings form installs the tray that hides the window.
let root = cx.new(|cx| RootView::new(setup, at_logon, window, cx));
if at_logon {
+44
View File
@@ -0,0 +1,44 @@
//! A minimised window draws nothing, yet GPUI's vsync thread invalidates it at each vsync, and
//! each WM_PAINT went through GPUI, which has no frame to draw while minimised, then
//! DefWindowProc: the UI thread spent more minimised than visible (budget 3,
//! `docs/performance.md`). The paint is validated here instead, before GPUI sees it.
use gpui_kit::Window;
use windows::Win32::Foundation::{HWND, LPARAM, LRESULT, WPARAM};
use windows::Win32::Graphics::Gdi::ValidateRect;
use windows::Win32::UI::Shell::{DefSubclassProc, RemoveWindowSubclass, SetWindowSubclass};
use windows::Win32::UI::WindowsAndMessaging::{IsIconic, WM_NCDESTROY, WM_PAINT};
use crate::tray::window_hwnd;
/// Subclass ids are per procedure.
const MINIMIZED_SUBCLASS: usize = 0;
pub(crate) fn skip_paint_while_minimized(window: &Window) {
if let Some(hwnd) = window_hwnd(window) {
// Without the subclass, GPUI handles these paints as before.
let _ = unsafe { SetWindowSubclass(hwnd, Some(paint_proc), MINIMIZED_SUBCLASS, 0) };
}
}
unsafe extern "system" fn paint_proc(
hwnd: HWND,
message: u32,
wparam: WPARAM,
lparam: LPARAM,
_id: usize,
_data: usize,
) -> LRESULT {
match message {
// GPUI gives its frame callback back at the restore's WM_SIZE, and draws then.
WM_PAINT if unsafe { IsIconic(hwnd) }.as_bool() => {
let _ = unsafe { ValidateRect(Some(hwnd), None) };
return LRESULT(0);
}
WM_NCDESTROY => {
let _ = unsafe { RemoveWindowSubclass(hwnd, Some(paint_proc), MINIMIZED_SUBCLASS) };
}
_ => {}
}
unsafe { DefSubclassProc(hwnd, message, wparam, lparam) }
}
+4
View File
@@ -407,6 +407,10 @@ impl Page {
// Nor is the banner: its illustration too.
self.banner_art
.update(cx, |art, cx| art.release(window, cx));
} else {
// Nor is the table: its portraits.
self.table
.update(cx, |table, cx| table.release_images(window, cx));
}
}
+4 -2
View File
@@ -10,8 +10,8 @@ impl Page {
}
/// The page gives way to another screen (« Paramètres »): what it shows is given back, the
/// grids' portraits and the banner's splash, in memory and in the window's atlas. They load
/// again when it is drawn.
/// grids' and the table's portraits and the banner's splash, in memory and in the window's
/// atlas. They load again when it is drawn.
pub(crate) fn hidden(&mut self, window: &mut Window, cx: &mut Context<Self>) {
self.covered = true;
self.end_stage(cx);
@@ -22,6 +22,8 @@ impl Page {
}
self.banner_art
.update(cx, |art, cx| art.release(window, cx));
self.table
.update(cx, |table, cx| table.release_images(window, cx));
}
/// The page is back in front of « Paramètres ».
+3 -3
View File
@@ -148,9 +148,9 @@ fn installer() -> io::Result<PathBuf> {
Ok(root.ok_or(io::ErrorKind::NotFound)?.join("Update.exe"))
}
/// Starts Velopack's installer on an authenticated package, which it reads in place: it waits
/// for this process to exit, replaces `current\` and opens the app once, this version again if
/// it fails (ADR-0005, `docs/paquets-windows.md`). At logon, Velopack 1.2.161
/// Starts Velopack's installer on an authenticated package, which it reads in place: it stops
/// this process if it still runs (1.2.161 fails to wait for it), replaces `current\` and opens
/// the app once, this version again if it fails (ADR-0005, `docs/paquets-windows.md`). At logon, Velopack 1.2.161
/// shows neither its progress window nor its dialogs (`--silent`, which must come before
/// `--`), and hands the arguments after `--` to the version it opens, in both cases.
fn start_installer(package: &Path, at_logon: bool) -> io::Result<u32> {
+55
View File
@@ -0,0 +1,55 @@
# Guide d’utilisation
## Installer
Les versions se téléchargent sans compte depuis la page [Releases](https://gitea.nessar.fr/nessar/arena-tracker/releases) :
- **Stable** : `ArenaTracker-stable-Setup.exe`, dans la dernière Release qui n’est pas une préversion.
- **Bêta** : `ArenaTracker-beta-Setup.exe`, dans la dernière préversion.
L’installateur ne demande pas de droits d’administrateur. Il installe Arena Tracker pour le compte Windows courant et ajoute **Arena Tracker** au menu Démarrer. Au premier lancement, l’application demande une clé API Riot, à obtenir sur le [portail développeur Riot](https://developer.riotgames.com).
L’installateur ne porte pas de signature Authenticode : Windows peut afficher un avertissement SmartScreen avant de l’ouvrir. Cet avertissement ne dit rien des mises à jour : Arena Tracker vérifie lui-même la signature de chaque paquet téléchargé et refuse un paquet altéré.
## Choisir Stable ou Bêta
Dans **Paramètres** (roue dentée de la barre de titre), section **Mises à jour** :
- **Stable** ne reçoit que les versions stables.
- **Bêta** reçoit chaque nouvelle bêta, avant la stable qui suivra.
Sans choix enregistré, le canal est celui de l’installateur utilisé. Une mise à jour ne change jamais le canal choisi. Repasser à Stable depuis une bêta ne revient pas à une version plus ancienne : la bêta reste en place jusqu’à la stable suivante, et les Paramètres l’indiquent.
## Mises à jour
Au démarrage, et après un changement de canal, Arena Tracker cherche une version plus récente du canal choisi et la télécharge en arrière-plan. Le bouton « Rechercher une mise à jour » des Paramètres lance la même recherche à la demande, et les Paramètres indiquent comment s’est terminée la dernière : « Recherche en cours… », « Vous avez la dernière version », ou la raison de l’échec. L’application reste utilisable pendant ce temps. Sans réseau ou en cas d’échec, rien ne change : une mise à jour déjà prête le reste.
Une flèche verte, « Mise à jour prête », apparaît dans la barre de titre une fois le paquet téléchargé et sa signature vérifiée. Elle ouvre les Paramètres, qui indiquent la version et proposent « Redémarrer » :
- « Redémarrer » ferme Arena Tracker, installe la mise à jour (une fenêtre de progression s’affiche) et ouvre la nouvelle version.
- Sinon, la mise à jour s’installe au lancement qui suit « Quitter », même hors ligne.
Si l’installation échoue, la version précédente s’ouvre avec un bandeau qui le signale. « Redémarrer » permet de réessayer.
## Fermer la fenêtre
Par défaut, le bouton de fermeture cache la fenêtre dans la zone de notification, et Arena Tracker continue de suivre les Parties. Un clic sur son icône rouvre la fenêtre ; un clic droit propose « Ouvrir » et « Quitter ». L’option **Fermer dans la zone de notification** des Paramètres désactive ce comportement : la fermeture quitte alors l’application.
Relancer Arena Tracker depuis le menu Démarrer pendant qu’il tourne ramène simplement sa fenêtre. Au début d’une Sélection des champions Arena, la fenêtre réduite ou cachée se rouvre d’elle-même, sans prendre le focus.
## Données
La clé Riot, les préférences, les Parties et les Saisons sont dans `%APPDATA%\arena-tracker` :
| Fichier | Contenu |
| --- | --- |
| `config.toml` | Clé API Riot, préférences et canal choisi |
| `arena-tracker.db` | Parties importées |
| `seasons.toml` | Table des Saisons, modifiable, relue au lancement |
| `portraits` | Portraits des champions |
Les mises à jour, la désinstallation et la réinstallation conservent ce dossier. Le paquet de mise à jour téléchargé est conservé à part, dans `%LOCALAPPDATA%\arena-tracker\updates`. Pour tout effacer, supprimer ces deux dossiers après la désinstallation.
## Désinstaller
**Paramètres Windows → Applications → Applications installées → Arena Tracker → Désinstaller.** Le dossier des données reste en place.
+97
View File
@@ -0,0 +1,97 @@
# Livraison 1.0
Recette de la 1.0 (#62) : les versions et commits essayés, les essais Windows et leurs résultats, le contrôle de performance et la publication. Une case vide est un essai pas encore fait. La 1.0 est livrée quand toutes les cases sont remplies et le contrôle de performance validé.
## Versions essayées
| Rôle | Version | Commit | Release |
| --- | --- | --- | --- |
| A | 1.0.0-beta.3 | `2c9ca45` | Préversion publiée le 2026-11-22 |
| B | 1.0.0-beta.4 | `1ad36bd` | Préversion publiée le 2026-11-23 |
| C | 1.0.0-beta.5 | `995f454` | Préversion publiée le 2026-11-23 |
| Stable | 1.0.0 | | |
Les bêtas se publient depuis develop par `scripts/publish beta` ([Publication](publication.md)). Le poste de build a B installée et C publiée : les essais 3 à 5 se font d’abord, sur B. Pour retrouver ensuite une mise à jour prête (essais 2, 7 à 12) : désinstaller, supprimer `%LOCALAPPDATA%\arena-tracker\updates` (la trace d’une mise à jour déjà appliquée y serait lue comme un échec), réinstaller A depuis l’installateur de sa Release, puis lancer en ligne jusqu’à « Mise à jour prête ». A passe directement à la dernière bêta. La stable 1.0.0 se publie depuis le commit de la dernière bêta validée.
## Accès pendant les essais
Le dépôt est public depuis le 2026-11-20 (#58), avant le début de ces essais, qui prévoyaient un accès privé. Les bêtas d’essai sont donc des préversions publiques. Le canal Bêta les lit sans compte ni jeton ; le canal Stable ne les voit pas. L’application ne contient que la clé publique de vérification. Le jeton Gitea n’existe que dans le terminal du mainteneur pendant `scripts/publish`, qui le retire de l’environnement avant la compilation.
Le 2026-11-21, depuis WSL et sans authentification, l’API des préversions a renvoyé `v1.0.0-beta.1` avec ses quatre fichiers. Leur téléchargement a abouti, et le SHA-256 du paquet correspondait au manifeste. L’`arena-tracker.exe` du paquet a accepté la Release (`--verify-release`, code 0) et refusé une copie dont un bit du paquet était inversé (code 1). `Get-AuthenticodeSignature` a renvoyé `NotSigned` sur l’installateur. L’API des versions stables ne renvoyait encore aucune Release.
## Conditions des essais Windows
- Un compte Windows standard, non administrateur, dont la configuration contient une clé Riot, des Parties importées et une Saison personnalisée dans `seasons.toml`.
- Les installateurs et paquets des Releases, jamais une compilation locale.
Les essais du 2026-11-23 ont été pilotés depuis WSL sur le poste de build (Ryzen 7 7800X3D), sur le compte du mainteneur, **administrateur**, avec ses vraies données (485 Parties, Saison personnalisée « Saison 2 · 2026 »). Les clics étaient des messages postés à la fenêtre, et « Quitter » la commande du menu de la zone de notification ; chaque résultat a été lu sur une capture de la fenêtre et dans l’état des fichiers et des processus. Les désinstallations ont utilisé la commande silencieuse de l’entrée **Applications installées** (`Update.exe --uninstall --silent`), et les installations l’installateur de A téléchargé avec `curl.exe`.
- La notification de la zone de notification a déjà été vue une fois : elle écrit `tray_notice_shown` dans `config.toml`.
- Avant et après chaque essai, la même fenêtre : Compte, Saison personnalisée, compteur du Défi et Parties affichées. Hors préférences modifiées pendant l’essai, `config.toml` et `seasons.toml` restent identiques :
```powershell
$d = "$env:APPDATA\arena-tracker"; Get-FileHash "$d\config.toml", "$d\seasons.toml" | Format-Table Hash, Path
```
Version installée : `(Get-Item "$env:LOCALAPPDATA\ArenaTracker\current\arena-tracker.exe").VersionInfo.ProductVersion`. Installateur Velopack en cours : `Get-Process Update -ErrorAction SilentlyContinue | Where-Object Path -like "$env:LOCALAPPDATA\ArenaTracker\*"`. Journal de Velopack : `%LOCALAPPDATA%\velopack\velopack_ArenaTracker.log`.
## Essais
| # | Essai | Attendu | Résultat |
| --- | --- | --- | --- |
| 1 | A installée, canal Bêta, B publiée : lancer, puis « Redémarrer » | « Mise à jour prête » puis « Mise à jour prête : version 1.0.0-beta.4 » dans les Paramètres. Après « Redémarrer », la fenêtre de progression, puis B s’ouvre une seule fois. Données conservées | 2026-11-23 08:49 : B appliquée par « Redémarrer » (journal Velopack, `Restart: true`). Le même chemin, données comparées, est l’essai 5 |
| 2 | Après les essais 3 à 5, retrouver une mise à jour prête (ci-dessus). « Quitter » dans la zone de notification, couper le réseau, relancer par le menu Démarrer | C s’installe et s’ouvre hors ligne. Données conservées | 2026-11-23, en ligne : la coupure réseau a été écartée. A → C installée au lancement qui suit « Quitter » (essai 8) |
| 3 | Sur B, canal Bêta, C publiée : choisir Stable, puis relancer | Pas de « Mise à jour prête ». Les Paramètres indiquent « La bêta installée reste en place jusqu’à une version stable plus récente. » | 2026-11-23 : réussi. Dès le choix de Stable : « Vous avez la dernière version (1.0.0-beta.4) » et le message attendu ; de même après « Quitter » et relance |
| 4 | Revenir à Bêta jusqu’à « Mise à jour prête » pour C. Choisir Stable, puis « Quitter » et relancer | « Mise à jour prête » et « Redémarrer » disparaissent. Le lancement suivant n’installe pas C, et le dossier `updates\beta-1.0.0-beta.5` disparaît à la vérification suivante | 2026-11-23 : réussi. « Mise à jour prête : version 1.0.0-beta.5 » après le retour à Bêta. Au choix de Stable, la flèche, le message et « Redémarrer » disparaissent, et le dossier `beta-1.0.0-beta.5` aussi, sans attendre la relance. La relance garde B |
| 5 | Revenir à Bêta, puis « Redémarrer » | C s’ouvre : deux bêtas successives reçues (A → B → C) | 2026-11-23 : réussi. C ouverte moins d’une seconde après « Redémarrer », une seule fois. A → B (08:49) → C. Empreintes de `config.toml` et `seasons.toml` identiques, même fenêtre |
| 6 | Après publication de la 1.0.0 : sur C, choisir Stable et relancer | 1.0.0 proposée puis installée ; jamais une version plus ancienne. La clé de C a accepté la stable | |
| 7 | Une mise à jour prête : relancer par le menu Démarrer avec la fenêtre visible, réduite, puis cachée dans la zone de notification | La même fenêtre revient ; un seul `arena-tracker.exe` (`Get-Process arena-tracker`), aucun installateur en cours | 2026-11-23 : réussi. A installée, C prête : la fenêtre revient dans les trois cas, un seul `arena-tracker.exe`, aucun installateur, A reste en place |
| 8 | Une mise à jour prête : « Quitter », puis deux lancements rapprochés par le menu Démarrer | Un seul installateur en cours, une seule fenêtre à la fin | 2026-11-23 : réussi. Au plus un installateur et un `arena-tracker.exe` à la fois (relevé toutes les 100 ms). À la fin, C ouverte dans une seule fenêtre |
| 9 | Lancer sans réseau (mode Avion) | Pas de « Mise à jour prête » ; l’application et les Parties restent consultables | Écarté le 2026-11-23 : pas de coupure réseau pendant ces essais |
| 10 | Pendant un téléchargement, quand `updates\partial` contient le paquet incomplet : couper le réseau, ou arrêter Arena Tracker dans le Gestionnaire des tâches. Puis relancer en ligne | Rien n’est prêt avec le paquet incomplet. Au lancement suivant, il est retéléchargé puis prêt. L’essai ne compte que si le paquet incomplet a été vu | 2026-11-23 : réussi, par arrêt du processus. Arrêté à 1 129 789 octets sur 16 614 628, seul `partial` existait. Au lancement suivant, le paquet a été retéléchargé en entier, puis « Mise à jour prête » |
| 11 | Une mise à jour prête : inverser un bit du paquet conservé (commande ci-dessous), puis « Redémarrer » | « Mise à jour refusée : condensat du paquet différent. » La version installée reste utilisable ; le paquet est retéléchargé et de nouveau prêt | 2026-11-23 : réussi. Message affiché en rouge sous « Redémarrer », A reste ouverte. Le paquet est aussitôt retéléchargé et de nouveau prêt ; son SHA-256 correspond au manifeste |
| 12 | Une mise à jour prête : verrouiller un fichier de `current` (commande ci-dessous), « Redémarrer », puis libérer le fichier | L’ancienne version se rouvre avec le bandeau « La mise à jour vers la version … n’a pas pu être installée ; la version actuelle reste en place. » « Redémarrer » réussit ensuite | 2026-11-23 : réussi. Velopack a réessayé pendant 5 s (`Access is denied`), puis A s’est rouverte 9 s après le clic avec le bandeau, pour 1.0.0-beta.5. Le fichier libéré, « Redémarrer » a ouvert C en 3 s |
| 13 | Désinstaller, réinstaller, relancer, puis désinstaller de nouveau | Le dossier d’installation, le raccourci et l’entrée **Applications installées** disparaissent à la désinstallation ; les données restent identiques | 2026-11-23 : réussi, trois désinstallations. Après chacune : ni `current`, ni raccourci, ni entrée **Applications installées**, ni lancement à l’ouverture de session. Empreintes identiques. Une réinstallation désactive « Lancer à l’ouverture de session Windows », comme prévu ; l’option a été réactivée à la fin |
| 14 | Télécharger l’installateur stable avec un navigateur, puis l’ouvrir | Consigner ce qu’affiche Windows (SmartScreen, éditeur) et `Get-AuthenticodeSignature`. L’installateur n’a pas de signature Authenticode ([Signature reconnue par Windows](paquets-windows.md#signature-reconnue-par-windows)) | |
Essai 11, depuis PowerShell :
```powershell
$p = (Get-ChildItem "$env:LOCALAPPDATA\arena-tracker\updates\*-*\*.nupkg" | Select-Object -First 1).FullName
$b = [IO.File]::ReadAllBytes($p); $i = [int]($b.Length / 2); $b[$i] = $b[$i] -bxor 1; [IO.File]::WriteAllBytes($p, $b)
```
Essai 12, depuis PowerShell, laissé ouvert pendant « Redémarrer », puis `$h.Close()`. Un nouveau fichier, et non `sq.version`, que Velopack lit avant de commencer :
```powershell
$h = [IO.File]::Open("$env:LOCALAPPDATA\ArenaTracker\current\verrou.tmp", 'CreateNew', 'ReadWrite', 'None')
```
## Contrôle de performance
La 1.0 est une version majeure : son feu vert dépend du benchmark complet de #32, à l’étape 1 de [Publier une stable](publication.md#publier-une-stable). Les chiffres et leur date sont dans le [tableau des budgets](performance.md#budgets).
| Commit mesuré | Date | Résultat |
| --- | --- | --- |
| `995f454` (1.0.0-beta.5) | 2026-11-23 | budgets 1, 2, 3 (fenêtre minimisée) et 4 dépassés : pas de feu vert |
| `b8e4927` | 2026-11-23 | budgets 3 et 4 corrigés ; limites des budgets 1, 2 et 3 ramenées aux planchers de GPUI par décision du mainteneur : les cinq budgets tenus, feu vert |
## Publication publique
1. Feu vert de performance sur le commit à livrer.
2. Promotion vers main, contrôles CI, puis `scripts/publish stable` ([Publier une stable](publication.md#publier-une-stable)).
3. Depuis un poste sans authentification Gitea, depuis WSL :
```bash
base=https://gitea.nessar.fr; mkdir -p rel
curl -sS "$base/api/v1/repos/nessar/arena-tracker/releases?draft=false&pre-release=false&limit=10" | python3 -c "import json, sys; print([r['tag_name'] for r in json.load(sys.stdin)])"
for f in ArenaTracker-1.0.0-stable-full.nupkg ArenaTracker-stable-Setup.exe release-stable.json release-stable.sig; do curl -sSfL -o "rel/$f" "$base/nessar/arena-tracker/releases/download/v1.0.0/$f"; done
unzip -p rel/ArenaTracker-1.0.0-stable-full.nupkg lib/app/arena-tracker.exe > arena-tracker.exe && chmod +x arena-tracker.exe
./arena-tracker.exe --verify-release "$(wslpath -w rel)"; echo "code $?"
```
Attendu : `['v1.0.0']`, quatre téléchargements, `code 0`. L’exécutable du paquet vérifie avec sa propre clé ; la vérification par une installation antérieure est l’essai 6. Puis ouvrir la page [Releases](https://gitea.nessar.fr/nessar/arena-tracker/releases) dans une fenêtre de navigation privée et télécharger l’installateur.
| Étape | Date | Résultat |
| --- | --- | --- |
| Tag `v1.0.0` publié | | |
| Flux et signature vérifiés sans authentification | | |
+1 -1
View File
@@ -41,7 +41,7 @@ Les fichiers sont téléchargés dans `%LOCALAPPDATA%\arena-tracker\updates\part
## Application de la mise à jour
« Redémarrer », dans les Paramètres, et le lancement qui suit « Quitter » appliquent le même paquet : le dossier du canal choisi dont la version dépasse la version installée, vérifié de nouveau par `verify_release`. L’application lance alors, depuis la racine de l’installation, `Update.exe apply --waitPid <pid> --package <paquet>` sur le fichier qui vient d’être vérifié dans `%LOCALAPPDATA%\arena-tracker\updates`, puis se ferme comme avec « Quitter », sans passer par la zone de notification. Velopack 1.2.161 lit ce fichier sur place, sans le copier dans `packages`. Il attend la fin du processus (60 s au plus, puis il arrête tout programme lancé depuis l’installation), extrait le paquet, remplace `current` et ouvre une seule fois la nouvelle version, ou de nouveau l’ancienne en cas d’échec. Il affiche sa fenêtre de progression et journalise dans `%LOCALAPPDATA%\velopack\velopack_ArenaTracker.log`. [Commande apply](https://github.com/velopack/velopack/blob/1.2.161/src/bins/src/commands/apply.rs) · [Remplacement sous Windows](https://github.com/velopack/velopack/blob/1.2.161/src/bins/src/commands/apply_windows_impl.rs)
« Redémarrer », dans les Paramètres, et le lancement qui suit « Quitter » appliquent le même paquet : le dossier du canal choisi dont la version dépasse la version installée, vérifié de nouveau par `verify_release`. L’application lance alors, depuis la racine de l’installation, `Update.exe apply --waitPid <pid> --package <paquet>` sur le fichier qui vient d’être vérifié dans `%LOCALAPPDATA%\arena-tracker\updates`, puis se ferme comme avec « Quitter », sans passer par la zone de notification. Velopack 1.2.161 lit ce fichier sur place, sans le copier dans `packages`. Il doit attendre la fin du processus (60 s au plus), puis arrêter tout programme encore lancé depuis l’installation. En pratique, il n’attend pas : à chaque application observée, son journal indique `Failed to wait for process (<pid>) to exit (Access is denied.)`, alors que le processus de l’application s’attend bien avec le droit `SYNCHRONIZE` (vérifié le 2026-11-23). Il passe donc directement à l’arrêt forcé, environ 0,3 s plus tard, et l’application quitte avant : seul `Update.exe` restait dans l’installation. Un arrêt forcé ne perd pas de données : `config.toml` s’écrit à côté puis se renomme, et les Parties sont dans SQLite, en transactions. Ensuite, il extrait le paquet, remplace `current` et ouvre une seule fois la nouvelle version, ou de nouveau l’ancienne en cas d’échec. Il affiche sa fenêtre de progression et journalise dans `%LOCALAPPDATA%\velopack\velopack_ArenaTracker.log`. [Commande apply](https://github.com/velopack/velopack/blob/1.2.161/src/bins/src/commands/apply.rs) · [Remplacement sous Windows](https://github.com/velopack/velopack/blob/1.2.161/src/bins/src/commands/apply_windows_impl.rs)
Au lancement, cette décision suit l’élection de l’instance unique et précède toute fenêtre. Un raccourci lancé pendant qu’Arena Tracker tourne, visible, réduit ou caché dans la zone de notification, ramène seulement sa fenêtre (#50) : ni second suivi, ni recherche, ni installation. Avant de lancer `Update.exe`, l’application crée `<canal>-<version>.attempt` à côté du dossier du paquet, puis y inscrit l’identifiant du processus. Ce fichier survit à un nouveau téléchargement de la même version. Un lancement qui le trouve ne relance jamais l’installation lui-même ; seule une version plus récente repart de zéro. Si ce processus `Update.exe` tourne encore (lancement rapproché, ou ancienne version rouverte par Velopack après un échec), il attend sa fin, 3 min au plus. Un code de sortie 0 laisse la place à la version que Velopack ouvre ; sinon l’application s’ouvre dans sa version actuelle et signale l’échec une fois, dans un bandeau. « Redémarrer » permet de réessayer. Un paquet altéré depuis son téléchargement est refusé et signalé ; la vérification suivante le télécharge de nouveau. Si la configuration est illisible, le canal choisi est inconnu et rien n’est appliqué.
+29 -8
View File
@@ -10,13 +10,22 @@ Measured on the **reference machine**, on a **release build** (`scripts/prod run
| # | Budget | Limit | Current value | Status |
| --- | --- | --- | --- | --- |
| 1 | Interactions (hover, scroll, sort, filter, moving or resizing the window): cost of one frame | at most **2 ms** at the 99th percentile, aiming for 1 ms | 5–7 ms for a full frame of the statistics page; a window move redraws one, 5–8 ms per move at the 95th percentile (before #31) | over budget; to re-measure since #31 |
| 2 | Idle, window visible: CPU | at most **0.5 %** of one core on average | 0.3–1.4 % (about 0.8 %) | over budget |
| 3 | Window minimised or hidden | **no rendering**, CPU close to 0, outside an import | not measured | unknown |
| 4 | Memory, with the full page loaded (every champion and portrait) | at most **150 MB** working set | 120 MB working set, 99 MB private | within budget |
| 5 | Background work (import, following the game client) | threads at **low priority**, never more than **one core** | not measured | unknown |
| 1 | Interactions (hover, scroll, sort, filter, moving or resizing the window): cost of one frame | at most **6 ms** at the 99th percentile for a frame drawn (profile build): the 1.0 value, set on 2026-11-23 (#32), to lower after 1.0 (#106); it was 2 ms, aiming for 1 ms | every interaction draws a full frame: 2.8–3.3 ms at the median, 5.3–5.9 ms at the 99th percentile, plus 0.4–0.5 ms of presentation (profile build); single frames up to 8 ms while scrolling; a window move holds the UI thread 3.3 ms at the 95th percentile, 4.4–4.5 ms at the 99th (release) | within budget, close to the limit |
| 2 | Idle, window visible: CPU | at most **1.1 %** of one core on average: GPUI's floor, set on 2026-11-23 (#32); it was 0.5 % | 0.88–1.08 % over three phases of 30 s, no frame drawn; floor set by GPUI's vsync thread, see below | within budget, close to the limit |
| 3 | Window minimised or hidden | **no rendering**; CPU at most **1.1 %** of one core minimised and **0.35 %** hidden, outside an import: GPUI's floor, set on 2026-11-23 (#32); it was « close to 0 » | no frame drawn either way; minimised 0.98–1.03 %, hidden in the notification area 0.34 % | within budget |
| 4 | Memory, with the full page loaded (every champion and portrait) | at most **150 MB** working set | 146–149 MB working set, 122–123 MB private, at the end of the memory scenario; « Défi » with the home grid scrolled to its end holds 170–174 MB, and 159–163 MB at start | within budget, at the scenario's point only |
| 5 | Background work (import, following the game client) | threads at **low priority**, never more than **one core** | import of 466 Matches with the client open: at most 16.6 % of one core in a sample, the work on below-normal threads (4.8 s of CPU, against 0.4 s on normal-priority threads, none above 1.6 % in a sample) | within budget |
Current values measured on 2026-11-16 and 2026-11-17 (issue #17). For information, #31 made a full frame about a third cheaper on the manual checks machine (drawing it: 2.37 → 1.57 ms at the median, 3.72 → 2.50 ms at the 99th percentile, plus 0.22 ms of presentation); its value here is still to measure.
Values of the 1.0 release benchmark: 2026-11-23, reference machine, release build of `b8e4927` (the 1.0's code) and its `--features profile` build for the frame breakdown, scenarios and details below. A first run on `995f454` (1.0.0-beta.5) failed budgets 1 to 4; the app was fixed for budgets 3 (`f53db09`) and 4 (`b8e4927`), and the user set budgets 1, 2 and 3's limits to the floors GPUI sets. No limit was beaten, so none is lowered. The previous values (2026-11-16 and 2026-11-17, issue #17) were 5–7 ms per full frame, 0.3–1.4 % idle and 120 MB working set, before the identity (#80) added the banner, its splash and the portrait cards.
### Release benchmark 1.0 (2026-11-23)
- **Budget 1.** Nothing a frame is asked for is cheap: each window move, hovered row or wheel step draws the whole window, at 60 frames per second (`request_layout` 0.7–1.0 ms, `prepaint` 1.6–2.2 ms, `paint` 0.7–1.3 ms at the median). On « Défi » the card grid's own prepaint takes 1.6–1.8 ms per frame, whether the window moves or the grid scrolls; on « Statistiques » the table's prepaint takes 0.8–1.0 ms and the charts' cached paint 0.3–0.4 ms; the page's layout 0.6 ms when it renders again; the rest is GPUI's own work, in pieces under the 0.5 ms the profile records. Hovering the table costs as much as moving the window: 31 % of one core at 240 moves per second, input waiting up to 5.2 ms at the 99th percentile. Scrolling the home grid draws a frame per wheel step at 4.0 ms median and 5.8–6.0 ms at the 99th percentile. An empty page costs GPUI itself 0.76 ms at the median and 1.41 ms at the 99th percentile (« Défi » with every part hidden, under the move probe); « Défi » without the card grid, 3.58 ms at the 99th percentile. A window move calls GPUI's `Window::bounds_changed`, which refreshes the whole window and bypasses every cached view. 2 ms could not be held without simplifying the page or changing GPUI's behaviour: the user set the limit to the 1.0 value, 6 ms at the 99th percentile, to lower after 1.0 (#106).
- **Budget 2.** The cause of each wake-up, window visible and nothing drawn: GPUI's `VSyncProvider` thread (`gpui-pre-windows`, `platform.rs`) waits on `DwmFlush` at each vsync (61 wakes per second, about 0.3 % of one core) and invalidates every window with `RedrawWindow`; the UI thread then takes a `WM_PAINT` at each vsync (67 wakes per second, 0.4–0.7 %), runs GPUI's frame callback, finds nothing to draw and draws nothing. The app's own threads wake about once per second (under 0.05 %). This floor, 0.7–1.1 %, cannot be lowered without modifying GPUI (ADR-0004): as #32 provides, it became budget 2 on 2026-11-23, by the user's decision. It is lowered as soon as GPUI's floor drops (ratchet).
- **Budget 3.** Hidden in the notification area, the UI thread never wakes; GPUI's vsync thread alone still does, 61 times per second (0.24–0.29 %). Minimised, the vsync thread keeps invalidating the window (it only skips the frame signal for an iconic window) and the UI thread wakes about 89 times per second without drawing: 1.2–1.7 %, more than visible. Fixed after the benchmark: while the window is minimised, a subclass validates each `WM_PAINT` before GPUI sees it (`minimized.rs`), as GPUI has no frame to draw then. On the manual checks machine (240 Hz, for information), minimised: 3.03 % of one core before, 0.22 % after, the UI thread 469 ms then 31 ms over 21 s; to measure again on the reference machine. On the reference laptop, `b8e4927`: minimised 0.98–1.03 %, the UI thread still woken 65–66 times per second, about 85 µs per wake against about 5 µs on the manual checks machine: the paint is skipped, not the wake GPUI's vsync thread causes. Minimised now costs what visible idle does, GPUI's floor: by the user's decision, the limit is 1.1 % minimised and 0.35 % hidden. Hiding the window when minimised would remove its taskbar button and its Alt+Tab entry, and was not taken.
- **Budget 4.** With the full page loaded, the process commits about 108 MB of GPU memory, held in system memory on this integrated GPU (86–94 MB shared). Hiding parts with the profile build (`ARENA_TRACKER_HIDE`) splits the private memory: about 40 MB for the home grid's portraits, about 25 MB for the champion table, and 106 MB with both hidden, mostly GPUI's renderer (swap chain, atlases). The working set keeps 177 MB while the window is hidden. Fixed after the benchmark: the champion table read its 128 px portraits through GPUI's app-wide cache, which keeps every image it loaded; it reads them through its own `CardImages` now (`b8e4927`). On the reference laptop, the scenario's end went from 164–169 MB to 146–149 MB working set (122–123 MB private). The scenario ends on « Statistiques », where the home grid's portraits are given back: « Défi » with the grid scrolled to its end still holds 170–174 MB, and 159–163 MB at start.
- **Budget 5.** Following the client (open throughout) and importing a whole history into an empty data folder, with its 175 card portraits and splashes: the work ran on the two follower threads and the art download thread, all below normal. Threads at normal priority showed at most 1.1 % in a sample; threads born and gone between two samples (up to 5 % in a sample, priority unknown) match the short DNS thread `ureq` starts per request, which `worker.rs` already notes runs at normal priority.
- **Not measured: scrolling a champ select.** It needs a live Arena champ select in the game client; the captured one replays only in GPUI's test context, which draws nothing. Scrolling the home grid, which shares its cost structure, is the nearest value: 4.0 ms per frame at the median, 6.0 ms at the 99th percentile. To measure at the next champ select (see Measuring).
### Ratchet
@@ -33,14 +42,26 @@ A measurement means something only with its machine and build: the probes print
Budgets are checked by a **full benchmark before each major release** (X.0.0; other stables and betas run no probes): every probe below, on a release build, on the reference machine, with the results recorded in the budgets table above. Single changes are not measured, unless the user asks; a release that fails a budget is fixed before it ships, and the probes below (with `--features profile`) find the cause.
- **Window moves and idle CPU**: `powershell.exe -ExecutionPolicy Bypass -File scripts/move-probe.ps1 -Title "Arena Tracker"` from WSL, with the app open. It moves the window 240 times per second without touching the mouse, after an idle phase. `MOVE block` is the time each move holds the UI thread, close to the cost of the frame it causes; `IDLE cpu` is budget 2. Compare with File Explorer with `-Class CabinetWClass`. A real title-bar drag (Windows' modal move loop) is not covered: check it by hand.
- **Window moves and idle CPU**: `powershell.exe -ExecutionPolicy Bypass -File scripts/move-probe.ps1 -Title "Arena Tracker"` from WSL, with the app open. It moves the window 240 times per second without touching the mouse, after an idle phase. `MOVE block` is the time each move holds the UI thread, close to the cost of the frame it causes; `IDLE cpu` reads higher than budget 2, as the probe's own pings wake the UI thread: budget 2 is measured by `scripts/budget-probe.ps1` (Release benchmark scenarios, below). Compare with File Explorer with `-Class CabinetWClass`. A real title-bar drag (Windows' modal move loop) is not covered: check it by hand.
- **Champion table hover**: `powershell.exe -ExecutionPolicy Bypass -File scripts/hover-probe.ps1 -Title "Arena Tracker"` from WSL, with the « Statistiques » tab showing the table under the default band (adjust `-Top` and `-Bottom` otherwise). The app opens on « Défi »: open « Statistiques » first, as the band targets its table. After an idle phase, it posts synthetic mouse moves across table rows 240 times per second without touching the real cursor. Compare `HOVER cpu` with `IDLE cpu`; `HOVER ping` shows how long input waits behind the UI thread while hovering (budget 1). The default band is `-X 0.25 -Top 0.62 -Bottom 0.95 -Step 0.04` (fractions of the client area, about one row per move in a window at least 800 px tall). Leave the real cursor still over the window, outside the table: when it is outside the window, GPUI sees each synthetic move as the mouse entering then leaving, and refreshes the whole window, bypassing cached views.
- **Where a frame goes**: build with `scripts/prod build --features profile` (never for everyday use) and start the app with `ARENA_TRACKER_PROFILE=<file.csv>` (from WSL, pass it through `WSLENV`, e.g. `WSLENV=ARENA_TRACKER_PROFILE/p:ARENA_TRACKER_HIDE`). Every second it appends the frames GPUI drew (`draw`: total, `request_layout`, `prepaint`, `paint` in ms), their presentation (`present`) and the views' own time (`view`, recorded by GPUI from 0.5 ms). `ARENA_TRACKER_HIDE=<parts>`, read at start, removes parts of the page so that a part's cost is the difference with the full page under the hover probe: `header`, `banners` (both tabs), then for « Statistiques » `statistics-title` (the page title), `tiles`, `placements`, `completed`, `attempts` (the three charts keep their height), `tabs`, `table`, and for « Défi » `banner` (the banner, on the home and during a champ select: ring, Season, counter-title, its two lines and the splash; it replaces `home-header`, and is not `banners`, the status messages), `home-tools` (the heading row: title, count, filters and search), `cards` (the card grid), and during an Arena champ select `anvil` (the Anvil champions heading and row, which take the place of `home-tools` and `cards`), then `others` (the « Autres champions » section: its header and, when open, its search and grid).
- **Memory**: working set of `arena-tracker.exe` in Task Manager, or `Get-Process arena-tracker` in PowerShell, once the page is fully loaded.
- **Memory**: working set of `arena-tracker.exe` in Task Manager, or `Get-Process arena-tracker` in PowerShell, once the page is fully loaded; for budget 4, the memory scenario below.
- **CI cannot check budgets**: its runner is Linux without a GPU, and the app only builds on Windows (ADR-0003). When a change relies on cached views to stay within budget, a structural test (for example, "hovering the table does not render the charts") guards it instead of a timed test. The charts row is a cached view (#31), and « Défi » never renders it (a structural test guards that too). The home's card grid is the second (#72) and the « Autres champions » grid, while the section is open, the third: their size comes from their style, and structural tests check that hovering outside it does not render its cards and that hovering or scrolling it recomputes no statistics. The champ select scrolls as one page: the « Autres champions » grid is as tall as all its rows and holds no scrolling of its own, it builds only the rows the page's scrolling has in view (read at its own render, after the page's scrolling is held within its content), and a structural test checks that a scroll to the end builds at most a few rows of cards. A grid wholly below the window keeps its first row built, for the keyboard to enter by (the page then scrolls to the card focused). Scrolling is no longer free of the page, though: a cached view is reused only while its bounds stay the same, and a scroll moves them, so each wheel step renders the page and draws again the ring, the Anvil hand and the « Autres champions » grid (as it already did in a window too short for the column); the scrollbar is its own view, so its fade draws no more than itself. The release benchmark must measure scrolling a champ select, and ratchet or fix the cost it finds. Each card grid reads its portraits through its own image cache, never GPUI's app-wide one, and keeps only those of the cards it paints (#77): structural tests check that scrolling drops the others, from the GPU atlas too, and that hovering outside the grid drops none; a grid that stops being shown (the home grid under « Statistiques » or during a champ select, the Anvil champions row once it ends) gives all its portraits back. The banner's ring is the fourth (#84), as wide as the window width gives: structural tests check that hovering or scrolling the grid draws it again only for the tick that lights up or goes out, that drawing it alone neither draws the grid nor builds a card, and that its fixed shapes are tessellated once per set of ticks and size, a hover tessellating only the lit tick and a scroll that moves it none. The banner decodes its splash itself, never through GPUI's app-wide cache, one at a time on GPUI's low-priority queue at below-normal thread priority: structural tests check that it holds two at most (the one shown and the one decoding; a splash asked for meanwhile waits), gives back the one replaced, from the GPU atlas too, and holds none under « Statistiques », behind « Paramètres » (with the grids' portraits), scrolled out of view in a low window, or without an illustration. A cached view is laid out from its style alone, never its content, so only a part whose size does not depend on its content can be one. A view that is not cached renders again with its parent and saves nothing, while its state must be kept in sync; a window move bypasses every cache.
GPUI and gpui-component are not modified to meet a budget: the app's own rendering cost is the lever (ADR-0004).
### Release benchmark scenarios
The release benchmark runs these scenarios, in this order, on the reference machine (#32). Builds come from `scripts/prod build`, then `scripts/prod build --features profile`; each `arena-tracker.exe` is copied out of the target directory before the next build overwrites it, and started from that copy. `scripts/budget-probe.ps1` (from WSL: `powershell.exe -ExecutionPolicy Bypass -File scripts/budget-probe.ps1 <action>`) reads the app's own counters (process CPU time, each thread's CPU time and context switches, process GPU time and memory), never system-wide ones, and drives the window with posted messages.
- **Conditions.** Each probe prints the machine and the build first: check the CPU is the Ryzen 5 7640U and the build is the copy meant. The laptop is on mains power, the user is away (`info` prints the time since their last input) and no game runs; stop and wait otherwise. The data folder (`%APPDATA%\arena-tracker`) holds a Riot key, the imported Matches and the portraits: an empty page measures nothing. Each phase lasts under a minute; split a longer scenario into phases.
- **Idle, window visible (budget 2).** Start the release build, wait 30 s, `front`, then `cursor -X 0.5 -Y 0.012` (the real cursor still over the title). Run `sample -Seconds 30` twice on « Défi » and once on « Statistiques » (`click -X 0.095 -Y 0.068`; « Défi » is at `-X 0.03`). The budget is the process CPU; the table names each thread waking. The `IDLE cpu` line of the move and hover probes is not this budget: their ping thread wakes the UI thread hundreds of times per second.
- **Interactions (budget 1).** On « Défi »: the move probe with `-Seconds 20`, then `wheel -X 0.5 -Y 0.75 -Count 300` (300 steps down at 20 per second) and the same with `-Delta 120` back up. On « Statistiques »: the hover probe and the move probe, `-Seconds 20` each. Then again on the profile build, started with `ARENA_TRACKER_PROFILE`, noting the CSV's line count at each phase's start and end to cut it into phases.
- **Minimised and hidden (budget 3).** `minimize`, wait 3 s, `sample -Seconds 30` twice; `restore`, then `close` (the window goes to the notification area, as `close_to_tray` is on), wait 3 s, `sample -Seconds 30`. Starting the app again shows the window again. On the profile build, the CSV shows no frame drawn during these phases.
- **Memory, full page loaded (budget 4).** From a fresh start, wait 15 s, `front`; scroll the home grid to its end (`wheel -X 0.5 -Y 0.75 -Count 150`), open « Statistiques » and scroll the table to its end (`wheel -X 0.5 -Y 0.85 -Count 120`), wait 10 s, then `memory`. Run it twice. To split the memory, the profile build runs the same scenario with `ARENA_TRACKER_HIDE` set to `cards`, `banner`, then `table,cards`.
- **Background work (budget 5).** Stop the app, copy `config.toml` and `seasons.toml` to an empty `<folder>\arena-tracker`, and start the release build with `APPDATA=<folder>` while the game client runs and is signed in: the app imports the whole history and downloads the portraits and splashes. Run `trace -Seconds 50` from the start, then again until the page shows the Matches imported. A sample's process CPU must stay under 100 % (one core), and the CPU must go to the `low` column. Delete the folder afterwards: it holds a copy of the Riot key.
- **Scrolling a champ select.** During a live Arena champ select, with « Autres champions » open: the profile build, then `wheel -X 0.5 -Y 0.75 -Count 100` down and the same back up, 20 steps per second, in two phases. The frames per wheel step and their cost are the figures, as for the home grid.
### Animations and splashes
The identity (ring, banner, animations; `docs/interface.md`) follows the same rule:
+1 -1
View File
@@ -52,7 +52,7 @@ Pour une cible 1.1.0, les bêtas reçoivent les versions 1.1.0-beta.1, 1.1.0-bet
## Publier une stable
1. Choisir le commit de develop à livrer, en général celui de la dernière bêta validée. Pour une **version majeure** (X.0.0), le feu vert dépend du benchmark complet de [docs/performance.md](performance.md) (#32) : toutes les sondes, sur une version de production de ce commit, sur la machine de référence. Les chiffres sont consignés dans `docs/performance.md`, et un budget dépassé bloque la livraison. Les autres stables et les bêtas ne lancent pas les sondes.
1. Choisir le commit de develop à livrer, en général celui de la dernière bêta validée. Pour une **version majeure** (X.0.0), le feu vert dépend du benchmark complet de [docs/performance.md](performance.md) (#32) : toutes les sondes, sur une version de production de ce commit, sur la machine de référence. Les chiffres sont consignés dans `docs/performance.md`, et un budget dépassé bloque la livraison. Les autres stables et les bêtas ne lancent pas les sondes. Pour la 1.0, la recette, les versions essayées et ce contrôle sont consignés dans [Livraison 1.0](livraison-1.0.md).
2. Le promouvoir vers main, en fast-forward : `git push origin <commit>:refs/heads/main`, ou `git push origin origin/develop:refs/heads/main` pour le dernier commit de develop. Ni squash ni commit de fusion.
3. Attendre la fin des contrôles CI de ce push sur main.
4. Publier :
+287
View File
@@ -0,0 +1,287 @@
# Release benchmark helper for budgets 2 to 5 (issue #32, rule #1 in docs/performance.md): the
# app's own metrics only (process CPU time, per-thread CPU time and context switches, process GPU
# engine time and memory), never system-wide ones. Window lookups happen in C#: PowerShell would
# pass $null strings as "".
#
# Usage, from WSL at the repository root, with the app open (scenarios in docs/performance.md):
# powershell.exe -ExecutionPolicy Bypass -File scripts/budget-probe.ps1 info
# ... sample -Seconds 30 -Label idle CPU, GPU and memory over one phase; each thread's CPU and wakes
# ... trace -Seconds 50 -Label import one line per sample: CPU by kind of thread and priority
# ... memory working set, private bytes and GPU memory of the process
# ... front | minimize | restore | close (close hides to the notification area)
# ... click -X 0.1 -Y 0.07 posted click at fractions of the client area
# ... wheel -X 0.5 -Y 0.75 -Delta -120 -Count 150 -Rate 20
# ... cursor -X 0.5 -Y 0.012 puts the real cursor still over the window (the title)
# ... shot -Out C:\path\shot.png capture of the window's rectangle on screen
# Every phase lasts -Seconds of wall time: keep it under a minute and split longer scenarios.
param(
[Parameter(Position = 0)][string]$Action = 'info',
[double]$Seconds = 30,
[string]$Label = '',
[double]$X = 0.5,
[double]$Y = 0.5,
[int]$Delta = -120,
[int]$Count = 1,
[double]$Rate = 20,
[string]$Out = ''
)
$ErrorActionPreference = 'Stop'
# The output is usually read from WSL, which expects UTF-8 (the file itself has a BOM for the
# same reason: Windows PowerShell 5.1 reads scripts without one as ANSI).
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Add-Type -ReferencedAssemblies System.Drawing -Language CSharp -TypeDefinition @'
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
public static class BudgetProbe {
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left, Top, Right, Bottom; }
[StructLayout(LayoutKind.Sequential)] public struct POINT { public int X, Y; }
[StructLayout(LayoutKind.Sequential)] struct LASTINPUTINFO { public uint cbSize; public uint dwTime; }
delegate bool EnumProc(IntPtr h, IntPtr l);
[DllImport("user32.dll")] static extern bool EnumWindows(EnumProc cb, IntPtr l);
[DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(IntPtr h, out uint pid);
[DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern IntPtr GetPropW(IntPtr h, string name);
[DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern int GetWindowTextW(IntPtr h, StringBuilder s, int n);
[DllImport("user32.dll")] static extern bool IsWindowVisible(IntPtr h);
[DllImport("user32.dll")] static extern bool IsIconic(IntPtr h);
[DllImport("user32.dll")] static extern bool ShowWindow(IntPtr h, int cmd);
[DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr h);
[DllImport("user32.dll")] static extern bool GetClientRect(IntPtr h, out RECT r);
[DllImport("user32.dll")] static extern bool GetWindowRect(IntPtr h, out RECT r);
[DllImport("user32.dll")] static extern bool ClientToScreen(IntPtr h, ref POINT p);
[DllImport("user32.dll")] static extern bool PostMessageW(IntPtr h, uint m, IntPtr w, IntPtr l);
[DllImport("user32.dll")] static extern bool SetCursorPos(int x, int y);
[DllImport("user32.dll")] static extern bool GetLastInputInfo(ref LASTINPUTINFO info);
[DllImport("user32.dll")] public static extern bool SetProcessDPIAware();
// Seconds since the user last touched the keyboard or mouse: measuring waits while they use
// the machine.
public static double UserIdleSeconds() {
var info = new LASTINPUTINFO(); info.cbSize = 8; GetLastInputInfo(ref info);
return (Environment.TickCount - (int)info.dwTime) / 1000.0;
}
// The app's main window, shown or hidden: the window of an arena-tracker process carrying the
// single-instance marker, else the one titled "Arena Tracker".
public static IntPtr Find() {
var pids = new HashSet<uint>();
foreach (var p in Process.GetProcessesByName("arena-tracker")) pids.Add((uint)p.Id);
IntPtr marked = IntPtr.Zero, titled = IntPtr.Zero;
EnumWindows((h, l) => {
uint pid; GetWindowThreadProcessId(h, out pid);
if (!pids.Contains(pid)) return true;
if (GetPropW(h, "nessar.arena-tracker.main-window") != IntPtr.Zero) { marked = h; return false; }
var title = new StringBuilder(256); GetWindowTextW(h, title, 256);
if (title.ToString() == "Arena Tracker" && titled == IntPtr.Zero) titled = h;
return true;
}, IntPtr.Zero);
return marked != IntPtr.Zero ? marked : titled;
}
public static IntPtr Need() {
var h = Find();
if (h == IntPtr.Zero) throw new Exception("Erreur : aucune fenêtre Arena Tracker.");
return h;
}
public static uint Pid(IntPtr h) { uint pid; GetWindowThreadProcessId(h, out pid); return pid; }
public static uint UiThread(IntPtr h) { uint pid; return GetWindowThreadProcessId(h, out pid); }
public static string State(IntPtr h) {
RECT r; GetClientRect(h, out r);
return String.Format("pid {0}, UI thread {1}, visible {2}, minimised {3}, client {4}x{5}",
Pid(h), UiThread(h), IsWindowVisible(h), IsIconic(h), r.Right, r.Bottom);
}
public static void Show(IntPtr h, int cmd) { ShowWindow(h, cmd); }
public static void Front(IntPtr h) { ShowWindow(h, 9 /* SW_RESTORE */); SetForegroundWindow(h); }
public static void Close(IntPtr h) { PostMessageW(h, 0x0010 /* WM_CLOSE */, IntPtr.Zero, IntPtr.Zero); }
static POINT ClientPoint(IntPtr h, double fx, double fy) {
RECT r; GetClientRect(h, out r);
var p = new POINT(); p.X = (int)(r.Right * fx); p.Y = (int)(r.Bottom * fy);
return p;
}
static IntPtr LParam(int x, int y) { return new IntPtr((x & 0xffff) | ((y & 0xffff) << 16)); }
public static void Click(IntPtr h, double fx, double fy) {
var p = ClientPoint(h, fx, fy);
PostMessageW(h, 0x0200 /* WM_MOUSEMOVE */, IntPtr.Zero, LParam(p.X, p.Y));
Thread.Sleep(30);
PostMessageW(h, 0x0201 /* WM_LBUTTONDOWN */, new IntPtr(1), LParam(p.X, p.Y));
Thread.Sleep(30);
PostMessageW(h, 0x0202 /* WM_LBUTTONUP */, IntPtr.Zero, LParam(p.X, p.Y));
}
public static void Cursor(IntPtr h, double fx, double fy) {
var p = ClientPoint(h, fx, fy); ClientToScreen(h, ref p); SetCursorPos(p.X, p.Y);
}
// WM_MOUSEWHEEL carries screen coordinates.
public static void Wheel(IntPtr h, double fx, double fy, int delta, int count, double rate) {
var p = ClientPoint(h, fx, fy); ClientToScreen(h, ref p);
for (int i = 0; i < count; i++) {
PostMessageW(h, 0x020A, new IntPtr((delta & 0xffff) << 16), LParam(p.X, p.Y));
Thread.Sleep((int)(1000 / rate));
}
}
public static void Shot(IntPtr h, string path) {
RECT r; GetWindowRect(h, out r);
using (var bitmap = new Bitmap(r.Right - r.Left, r.Bottom - r.Top)) {
using (var g = Graphics.FromImage(bitmap)) g.CopyFromScreen(r.Left, r.Top, 0, 0, bitmap.Size);
bitmap.Save(path, System.Drawing.Imaging.ImageFormat.Png);
}
}
}
'@
[BudgetProbe]::SetProcessDPIAware() | Out-Null
# Raw counters of the process: CPU time, each thread's CPU time (100 ns units), context switches
# and priorities, GPU engine running time and memory.
function Snapshot($procId) {
$p = Get-Process -Id $procId
$threads = @{}
foreach ($t in Get-CimInstance Win32_PerfRawData_PerfProc_Thread -Filter "IDProcess=$procId") {
$threads[[uint32]$t.IDThread] = $t
}
$gpu = 0
foreach ($e in Get-CimInstance Win32_PerfRawData_GPUPerformanceCounters_GPUEngine -Filter "Name LIKE 'pid_$($procId)_%'") {
$gpu += [double]$e.RunningTime
}
[pscustomobject]@{
At = [Diagnostics.Stopwatch]::GetTimestamp(); Cpu = $p.TotalProcessorTime.TotalMilliseconds
Threads = $threads; GpuMs = $gpu / 10000.0; Ws = $p.WorkingSet64; Private = $p.PrivateMemorySize64
Count = $p.Threads.Count
}
}
function Seconds($a, $b) { ($b.At - $a.At) / [Diagnostics.Stopwatch]::Frequency }
# A measurement only means something on a known machine and build (docs/performance.md).
function Machine($procId) {
$cpu = (Get-CimInstance Win32_Processor | Select-Object -First 1).Name.Trim()
$game = [bool](Get-Process 'League of Legends' -ErrorAction SilentlyContinue)
"Machine: $cpu; user idle for $([Math]::Round([BudgetProbe]::UserIdleSeconds())) s; game running: $game"
if ($procId) { "Build: $((Get-Process -Id $procId).Path)" }
}
function Memory($procId) {
$p = Get-Process -Id $procId
$g = Get-CimInstance Win32_PerfRawData_GPUPerformanceCounters_GPUProcessMemory -Filter "Name LIKE 'pid_$($procId)_%'"
"Memory: working set {0:F1} MB, private {1:F1} MB, peak working set {2:F1} MB; GPU shared {3:F1} MB, dedicated {4:F1} MB, committed {5:F1} MB" -f `
($p.WorkingSet64 / 1MB), ($p.PrivateMemorySize64 / 1MB), ($p.PeakWorkingSet64 / 1MB),
(($g | Measure-Object SharedUsage -Sum).Sum / 1MB), (($g | Measure-Object DedicatedUsage -Sum).Sum / 1MB),
(($g | Measure-Object TotalCommitted -Sum).Sum / 1MB)
}
function AppPid() {
$h = [BudgetProbe]::Find()
if ($h -ne [IntPtr]::Zero) { return [BudgetProbe]::Pid($h) }
$p = Get-Process arena-tracker -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $p) { throw "Erreur : Arena Tracker n'est pas lancé." }
$p.Id
}
switch ($Action) {
'info' {
$procId = AppPid
Machine $procId
$h = [BudgetProbe]::Find()
if ($h -ne [IntPtr]::Zero) { "Window: $([BudgetProbe]::State($h))" }
Memory $procId
}
'memory' { Memory (AppPid) }
'sample' {
$procId = AppPid
Machine $procId
$h = [BudgetProbe]::Need(); $ui = [BudgetProbe]::UiThread($h)
"Window: $([BudgetProbe]::State($h))"
$a = Snapshot $procId
Start-Sleep -Milliseconds ([int]($Seconds * 1000))
$b = Snapshot $procId
$s = Seconds $a $b; $cpu = $b.Cpu - $a.Cpu
"[$Label] over {0:F1} s: process CPU {1:F0} ms ({2:F2}% of one core), GPU {3:F1} ms, working set {4:F1} MB, private {5:F1} MB, {6} threads" -f `
$s, $cpu, ($cpu / ($s * 10)), ($b.GpuMs - $a.GpuMs), ($b.Ws / 1MB), ($b.Private / 1MB), $b.Count
# Wakes are context switches: a thread waking 60 times a second follows the display.
$rows = foreach ($id in $b.Threads.Keys) {
$tb = $b.Threads[$id]; $ta = $a.Threads[$id]
$cpu0 = 0; $wakes0 = 0
if ($ta) { $cpu0 = [double]$ta.PercentProcessorTime; $wakes0 = [double]$ta.ContextSwitchesPersec }
$wakes = [double]$tb.ContextSwitchesPersec - $wakes0
[pscustomobject]@{
Thread = $id; UI = ($id -eq $ui); CpuMs = [Math]::Round(([double]$tb.PercentProcessorTime - $cpu0) / 10000.0, 1)
Wakes = $wakes; PerSecond = [Math]::Round($wakes / $s, 1)
BasePriority = $tb.PriorityBase; CurrentPriority = $tb.PriorityCurrent; New = (-not $ta)
}
}
$rows | Where-Object { $_.Wakes -gt 0 -or $_.CpuMs -gt 0 } | Sort-Object CpuMs, Wakes -Descending |
Format-Table -AutoSize | Out-String -Width 200
"Threads without activity: $(@($rows | Where-Object { $_.Wakes -eq 0 -and $_.CpuMs -eq 0 }).Count)"
}
'trace' {
# One line per sample, each about 2 to 3 s apart (the counter queries take time): process
# CPU, then CPU by kind of thread. ui = the window's thread; vsync = a thread at current
# priority 15 waking more than 40 times a second (GPUI's VSyncProvider); low = base
# priority below normal; normal = the others. "unseen" is CPU of threads born and gone
# between two samples, whose priority is unknown.
$procId = AppPid
Machine $procId
$h = [BudgetProbe]::Find(); $ui = 0
if ($h -ne [IntPtr]::Zero) { $ui = [BudgetProbe]::UiThread($h) }
$prev = Snapshot $procId
$deadline = $prev.At + [long]($Seconds * [Diagnostics.Stopwatch]::Frequency)
$low = 0; $normal = 0; $maxProcess = 0; $maxThread = 0; $normalThreads = @{}
while ([Diagnostics.Stopwatch]::GetTimestamp() -lt $deadline) {
Start-Sleep -Milliseconds 1000
$cur = Snapshot $procId
$s = Seconds $prev $cur
$process = ($cur.Cpu - $prev.Cpu) / ($s * 10)
$kind = @{ ui = 0.0; vsync = 0.0; low = 0.0; normal = 0.0 }; $top = 0.0; $lowCount = 0
foreach ($id in $cur.Threads.Keys) {
$tb = $cur.Threads[$id]; $ta = $prev.Threads[$id]
$cpu0 = 0; $wakes0 = 0
if ($ta) { $cpu0 = [double]$ta.PercentProcessorTime; $wakes0 = [double]$ta.ContextSwitchesPersec }
$percent = ([double]$tb.PercentProcessorTime - $cpu0) / 100000.0 / $s
$wakes = ([double]$tb.ContextSwitchesPersec - $wakes0) / $s
if ($percent -gt $top) { $top = $percent }
if ($id -eq $ui) { $kind.ui += $percent }
elseif ($tb.PriorityCurrent -ge 15 -and $wakes -gt 40) { $kind.vsync += $percent }
elseif ([int]$tb.PriorityBase -lt 8) { $kind.low += $percent; if ($percent -gt 0) { $lowCount++ } }
else {
$kind.normal += $percent
if ($percent -gt 0) { $normalThreads[$id] = [Math]::Max([double]$normalThreads[$id], $percent) }
}
}
$unseen = [Math]::Max(0, $process - ($kind.ui + $kind.vsync + $kind.low + $kind.normal))
"process {0,5:F1}% ui {1,4:F1} vsync {2,4:F1} low {3,5:F1} ({4} threads) normal {5,4:F1} unseen {6,4:F1} top thread {7,4:F1}% working set {8:F0} MB" -f `
$process, $kind.ui, $kind.vsync, $kind.low, $lowCount, $kind.normal, $unseen, $top, ($cur.Ws / 1MB)
$low += $kind.low * $s / 100; $normal += $kind.normal * $s / 100
if ($process -gt $maxProcess) { $maxProcess = $process }
if ($top -gt $maxThread) { $maxThread = $top }
$prev = $cur
}
"[$Label] highest sample: process {0:F1}% of one core, one thread {1:F1}%; background CPU time at low priority {2:F2} s, at normal priority {3:F2} s" -f `
$maxProcess, $maxThread, $low, $normal
if ($normalThreads.Count) {
"Normal-priority threads with CPU (thread: highest %): " + (($normalThreads.GetEnumerator() | ForEach-Object { "$($_.Key): {0:F1}" -f $_.Value }) -join ', ')
}
}
'front' { [BudgetProbe]::Front([BudgetProbe]::Need()); [BudgetProbe]::State([BudgetProbe]::Need()) }
'minimize' { [BudgetProbe]::Show([BudgetProbe]::Need(), 6 <# SW_MINIMIZE #>); [BudgetProbe]::State([BudgetProbe]::Need()) }
'restore' { [BudgetProbe]::Show([BudgetProbe]::Need(), 9 <# SW_RESTORE #>); [BudgetProbe]::State([BudgetProbe]::Need()) }
'close' { [BudgetProbe]::Close([BudgetProbe]::Need()); Start-Sleep 1; [BudgetProbe]::State([BudgetProbe]::Need()) }
'click' { [BudgetProbe]::Click([BudgetProbe]::Need(), $X, $Y) }
'cursor' { [BudgetProbe]::Cursor([BudgetProbe]::Need(), $X, $Y) }
'wheel' { [BudgetProbe]::Wheel([BudgetProbe]::Need(), $X, $Y, $Delta, $Count, $Rate) }
'shot' { [BudgetProbe]::Shot([BudgetProbe]::Need(), $Out); "Saved $Out" }
default { throw "Erreur : action inconnue '$Action'." }
}