From 8424fd3ee9256dd88fd764dc7ab60ffe43ee1d94 Mon Sep 17 00:00:00 2001 From: Matthew Olivo Date: Sat, 9 Nov 2024 13:17:12 -0800 Subject: [PATCH] - Removing CPU and RAM utilization logging --- MixItUp.Base/ChannelSession.cs | 5 --- MixItUp.Base/Services/IProcessService.cs | 5 --- MixItUp.WPF/Services/WindowsProcessService.cs | 34 ------------------- 3 files changed, 44 deletions(-) diff --git a/MixItUp.Base/ChannelSession.cs b/MixItUp.Base/ChannelSession.cs index 31d0bbeb0..8568d5720 100644 --- a/MixItUp.Base/ChannelSession.cs +++ b/MixItUp.Base/ChannelSession.cs @@ -500,11 +500,6 @@ await StreamingPlatforms.ForEachPlatform(async (p) => { await ChannelSession.SaveSettings(); sessionBackgroundTimer = 0; - - int cpuUsage = await ServiceManager.Get().GetCPUUsage(); - int memoryUsage = (int)Math.Round(ServiceManager.Get().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"); } } } diff --git a/MixItUp.Base/Services/IProcessService.cs b/MixItUp.Base/Services/IProcessService.cs index cfda6e7c3..a138b8159 100644 --- a/MixItUp.Base/Services/IProcessService.cs +++ b/MixItUp.Base/Services/IProcessService.cs @@ -1,15 +1,10 @@ using System.Collections.Generic; using System.Diagnostics; -using System.Threading.Tasks; namespace MixItUp.Base.Services { public interface IProcessService { - Task GetCPUUsage(); - - float GetMemoryUsage(); - void LaunchLink(string url); void LaunchFolder(string folderPath); diff --git a/MixItUp.WPF/Services/WindowsProcessService.cs b/MixItUp.WPF/Services/WindowsProcessService.cs index 30dc9667e..ec89a228f 100644 --- a/MixItUp.WPF/Services/WindowsProcessService.cs +++ b/MixItUp.WPF/Services/WindowsProcessService.cs @@ -4,45 +4,11 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Threading.Tasks; namespace MixItUp.WPF.Services { public class WindowsProcessService : IProcessService { - public async Task GetCPUUsage() - { - try - { - var startTime = DateTime.UtcNow; - var startCpuUsage = Process.GetCurrentProcess().TotalProcessorTime; - - await Task.Delay(500); - - var endTime = DateTime.UtcNow; - var endCpuUsage = Process.GetCurrentProcess().TotalProcessorTime; - - var cpuUsedMs = (endCpuUsage - startCpuUsage).TotalMilliseconds; - var totalMsPassed = (endTime - startTime).TotalMilliseconds; - - var cpuUsageTotal = cpuUsedMs / (Environment.ProcessorCount * totalMsPassed); - - return (int)Math.Round(cpuUsageTotal * 100); - } - 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