From f4243dd92faae7f4200839a053488cdb28ad557d Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 8 Dec 2024 14:22:07 +0100 Subject: chore(engine): remove performance monitoring extension --- engine/src/lib.rs | 1 - engine/src/performance.rs | 45 --------------------------------------------- 2 files changed, 46 deletions(-) delete mode 100644 engine/src/performance.rs (limited to 'engine') diff --git a/engine/src/lib.rs b/engine/src/lib.rs index 07b2f8d..a2f8c34 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -34,7 +34,6 @@ pub mod lighting; pub mod material; pub mod math; pub mod mesh; -pub mod performance; pub mod projection; pub mod renderer; pub mod texture; diff --git a/engine/src/performance.rs b/engine/src/performance.rs deleted file mode 100644 index 3ec8994..0000000 --- a/engine/src/performance.rs +++ /dev/null @@ -1,45 +0,0 @@ -use std::time::Instant; - -use ecs::component::local::Local; -use ecs::system::{Into, System}; -use ecs::Component; - -use crate::event::PostPresent as PostPresentEvent; - -#[derive(Debug, Default)] -#[non_exhaustive] -pub struct Extension {} - -impl ecs::extension::Extension for Extension -{ - fn collect(self, mut collector: ecs::extension::Collector<'_>) - { - collector.add_system( - PostPresentEvent, - log_perf.into_system().initialize((State::default(),)), - ); - } -} - -fn log_perf(mut state: Local) -{ - let Some(last_time) = state.last_time else { - state.last_time = Some(Instant::now()); - return; - }; - - let time_now = Instant::now(); - - state.last_time = Some(time_now); - - tracing::info!( - "Frame time: {}us", - time_now.duration_since(last_time).as_micros() - ); -} - -#[derive(Debug, Default, Component)] -struct State -{ - last_time: Option, -} -- cgit v1.2.3-18-g5258