Package limn.scene
Class FrameMetrics
java.lang.Object
limn.scene.FrameMetrics
Rolling per-frame performance samples the
Scene collects each frame:
frames-per-second, CPU frame time (tick + layout + paint, in ms),
input-processing time (ms), and how much of the scene each frame actually
repainted. Each FrameMetrics.Metric keeps a short history for a sparkline plus the
latest value and the windowed average/max.
Purely a data holder: no timing logic and no rendering. All access is on the UI thread (recorded during the frame, read while painting a monitor).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fixed-capacity ring of recent samples (oldest evicted first) exposing the latest value, the windowed average/max, and a copy of the history for a sparkline. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSamples kept per metric: the sparkline width. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRepaint regions per frame:0for a frame that painted nothing, and the widget count's companion.Time to dispatch one batch of input events, in milliseconds.fps()Frames per second, derived from the wall-clock period between frames.CPU time to produce one frame (tick + layout + paint), in milliseconds.gpuTime()GPU time to execute one frame's draw commands, in milliseconds.Widgets whoseonPaintran during one frame: the work a frame did, as opposed to how long it took.static List<FrameMetrics> longMonotonic count of frames rendered since the scene was created.
-
Field Details
-
HISTORY
public static final int HISTORYSamples kept per metric: the sparkline width.- See Also:
-
-
Constructor Details
-
FrameMetrics
public FrameMetrics()An empty set of counters, reset each frame.
-
-
Method Details
-
totalFrames
public long totalFrames()Monotonic count of frames rendered since the scene was created. A monitor can sample this once per second and divide the delta by the elapsed time for a true average FPS, without forcing continuous rendering. -
fps
Frames per second, derived from the wall-clock period between frames. -
frameTime
CPU time to produce one frame (tick + layout + paint), in milliseconds. -
eventTime
Time to dispatch one batch of input events, in milliseconds. -
gpuTime
GPU time to execute one frame's draw commands, in milliseconds. Measured by the backend with timer queries, so each sample lags the frame it measured by a few frames. Empty when the backend cannot measure (headless tests, drivers without timer queries). -
paintedWidgets
Widgets whoseonPaintran during one frame: the work a frame did, as opposed to how long it took. A widget hidden, or skipped because its subtree missed every repaint region, is not counted; one that falls inside two repaint regions is counted twice, because it painted twice.This is the figure that makes partial rendering visible: the same idle window that repaints its whole tree without it paints a handful of widgets with it, at identical frame times.
-
damageRects
Repaint regions per frame:0for a frame that painted nothing, and the widget count's companion. One rect per damaged region under partial rendering, or1for a full-frame repaint, which is what a scene without partial rendering records every frame. -
processInstances
- Returns:
- every live scene's metrics in this process (dead entries pruned)
-