Skip to main content

Module stats

Module stats 

Source
Expand description

Stats — the meter: how many frames this window is drawing, and what the process, the GPU and memory cost, while you watch it.

A window at rest reads 0. The count comes from this view’s own renders, which is the same number: gpui re-renders every uncached view once per window draw. The one render it does not count is the one its own tick provoked, and Painter::woken is what says which that was — the clock knows, so nothing here has to infer it from a stopwatch. Those two draws a second are the meter’s own cost, and the CPU figure includes them.

Placement is the caller’s, as it is for crate::control_bar:

let meter = cx.new(Stats::new);
div().relative().size_full()
    .child(page)
    .child(div().absolute().top(px(16.0)).right(px(16.0)).child(meter.clone()))

crate::floating::panel is what makes one draggable.

Structs§

Stats
The frame and CPU meter. One per window — two mounted meters each count the other’s frames, and neither reads zero again.

Constants§

WIDTH
The box’s width. Public because a host placing the meter by its trailing edge has to know how wide it is.