diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-10-20 00:20:25 +0200 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-10-20 00:20:25 +0200 |
| commit | 8961db68d063a2dda427e80601650e4674772685 (patch) | |
| tree | 5bff20f6f6965c2c93e41005850d10ef269d346f /server/src/state.rs | |
| parent | ab83f982601d93b2399102c4d030fd6e13c4c735 (diff) | |
| download | hurrycurry-8961db68d063a2dda427e80601650e4674772685.tar hurrycurry-8961db68d063a2dda427e80601650e4674772685.tar.bz2 hurrycurry-8961db68d063a2dda427e80601650e4674772685.tar.zst | |
tick perf logging
Diffstat (limited to 'server/src/state.rs')
| -rw-r--r-- | server/src/state.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/src/state.rs b/server/src/state.rs index 28ef7235..1e01036c 100644 --- a/server/src/state.rs +++ b/server/src/state.rs @@ -23,11 +23,19 @@ use anyhow::Result; use hurrycurry_locale::{TrError, tre, trm}; use hurrycurry_protocol::{Menu, Message, PacketC, PacketS, PlayerID, VERSION}; use log::{debug, info, trace}; +use std::time::{Duration, Instant}; impl Server { pub fn tick_outer(&mut self, dt: f32) -> anyhow::Result<()> { if !self.paused { + let start = Instant::now(); let r = self.tick(dt); + self.tick_perf.0 += start.elapsed(); + self.tick_perf.1 += 1; + if self.tick_perf.1 >= 500 { + debug!("tick perf {:?}", self.tick_perf.0 / 500); + self.tick_perf = (Duration::ZERO, 0); + } if let Some((name, timer)) = r { self.scoreboard.save()?; self.load(self.index.generate_with_book(&name)?, timer); |