Skip to content

Commit

Permalink
- Removing CPU and memory tracking in log file
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Olivo committed Nov 2, 2024
1 parent 23dc4d6 commit 6233370
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 38 deletions.
8 changes: 0 additions & 8 deletions MixItUp.Base/ChannelSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,6 @@ await StreamingPlatforms.ForEachPlatform(async (p) =>
{
await ChannelSession.SaveSettings();
sessionBackgroundTimer = 0;

if (ChannelSession.IsDebug())
{
float cpuUsage = await ServiceManager.Get<IProcessService>().GetCPUUsage();
int memoryUsage = (int)Math.Round(ServiceManager.Get<IProcessService>().GetMemoryUsage() / 1024 / 1024);
long gcMemory = GC.GetTotalMemory(true);
Logger.ForceLog(LogLevel.Debug, $"Application Usage: {cpuUsage}% CPU Usage - {memoryUsage} MBs of Memory - {gcMemory} Garbage Collector Memory");
}
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions MixItUp.Base/Services/IProcessService.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;

namespace MixItUp.Base.Services
{
public interface IProcessService
{
Task<float> GetCPUUsage();

float GetMemoryUsage();

void LaunchLink(string url);

void LaunchFolder(string folderPath);
Expand Down
25 changes: 0 additions & 25 deletions MixItUp.WPF/Services/WindowsProcessService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,13 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

namespace MixItUp.WPF.Services
{
public class WindowsProcessService : IProcessService
{
PerformanceCounter cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");

public async Task<float> GetCPUUsage()
{
try
{
cpuCounter.NextValue();

await Task.Delay(1000);

return cpuCounter.NextValue();
}
catch (Exception ex) { Logger.Log(ex); }
return 0;
}

public float GetMemoryUsage()
{
try
{
return Process.GetCurrentProcess().WorkingSet64;
}
catch (Exception ex) { Logger.Log(ex); }
return 0;
}

public void LaunchLink(string url)
{
try
Expand Down

0 comments on commit 6233370

Please sign in to comment.