-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartProfilingCommand.cs
More file actions
38 lines (31 loc) · 1.17 KB
/
StartProfilingCommand.cs
File metadata and controls
38 lines (31 loc) · 1.17 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
using System;
using System.Collections.Generic;
using System.IO;
using Rocket.API;
using UnityEngine.Profiling;
using Logger = Rocket.Core.Logging.Logger;
namespace UntProfiler
{
public class StartProfilingCommand : IRocketCommand
{
public string Name => "startprofiling";
public AllowedCaller AllowedCaller => AllowedCaller.Console;
public string Help => "Starts the profiling session.";
public string Syntax => "/startprofiling";
public List<string> Aliases => new List<string> { "startprofile", "startpf" };
public List<string> Permissions => new List<string> { };
public void Execute(IRocketPlayer caller, string[] command)
{
if (Profiler.enabled)
{
Logger.Log("Profiling session is already running.");
return;
}
Logger.Log("Starting profiling session...");
Profiler.logFile = Path.Combine(UntPlugin.Instance.Directory, $"profile-{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.raw");
Profiler.enableAllocationCallstacks = true;
Profiler.enableBinaryLog = true;
Profiler.enabled = true;
}
}
}