-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathProfilingPlugin.cs
More file actions
78 lines (69 loc) · 3.15 KB
/
Copy pathProfilingPlugin.cs
File metadata and controls
78 lines (69 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using Arch.SystemGroups;
using Cysharp.Threading.Tasks;
using DCL.DebugUtilities;
using DCL.LoadingTimes;
using DCL.Optimization.AdaptivePerformance.Systems;
using DCL.Optimization.PerformanceBudgeting;
using DCL.PerformanceAndDiagnostics.Analytics;
using DCL.PerformanceAndDiagnostics.AutoPilot;
using DCL.Profiling;
using DCL.Profiling.ECS;
using DCL.RealmNavigation;
using ECS;
using ECS.SceneLifeCycle;
using ECS.SceneLifeCycle.IncreasingRadius;
using Global.AppArgs;
using Global.Versioning;
namespace DCL.PluginSystem.Global
{
public class ProfilingPlugin : IDCLGlobalPluginWithoutSettings
{
private readonly IProfiler profiler;
private readonly IRealmData realmData;
private readonly MemoryBudget memoryBudget;
private readonly IDebugContainerBuilder debugContainerBuilder;
private readonly IScenesCache scenesCache;
private readonly DCLVersion dclVersion;
private readonly AdaptivePhysicsSettings adaptivePhysicsSettings;
private readonly SceneLoadingLimit sceneLoadingLimit;
private readonly IAppArgs appArgs;
private readonly ILoadingStatus loadingStatus;
private readonly LoadingTimeBenchmark? loadingTimeBenchmark;
public ProfilingPlugin(IProfiler profiler, IRealmData realmData, MemoryBudget memoryBudget,
IDebugContainerBuilder debugContainerBuilder, IScenesCache scenesCache, DCLVersion dclVersion,
AdaptivePhysicsSettings adaptivePhysicsSettings, SceneLoadingLimit sceneLoadingLimit,
IAppArgs appArgs, ILoadingStatus loadingStatus, IAnalyticsController analytics)
{
this.profiler = profiler;
this.realmData = realmData;
this.debugContainerBuilder = debugContainerBuilder;
this.scenesCache = scenesCache;
this.dclVersion = dclVersion;
this.adaptivePhysicsSettings = adaptivePhysicsSettings;
this.sceneLoadingLimit = sceneLoadingLimit;
this.memoryBudget = memoryBudget;
this.appArgs = appArgs;
this.loadingStatus = loadingStatus;
if (appArgs.HasFlag(AppArgsFlags.MEASURE_LOADING_TIME))
loadingTimeBenchmark = new LoadingTimeBenchmark(loadingStatus, analytics, scenesCache);
}
public void Dispose()
{
profiler.Dispose();
loadingTimeBenchmark?.Dispose();
}
public void InjectToWorld(ref ArchSystemsWorldBuilder<Arch.Core.World> builder, in GlobalPluginArguments arguments)
{
UpdateProfilerSystem.InjectToWorld(ref builder, profiler, scenesCache);
DebugViewProfilingSystem.InjectToWorld(ref builder, realmData, profiler, memoryBudget,
debugContainerBuilder, dclVersion, adaptivePhysicsSettings, sceneLoadingLimit);
DebugViewCurrentSceneSystem.InjectToWorld(ref builder, debugContainerBuilder, scenesCache, realmData);
PerfSampler.Configure(profiler);
if (appArgs.HasFlag(AppArgsFlags.AUTOPILOT))
{
var autoPilot = new AutoPilot(appArgs, loadingStatus);
autoPilot.RunAsync().Forget();
}
}
}
}