Initial version of profiler
Moved reflected manager into separate files Extracted MtObservableEvent Added a patch to Keencode that lets us call the static cctor of MyEntities in the wrong spot
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
using VRage.Game.ModAPI;
|
||||
using System.Windows.Controls;
|
||||
using Torch.API.Managers;
|
||||
using Torch.Collections;
|
||||
using Torch.Managers.Profiler;
|
||||
using VRage.Game.ModAPI;
|
||||
using VRage.ModAPI;
|
||||
using VRageMath;
|
||||
|
||||
@@ -9,6 +13,12 @@ namespace Torch.Server.ViewModels.Entities
|
||||
protected EntityTreeViewModel Tree { get; }
|
||||
public IMyEntity Entity { get; }
|
||||
public long Id => Entity.EntityId;
|
||||
public ProfilerEntryViewModel Profiler
|
||||
{
|
||||
get => ProfilerTreeAlias[0];
|
||||
set => ProfilerTreeAlias[0] = value;
|
||||
}
|
||||
public MtObservableList<ProfilerEntryViewModel> ProfilerTreeAlias { get; } = new MtObservableList<ProfilerEntryViewModel>(1){null};
|
||||
|
||||
public virtual string Name
|
||||
{
|
||||
@@ -46,6 +56,7 @@ namespace Torch.Server.ViewModels.Entities
|
||||
{
|
||||
Entity = entity;
|
||||
Tree = tree;
|
||||
Profiler = TorchBase.Instance.Managers.GetManager<ProfilerManager>()?.EntityData(entity, Profiler);
|
||||
}
|
||||
|
||||
public EntityViewModel()
|
||||
|
@@ -2,7 +2,9 @@
|
||||
using System.Linq;
|
||||
using Sandbox.Game.Entities;
|
||||
using Sandbox.ModAPI;
|
||||
using Torch.API.Managers;
|
||||
using Torch.Collections;
|
||||
using Torch.Managers.Profiler;
|
||||
using Torch.Server.ViewModels.Blocks;
|
||||
|
||||
namespace Torch.Server.ViewModels.Entities
|
||||
|
85
Torch.Server/ViewModels/ProfilerViewModel.cs
Normal file
85
Torch.Server/ViewModels/ProfilerViewModel.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Torch.API.Managers;
|
||||
using Torch.Collections;
|
||||
using Torch.Managers.Profiler;
|
||||
|
||||
namespace Torch.Server.ViewModels
|
||||
{
|
||||
public class ProfilerViewModel : ViewModel
|
||||
{
|
||||
public MtObservableList<ProfilerEntryViewModel> ProfilerTreeAlias { get; } = new MtObservableList<ProfilerEntryViewModel>();
|
||||
|
||||
private readonly ProfilerManager _manager;
|
||||
|
||||
public ProfilerViewModel()
|
||||
{
|
||||
_manager = null;
|
||||
}
|
||||
|
||||
public ProfilerViewModel(ProfilerManager profilerManager)
|
||||
{
|
||||
_manager = profilerManager;
|
||||
ProfilerTreeAlias.Add(_manager.SessionData());
|
||||
ProfilerTreeAlias.Add(_manager.EntitiesData());
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ProfilerManager.ProfileGridsUpdate"/>
|
||||
public bool ProfileGridsUpdate
|
||||
{
|
||||
get => _manager?.ProfileGridsUpdate ?? false;
|
||||
set
|
||||
{
|
||||
if (_manager != null)
|
||||
_manager.ProfileGridsUpdate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ProfilerManager.ProfileBlocksUpdate"/>
|
||||
public bool ProfileBlocksUpdate
|
||||
{
|
||||
get => _manager?.ProfileBlocksUpdate ?? false;
|
||||
set
|
||||
{
|
||||
if (_manager != null)
|
||||
_manager.ProfileBlocksUpdate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ProfilerManager.ProfileEntityComponentsUpdate"/>
|
||||
public bool ProfileEntityComponentsUpdate
|
||||
{
|
||||
get => _manager?.ProfileEntityComponentsUpdate ?? false;
|
||||
set
|
||||
{
|
||||
if (_manager != null)
|
||||
_manager.ProfileEntityComponentsUpdate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ProfilerManager.ProfileGridSystemUpdates"/>
|
||||
public bool ProfileGridSystemUpdates
|
||||
{
|
||||
get => _manager?.ProfileGridSystemUpdates ?? false;
|
||||
set
|
||||
{
|
||||
if (_manager != null)
|
||||
_manager.ProfileGridSystemUpdates = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ProfilerManager.ProfileSessionComponentsUpdate"/>
|
||||
public bool ProfileSessionComponentsUpdate
|
||||
{
|
||||
get => _manager?.ProfileSessionComponentsUpdate ?? false;
|
||||
set => _manager.ProfileSessionComponentsUpdate = value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user