Merge pull request #87 from jeremygold02/codex/copy-stat-frame-window
fix(gpu): average copy statistics over the full reporting interval
This commit is contained in:
1 file changed
+9
-1
@@ -1466,6 +1466,8 @@ struct Presenter {
|
|||||||
struct Meter {
|
struct Meter {
|
||||||
since: std::time::Instant,
|
since: std::time::Instant,
|
||||||
frames: u32,
|
frames: u32,
|
||||||
|
#[cfg(feature = "diagnostics")]
|
||||||
|
copy_stats_frames: u64,
|
||||||
drawn: u64,
|
drawn: u64,
|
||||||
logged: std::time::Instant,
|
logged: std::time::Instant,
|
||||||
/// The caption the window had, once read.
|
/// The caption the window had, once read.
|
||||||
@@ -1478,6 +1480,8 @@ impl Meter {
|
|||||||
Meter {
|
Meter {
|
||||||
since: now,
|
since: now,
|
||||||
frames: 0,
|
frames: 0,
|
||||||
|
#[cfg(feature = "diagnostics")]
|
||||||
|
copy_stats_frames: 0,
|
||||||
drawn: crate::draw::drawn(),
|
drawn: crate::draw::drawn(),
|
||||||
logged: now,
|
logged: now,
|
||||||
caption: None,
|
caption: None,
|
||||||
@@ -1489,6 +1493,10 @@ impl Meter {
|
|||||||
#[cfg(feature = "diagnostics")]
|
#[cfg(feature = "diagnostics")]
|
||||||
tracing::debug!(target: "victory_gpu::frame", token = crate::frame::current(), "present");
|
tracing::debug!(target: "victory_gpu::frame", token = crate::frame::current(), "present");
|
||||||
self.frames += 1;
|
self.frames += 1;
|
||||||
|
#[cfg(feature = "diagnostics")]
|
||||||
|
{
|
||||||
|
self.copy_stats_frames += 1;
|
||||||
|
}
|
||||||
let elapsed = self.since.elapsed();
|
let elapsed = self.since.elapsed();
|
||||||
if elapsed < std::time::Duration::from_secs(1) {
|
if elapsed < std::time::Duration::from_secs(1) {
|
||||||
return;
|
return;
|
||||||
@@ -1527,7 +1535,7 @@ impl Meter {
|
|||||||
);
|
);
|
||||||
#[cfg(feature = "diagnostics")]
|
#[cfg(feature = "diagnostics")]
|
||||||
{
|
{
|
||||||
crate::copystat::log(frames);
|
crate::copystat::log(std::mem::take(&mut self.copy_stats_frames) as f64);
|
||||||
for (why, n) in drops.iter().take(40) {
|
for (why, n) in drops.iter().take(40) {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
"dropped {:.1}/frame without a host pipeline: {why}",
|
"dropped {:.1}/frame without a host pipeline: {why}",
|
||||||
|
|||||||
Reference in new issue
Block a user