-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSSharpMemory.cs
More file actions
32 lines (29 loc) · 1.72 KB
/
CSSharpMemory.cs
File metadata and controls
32 lines (29 loc) · 1.72 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
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Utils;
using System.Diagnostics;
namespace CSSharpMemory;
public class CSSharpMemory : BasePlugin
{
public override string ModuleName => "CS# Memory overview";
public override string ModuleVersion => "1.0.0";
public override string ModuleAuthor => "HKS 27D";
public override string ModuleDescription => "";
[ConsoleCommand("css_memory", "Memory overview")]
[CommandHelper(whoCanExecute: CommandUsage.SERVER_ONLY)]
public void OnMemoryCommand(CCSPlayerController? _, CommandInfo commandInfo)
{
commandInfo.ReplyToCommand("-----------------------");
commandInfo.ReplyToCommand("Modders - Memory status");
commandInfo.ReplyToCommand("-----------------------");
commandInfo.ReplyToCommand($"Heap Memory: {GC.GetTotalMemory(false) / 1024.0 / 1024.0:F2} MB");
commandInfo.ReplyToCommand($"Paged Memory Size: {Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0:F2} MB");
commandInfo.ReplyToCommand($"Nonpaged Memory Size: {Process.GetCurrentProcess().NonpagedSystemMemorySize64 / 1024.0 / 1024.0:F2} MB");
commandInfo.ReplyToCommand($"Process Working Set: {Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0:F2} MB");
commandInfo.ReplyToCommand($"Private Memory Size: {Process.GetCurrentProcess().PrivateMemorySize64 / 1024.0 / 1024.0:F2} MB");
commandInfo.ReplyToCommand($"Virtual Memory Size: {Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0:F2} MB");
}
}