Client LuaCsForBarotrauma
LuaCsPerformanceCounter.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 
5 namespace Barotrauma
6 {
8  {
9  public bool EnablePerformanceCounter = false;
10 
11  public double UpdateElapsedTime;
12  public Dictionary<string, Dictionary<string, double>> HookElapsedTime = new Dictionary<string, Dictionary<string, double>>();
13 
14  public static float MemoryUsage
15  {
16  get
17  {
18  Process proc = Process.GetCurrentProcess();
19  float memory = MathF.Round(proc.PrivateMemorySize64 / (1024 * 1024), 2);
20  proc.Dispose();
21 
22  return memory;
23  }
24  }
25 
26  public void SetHookElapsedTicks(string eventName, string hookName, long ticks)
27  {
28  if (!HookElapsedTime.ContainsKey(eventName))
29  {
30  HookElapsedTime[eventName] = new Dictionary<string, double>();
31  }
32 
33  HookElapsedTime[eventName][hookName] = (double)ticks / Stopwatch.Frequency;
34  }
35  }
36 }
Dictionary< string, Dictionary< string, double > > HookElapsedTime
void SetHookElapsedTicks(string eventName, string hookName, long ticks)