Skip to content

Commit

Permalink
Changed graph scale units from bytes to kilobytes.
Browse files Browse the repository at this point in the history
Removed NetworkInterfaceSampler data source and bindings.
  • Loading branch information
Bilge committed Nov 20, 2016
1 parent ba359b6 commit 5a13045
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 64 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Reading from the left, the graph above shows we started downloading data at full

### Calibration

The scale of the graph is shown in bytes per second on the left of the graph. This can be changed by modifying the *actual speed* value in network settings. By default the actual speed is the same as the reported speed, which is the theoretical maximum speed reported by the adapter's device driver, but is usually much higher than the actual speed of a typical internet connection so we must calibrate it to a more realistic value.
The scale of the graph is shown in kilobytes per second on the left of the graph. This can be changed by modifying the *actual speed* value in network settings. By default the actual speed is the same as the reported speed, which is the theoretical maximum speed reported by the adapter's device driver, but is usually much higher than the actual speed of a typical internet connection so we must calibrate it to a more realistic value.

<img src="https://github.com/ScriptFUSION/UpDown-Meter/wiki/images/speedtest.gif" align="right">
To calibrate the speed of an internet connection we must apply full load to the connection to test its capacity. The easiest way to do this is visit a benchmarking site such as [Speedtest.net](http://www.speedtest.net). After performing the test, return to the *actual speed* setting and modify the value until the upload or download bar (whichever is taller) just touches the horizontal bar across the top of the graph, as shown on the right.
Expand All @@ -46,7 +46,7 @@ Contributing

Everyone is welcome to contribute anything, from [ideas][Issues] to [issues][Issues] to graphics to documentation to [code][PRs]!

Compiling the code is as easy as cloning the source in Visual Studio and clicking *start*, in newer versions of Visual Studio. In older versions, it may be necessary to manually restore NuGet packages after cloning.
Compiling the code is as easy as cloning the source in Visual Studio and clicking *start*. In older versions of Visual Studio, it may be necessary to manually restore NuGet packages after cloning.


[Releases]: https://github.com/ScriptFUSION/UpDown-Meter/releases
Expand Down
33 changes: 12 additions & 21 deletions Source/Forms/NetGraphForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Source/Forms/NetGraphForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public NetGraphForm() {

toolbox.BackColor = BackColor.Desaturate(.15f).Darken(.14f);

samplerBindingSource.Add(sampler = netGraph.Sampler = new NetworkInterfaceSampler());
sampler = netGraph.Sampler = new NetworkInterfaceSampler();
sampler.SampleAdded += Sampler_SampleAdded;

Options = new Options(Settings.Default);
Expand Down Expand Up @@ -77,6 +77,8 @@ private void SyncOptionsWithSampler(Options options) {
var nic = sampler.NetworkInterface = options.NetworkInterface;

sampler.MaximumSpeed = options.NicSpeeds.ContainsKey(nic?.Id ?? string.Empty) ? options.NicSpeeds[nic.Id] : 0;

nicSpeed.Text = Math.Round(sampler.MaximumSpeed / 1000f).ToString("0 kB/s");
}

private void SyncOptionsWithUI(Options options) {
Expand Down
7 changes: 2 additions & 5 deletions Source/Forms/NetGraphForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,10 @@
<value>17, 17</value>
</metadata>
<metadata name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>271, 17</value>
<value>97, 17</value>
</metadata>
<metadata name="trayMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>366, 17</value>
</metadata>
<metadata name="samplerBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>97, 17</value>
<value>192, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>58</value>
Expand Down
26 changes: 2 additions & 24 deletions Source/NetworkInterfaceSampler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
using System.Net.NetworkInformation;

namespace ScriptFUSION.UpDown_Meter {
public class NetworkInterfaceSampler : INotifyPropertyChanged, IEnumerable<Sample> {
public class NetworkInterfaceSampler : IEnumerable<Sample> {
private NetworkInterface nic;

private ulong maximumSpeed;

private PropertyChangedEventHandler propertyChangedHandlers;

public delegate void SampleAddedDelegate(NetworkInterfaceSampler sampler, Sample sample);

public delegate void SamplesClearedDelegate(NetworkInterfaceSampler sampler);
Expand All @@ -22,12 +18,6 @@ public class NetworkInterfaceSampler : INotifyPropertyChanged, IEnumerable<Sampl

public event SamplesClearedDelegate SamplesCleared;

event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
{
add { propertyChangedHandlers += value; }
remove { propertyChangedHandlers -= value; }
}

/// <summary>
/// Collection of relative samples from the current NetworkInterface.
/// </summary>
Expand All @@ -54,15 +44,7 @@ public NetworkInterface NetworkInterface
/// <summary>
/// List of relative samples.
/// </summary>
public ulong MaximumSpeed
{
get { return maximumSpeed; }
set
{
maximumSpeed = value;
RaisePropertyChanged();
}
}
public ulong MaximumSpeed { get; set; }

public void Reset() {
Samples.Clear();
Expand Down Expand Up @@ -106,10 +88,6 @@ private Sample CreateAbsoluteSample(IPInterfaceStatistics stats) {
return new Sample(stats.BytesReceived, stats.BytesSent);
}

private void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string property = null) {
propertyChangedHandlers?.Invoke(this, new PropertyChangedEventArgs(property));
}

private void RaiseSampleAdded(Sample sample) {
SampleAdded?.Invoke(this, sample);
}
Expand Down
10 changes: 0 additions & 10 deletions Source/Properties/DataSources/NetworkInterfaceSampler.datasource

This file was deleted.

1 change: 0 additions & 1 deletion Source/UpDown Meter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\DataSources\NetworkInterfaceSampler.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down

0 comments on commit 5a13045

Please sign in to comment.