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:
Westin Miller
2017-10-30 02:50:03 -07:00
parent 11dbf83faf
commit 90c91c3ebc
39 changed files with 1923 additions and 468 deletions

View File

@@ -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()

View File

@@ -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

View 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;
}
}
}