mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add spans to server systems
This commit is contained in:
parent
4f68a6df27
commit
63d60c212c
@ -354,7 +354,6 @@ impl<'a> System<'a> for Sys {
|
||||
radius: f32,
|
||||
z_range: Range<f32>,
|
||||
) -> impl Iterator<Item = Aabb<f32>> + 'a {
|
||||
span!(_guard, "collision_iter");
|
||||
near_iter.filter_map(move |(i, j, k)| {
|
||||
let block_pos = pos.map(|e| e.floor() as i32) + Vec3::new(i, j, k);
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
use crate::{state_ext::StateExt, Server};
|
||||
use common::event::{EventBus, ServerEvent};
|
||||
use common::{
|
||||
event::{EventBus, ServerEvent},
|
||||
span,
|
||||
};
|
||||
use entity_creation::{
|
||||
handle_create_npc, handle_create_waypoint, handle_initialize_character,
|
||||
handle_loaded_character_data, handle_shoot,
|
||||
@ -36,6 +39,7 @@ pub enum Event {
|
||||
|
||||
impl Server {
|
||||
pub fn handle_events(&mut self) -> Vec<Event> {
|
||||
span!(_guard, "Server::handle_events");
|
||||
let mut frontend_events = Vec::new();
|
||||
|
||||
let mut requested_chunks = Vec::new();
|
||||
|
@ -6,6 +6,7 @@ use common::{
|
||||
comp,
|
||||
comp::{group, Player},
|
||||
msg::{ClientState, PlayerListUpdate, ServerMsg},
|
||||
span,
|
||||
sync::{Uid, UidAllocator},
|
||||
};
|
||||
use futures_executor::block_on;
|
||||
@ -13,6 +14,7 @@ use specs::{saveload::MarkerAllocator, Builder, Entity as EcsEntity, WorldExt};
|
||||
use tracing::{debug, error, trace, warn};
|
||||
|
||||
pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity) {
|
||||
span!(_guard, "handle_exit_ingame");
|
||||
let state = server.state_mut();
|
||||
|
||||
// Create new entity with just `Client`, `Uid`, and `Player` components
|
||||
@ -78,6 +80,7 @@ pub fn handle_exit_ingame(server: &mut Server, entity: EcsEntity) {
|
||||
}
|
||||
|
||||
pub fn handle_client_disconnect(server: &mut Server, entity: EcsEntity) -> Event {
|
||||
span!(_guard, "handle_client_disconnect");
|
||||
if let Some(client) = server.state().read_storage::<Client>().get(entity) {
|
||||
let participant = match client.participant.try_lock() {
|
||||
Ok(mut p) => p.take().unwrap(),
|
||||
|
@ -11,6 +11,7 @@ use common::{
|
||||
msg::ServerMsg,
|
||||
outcome::Outcome,
|
||||
region::{Event as RegionEvent, RegionMap},
|
||||
span,
|
||||
state::TimeOfDay,
|
||||
sync::{CompSyncPackage, Uid},
|
||||
terrain::TerrainChunkSize,
|
||||
@ -77,6 +78,7 @@ impl<'a> System<'a> for Sys {
|
||||
trackers,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "entity_sync::Sys::run");
|
||||
timer.start();
|
||||
|
||||
let tick = tick.0;
|
||||
|
@ -3,6 +3,7 @@ use crate::client::Client;
|
||||
use common::{
|
||||
comp::group::{Invite, PendingInvites},
|
||||
msg::{InviteAnswer, ServerMsg},
|
||||
span,
|
||||
sync::Uid,
|
||||
};
|
||||
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
|
||||
@ -24,6 +25,7 @@ impl<'a> System<'a> for Sys {
|
||||
&mut self,
|
||||
(entities, mut invites, mut pending_invites, mut clients, uids, mut timer): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "invite_timeout::Sys::run");
|
||||
timer.start();
|
||||
|
||||
let now = std::time::Instant::now();
|
||||
|
@ -4,6 +4,7 @@ use crate::{
|
||||
persistence::character::CharacterLoader, ServerSettings,
|
||||
};
|
||||
use common::{
|
||||
span,
|
||||
comp::{
|
||||
Admin, AdminList, CanBuild, ChatMode, ChatType, ControlEvent, Controller, ForceUpdate, Ori,
|
||||
Player, Pos, Stats, UnresolvedChatMsg, Vel,
|
||||
@ -454,6 +455,7 @@ impl<'a> System<'a> for Sys {
|
||||
alias_validator,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "message::Sys::run");
|
||||
timer.start();
|
||||
|
||||
let mut server_emitter = server_event_bus.emitter();
|
||||
|
@ -1,6 +1,7 @@
|
||||
use common::{
|
||||
comp::{HealthSource, Object, PhysicsState, Pos, Vel},
|
||||
event::{EventBus, ServerEvent},
|
||||
span,
|
||||
state::DeltaTime,
|
||||
};
|
||||
use specs::{Entities, Join, Read, ReadStorage, System, WriteStorage};
|
||||
@ -23,6 +24,7 @@ impl<'a> System<'a> for Sys {
|
||||
&mut self,
|
||||
(entities, _dt, server_bus, positions, velocities, physics_states, mut objects): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "object::Sys::run");
|
||||
let mut server_emitter = server_bus.emitter();
|
||||
|
||||
// Objects
|
||||
|
@ -2,7 +2,10 @@ use crate::{
|
||||
persistence::character,
|
||||
sys::{SysScheduler, SysTimer},
|
||||
};
|
||||
use common::comp::{Inventory, Loadout, Player, Stats};
|
||||
use common::{
|
||||
comp::{Inventory, Loadout, Player, Stats},
|
||||
span,
|
||||
};
|
||||
use specs::{Join, ReadExpect, ReadStorage, System, Write};
|
||||
|
||||
pub struct Sys;
|
||||
@ -31,6 +34,7 @@ impl<'a> System<'a> for Sys {
|
||||
mut timer,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "persistence::Sys::run");
|
||||
if scheduler.should_run() {
|
||||
timer.start();
|
||||
updater.batch_update(
|
||||
|
@ -5,6 +5,7 @@ use common::{
|
||||
Loadout, Mass, MountState, Mounting, Ori, Player, Pos, Scale, Stats, Sticky, Vel,
|
||||
},
|
||||
msg::EcsCompPacket,
|
||||
span,
|
||||
sync::{CompSyncPackage, EntityPackage, EntitySyncPackage, Uid, UpdateTracker, WorldSyncExt},
|
||||
};
|
||||
use hashbrown::HashMap;
|
||||
@ -26,6 +27,7 @@ impl<'a> System<'a> for Sys {
|
||||
);
|
||||
|
||||
fn run(&mut self, (mut timer, comps, mut trackers): Self::SystemData) {
|
||||
span!(_guard, "sentinel::Sys::run");
|
||||
timer.start();
|
||||
|
||||
record_changes(&comps, &mut trackers);
|
||||
|
@ -7,6 +7,7 @@ use common::{
|
||||
comp::{Ori, Player, Pos, Vel},
|
||||
msg::ServerMsg,
|
||||
region::{region_in_vd, regions_in_vd, Event as RegionEvent, RegionMap},
|
||||
span,
|
||||
sync::Uid,
|
||||
terrain::TerrainChunkSize,
|
||||
vol::RectVolSize,
|
||||
@ -55,6 +56,7 @@ impl<'a> System<'a> for Sys {
|
||||
tracked_comps,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "subscription::Sys::run");
|
||||
timer.start();
|
||||
|
||||
// To update subscriptions
|
||||
|
@ -11,6 +11,7 @@ use common::{
|
||||
generation::get_npc_name,
|
||||
msg::ServerMsg,
|
||||
npc::NPC_NAMES,
|
||||
span,
|
||||
state::TerrainChanges,
|
||||
terrain::TerrainGrid,
|
||||
LoadoutBuilder,
|
||||
@ -55,6 +56,7 @@ impl<'a> System<'a> for Sys {
|
||||
mut clients,
|
||||
): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "terrain::Sys::run");
|
||||
timer.start();
|
||||
|
||||
let mut server_emitter = server_event_bus.emitter();
|
||||
|
@ -3,6 +3,7 @@ use crate::client::Client;
|
||||
use common::{
|
||||
comp::{Player, Pos},
|
||||
msg::ServerMsg,
|
||||
span,
|
||||
state::TerrainChanges,
|
||||
terrain::TerrainGrid,
|
||||
};
|
||||
@ -26,6 +27,7 @@ impl<'a> System<'a> for Sys {
|
||||
&mut self,
|
||||
(terrain, terrain_changes, mut timer, positions, players, mut clients): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "terrain_sync::Sys::run");
|
||||
timer.start();
|
||||
|
||||
// Sync changed chunks
|
||||
|
@ -3,6 +3,7 @@ use crate::client::Client;
|
||||
use common::{
|
||||
comp::{Player, Pos, Waypoint, WaypointArea},
|
||||
msg::{Notification, ServerMsg},
|
||||
span,
|
||||
state::Time,
|
||||
};
|
||||
use specs::{Entities, Join, Read, ReadStorage, System, Write, WriteStorage};
|
||||
@ -30,6 +31,7 @@ impl<'a> System<'a> for Sys {
|
||||
&mut self,
|
||||
(entities, positions, players, waypoint_areas, mut waypoints, mut clients, time, mut timer): Self::SystemData,
|
||||
) {
|
||||
span!(_guard, "waypoint::Sys::run");
|
||||
timer.start();
|
||||
|
||||
for (entity, player_pos, _, client) in
|
||||
|
Loading…
Reference in New Issue
Block a user