summaryrefslogtreecommitdiff
path: root/engine/src/performance.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/performance.rs')
-rw-r--r--engine/src/performance.rs45
1 files changed, 0 insertions, 45 deletions
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<State>)
-{
- 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<Instant>,
-}