Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Fixed the memory counter.
Browse files Browse the repository at this point in the history
  • Loading branch information
AntINFINAit authored and AntINFINAit committed Nov 7, 2020
1 parent 83b178d commit 1d63c98
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PerformanceMonitors
/// We update this value every 1 second.
/// </summary>
public int CpuUsage{ get; private set; }
public int MemoryUsage => ((int) ProcessCtx.WorkingSet64 / (1024 * 1024));
public int MemoryUsage { get; set; }
public bool Running { get; private set; }
private Process ProcessCtx { get; set; }
public PerformanceMonitors()
Expand All @@ -34,6 +34,7 @@ private void DoCount()
_endTime = DateTime.Now;
_endUsage = ProcessCtx.TotalProcessorTime;
this.CpuUsage = (int)((((_endUsage - _startUsage).TotalMilliseconds) / (Environment.ProcessorCount * ((_endTime - _startTime).TotalMilliseconds))) * 100);
this.MemoryUsage = (int) ((ProcessCtx.PrivateMemorySize64 / 1024f) / 1024f);
}
}
public void Shutdown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public void DoHeartbeat()
Push(String.Empty, string.Empty,Structures.MessageFlag.HeartbeatMessage,CompileNumbers());
}
}
Thread.Sleep(5000);
Thread.Sleep(1000);
}
}

Expand Down
Binary file added Server.Test.rar
Binary file not shown.

0 comments on commit 1d63c98

Please sign in to comment.