nadir/tick_stats.rs
1// Copyright 2026 Joseph Anthony Abbott III
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! [`TickStats`]: how long each frame's ticks took.
16
17use std::time::Duration;
18
19/// How many ticks the frame ran, and how long they took: a resource.
20///
21/// The loop writes it after the frame's ticks and before its frame stages,
22/// so frame systems read their own frame's. A tick counts from its latch to
23/// the end of its stages, with its commands applied. A frame with no tick
24/// holds zeros.
25#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
26pub struct TickStats {
27 /// How many ticks ran.
28 pub ticks: u32,
29 /// How long they took, together.
30 pub time: Duration,
31 /// How long the longest of them took.
32 pub longest: Duration,
33}