From eb85749f5c33f562811925bfbc06ff58c4f9a1d1 Mon Sep 17 00:00:00 2001 From: Brandon Scott Date: Tue, 13 May 2014 14:28:48 +0100 Subject: [PATCH] CPU hotfix for individual cycles --- CadenceHost/Windows/MainWindow.xaml | 2 +- CadenceHost/Windows/MainWindow.xaml.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CadenceHost/Windows/MainWindow.xaml b/CadenceHost/Windows/MainWindow.xaml index de97fe5..28d3412 100644 --- a/CadenceHost/Windows/MainWindow.xaml +++ b/CadenceHost/Windows/MainWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:helpers="clr-namespace:CadenceHost.Helpers" - Title="MainWindow" Height="418.06" Width="1089.657" ResizeMode="NoResize" WindowStyle="None" MouseDown="Window_MouseDown" Closing="OnWindowClosing" Icon="../Images/CadenceIcon.ico"> + Title="MainWindow" Height="418.06" Width="1089.657" ResizeMode="NoResize" WindowStyle="None" MouseDown="Window_MouseDown" Icon="../Images/CadenceIcon.ico"> diff --git a/CadenceHost/Windows/MainWindow.xaml.cs b/CadenceHost/Windows/MainWindow.xaml.cs index 2213d47..1dfc79b 100644 --- a/CadenceHost/Windows/MainWindow.xaml.cs +++ b/CadenceHost/Windows/MainWindow.xaml.cs @@ -93,12 +93,13 @@ public MainWindow() private void OnPulse(object sender, EventArgs e) { + //We hold onto this one so we don't skip two cycles (the next one is usually 0) var currentCpu = _statsHelper.GetCurrentCpu(); AddDebugInfo( - String.Format("Sending Pulse - CPU: {0}, RAM: {1}, Disk Usage: {2} and Uptime: {3}", - _statsHelper.GetCurrentCpu(), _statsHelper.GetCurrentRamPercent(), _statsHelper.GetFreeDiskStorageAsPercentage(), _statsHelper.GetUptime())); + String.Format("Sending Pulse - CPU: {0}, RAM: {1}, Disk Usage: {2} and Uptime: {3}", currentCpu + , _statsHelper.GetCurrentRamPercent(), _statsHelper.GetFreeDiskStorageAsPercentage(), _statsHelper.GetUptime())); var timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)); @@ -106,7 +107,7 @@ private void OnPulse(object sender, EventArgs e) { {"server_id", _serverId.ToString(CultureInfo.InvariantCulture)}, {"ram_usage", _statsHelper.GetCurrentRamPercent()}, - {"cpu_usage", _statsHelper.GetCurrentCpu()}, + {"cpu_usage", currentCpu}, {"disk_usage", _statsHelper.GetFreeDiskStorageAsPercentage()}, {"uptime", _statsHelper.GetUptime().ToString(CultureInfo.InvariantCulture)}, {"timestamp", timeSpan.TotalSeconds.ToString(CultureInfo.InvariantCulture)}