Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions BandWidthMonitor/App.config

This file was deleted.

16 changes: 8 additions & 8 deletions BandWidthMonitor/BandwidthLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class BandwidthLogger : IDisposable
public BandwidthLogger(TimeSpan logFrequency)
{
if (logFrequency <= TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException("logFrequency");
{
throw new ArgumentOutOfRangeException("logFrequency");
}

_logFrequency = logFrequency;
Expand All @@ -31,7 +31,7 @@ private async void StartLogging()
{
const long bitsPerByte = 8;
const double oneMeg = 1024 * 1024;


while (!_disposed)
{
Expand All @@ -40,13 +40,13 @@ private async void StartLogging()
long bytesRead;
long bytesWrite;
GetNetworkUsage(out bytesRead, out bytesWrite);

DateTimeOffset currentTime = DateTimeOffset.UtcNow;
TimeSpan elapsed = currentTime - _previousComputeTime;

long readDelta = (bytesRead - _previousReadBytes);
long writeDelta = (bytesWrite - _previousWriteBytes);

_previousReadBytes = bytesRead;
_previousWriteBytes = bytesWrite;
_previousComputeTime = currentTime;
Expand All @@ -57,7 +57,7 @@ private async void StartLogging()
LogUsage(mbitsReadPerSecond, mbitsWritePerSecond);
}
}
catch(Exception)
catch (Exception)
{

}
Expand Down Expand Up @@ -88,7 +88,7 @@ private static void GetNetworkUsage(out long bytesRead, out long bytesWrite)
bytesWrite += nicbytesWrite;
}
}
catch(Exception)
catch (Exception)
{

}
Expand Down
80 changes: 21 additions & 59 deletions BandWidthMonitor/BandwidthMonitor.csproj
Original file line number Diff line number Diff line change
@@ -1,59 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{704D6A6C-711C-4332-9248-5F7009C1E071}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BandwidthMonitor</RootNamespace>
<AssemblyName>BandwidthMonitor</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BandwidthLogger.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<!--Change the runtime identifier according to target system
For windows values for runtime identifiers are win10-x64, win10-x86, win81-x64 etc.
For Linux identifer values are linux-x64, linux-musl-x64, linux-arm, rhel-x64 etc.
More about identifiers, refer the official microsoft docs at https://docs.microsoft.com/en-us/dotnet/core/rid-catalog-->
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

</Project>
7 changes: 4 additions & 3 deletions BandWidthMonitor/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using BandwidthMonitor;
using System;

namespace BandwidthMonitor
namespace BandWidthMonitor
{
class Program
{
Expand All @@ -11,6 +12,6 @@ static void Main(string[] args)
Console.WriteLine("Press Enter to close application");
Console.ReadLine();
}
}
}
}
}
1 change: 0 additions & 1 deletion BandWidthMonitor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
6 changes: 0 additions & 6 deletions ThreadPoolMonitor/App.config

This file was deleted.

4 changes: 1 addition & 3 deletions ThreadPoolMonitor/PerfCounterHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;

namespace ThreadPoolMonitor
{
Expand All @@ -18,7 +16,7 @@ public static string GetSystemCPU()
float systemCPU;
if (PerfCounterHelper.TryGetSystemCPU(out systemCPU))
{
cpu = Math.Round(systemCPU, 2) + "%";
cpu = Math.Round(systemCPU, 2) + "%";
}
return cpu;
}
Expand Down
2 changes: 1 addition & 1 deletion ThreadPoolMonitor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ static void Main(string[] args)
Console.WriteLine("Press Enter to close application");
Console.ReadLine();
}
}
}
}
}
1 change: 0 additions & 1 deletion ThreadPoolMonitor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down
Loading