mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add tracy plots
This commit is contained in:
parent
8a68daf8d3
commit
9e2b618438
@ -107,14 +107,15 @@ impl RemoteController {
|
||||
if let Some(latency) =
|
||||
(server_send_time + self.avg_latency).checked_sub(highest_source_time)
|
||||
{
|
||||
tracing::error!(?latency, "ggg");
|
||||
common_base::plot!("latency", latency.as_secs_f64());
|
||||
self.avg_latency = (99 * self.avg_latency + latency) / 100;
|
||||
} else {
|
||||
// add 5% and 10ms to the latency
|
||||
// add 10% and 20ms to the latency
|
||||
self.avg_latency =
|
||||
Duration::from_secs_f64(self.avg_latency.as_secs_f64() * 1.05 + 0.01);
|
||||
Duration::from_secs_f64(self.avg_latency.as_secs_f64() * 1.1 + 0.02);
|
||||
}
|
||||
tracing::error!(?highest_source_time, ?self.avg_latency, "aaa");
|
||||
common_base::plot!("avg_latency", self.avg_latency.as_secs_f64());
|
||||
common_base::plot!("highest_source_time", highest_source_time.as_secs_f64());
|
||||
}
|
||||
|
||||
pub fn commands(&self) -> &ControlCommands { &self.commands }
|
||||
@ -250,6 +251,8 @@ impl CommandGenerator {
|
||||
|
||||
impl ControlCommand {
|
||||
pub fn msg(&self) -> &Controller { &self.msg }
|
||||
|
||||
pub fn source_time(&self) -> Duration { self.source_time }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -1438,6 +1438,8 @@ fn box_voxel_collision<T: BaseVol<Vox = Block> + ReadVol>(
|
||||
|
||||
let mut pos_delta = tgt_pos - pos.0;
|
||||
|
||||
common_base::plot!("z", pos.0.z as f64);
|
||||
|
||||
// Don't jump too far at once
|
||||
const MAX_INCREMENTS: usize = 100; // The maximum number of collision tests per tick
|
||||
let increments = ((pos_delta.map(|e| e.abs()).reduce_partial_max() / 0.3).ceil() as usize)
|
||||
|
@ -28,9 +28,20 @@ impl<'a> System<'a> for Sys {
|
||||
|
||||
fn run(_job: &mut Job<Self>, (read_data, mut controllers): Self::SystemData) {
|
||||
for (entity, _a) in (&read_data.entities, &read_data.remote_controllers).join() {
|
||||
let i = _a.commands().len();
|
||||
let time = Duration::from_secs_f64(read_data.time.0);
|
||||
tracing::warn!(?i, ?time, "foo");
|
||||
let command_len = _a.commands().len();
|
||||
common_base::plot!("predict_available", command_len as f64);
|
||||
common_base::plot!("predict_time", read_data.time.0);
|
||||
let first = _a
|
||||
.commands()
|
||||
.front()
|
||||
.map_or(read_data.time.0 - 1.0, |c| c.source_time().as_secs_f64());
|
||||
let last = _a
|
||||
.commands()
|
||||
.back()
|
||||
.map_or(read_data.time.0 - 1.0, |c| c.source_time().as_secs_f64());
|
||||
common_base::plot!("predict_first", first - read_data.time.0);
|
||||
common_base::plot!("predict_last", last - read_data.time.0);
|
||||
|
||||
let _ = controllers
|
||||
.entry(entity)
|
||||
.map(|e| e.or_insert_with(Default::default));
|
||||
|
@ -677,6 +677,8 @@ impl PlayState for SessionState {
|
||||
// Throw out distance info, it will be useful in the future
|
||||
self.target_entity = entity_target.map(|t| t.kind.0);
|
||||
|
||||
common_base::plot!("voxygen_jumps", 0.0);
|
||||
|
||||
// Handle window events.
|
||||
for event in events {
|
||||
// Pass all events to the ui first.
|
||||
@ -778,6 +780,7 @@ impl PlayState for SessionState {
|
||||
}
|
||||
},
|
||||
GameInput::Jump => {
|
||||
common_base::plot!("voxygen_jumps", 1.0);
|
||||
self.client.borrow_mut().handle_input(
|
||||
InputKind::Jump,
|
||||
state,
|
||||
|
Loading…
Reference in New Issue
Block a user