private static void StartServerChecks() { _serverRamCounter = new MemoryCounter(ProcessHandler.ServerProcess.Id); _serverRamCounter.UpdateStats(); _serverCpuCounter = new CpuCounter(ProcessHandler.ServerProcess.Id); _serverCpuCounter.UpdateStats(); }
public static void Initialize() { if (_initialized) { return; } _serverRamCounter = new MemoryCounter(); _serverRamCounter.Disable(); _serverCpuCounter = new CpuCounter(); _serverCpuCounter.Disable(); ProcessHandler.ServerStarted += StartServerChecks; ProcessHandler.ServerStopped += StopServerChecks; _initialized = true; }
public static void Initialize() { if (_initialized) return; _serverRamCounter = new MemoryCounter(); _serverRamCounter.Disable(); _serverCpuCounter = new CpuCounter(); _serverCpuCounter.Disable(); ProcessHandler.ServerStarted += StartServerChecks; ProcessHandler.ServerStopped += StopServerChecks; _initialized = true; }
private static string ConstructRamLabelText(MemoryCounter counter) { return counter.MemoryUsageMb + "Mb (" + counter.MemoryUsagePct.ToString(CultureInfo.InvariantCulture).PadLeft(2, '0') + "%)"; }