turnersoftware / pingalot Goto Github PK
View Code? Open in Web Editor NEWA .NET command line ping and analysis tool
License: MIT License
A .NET command line ping and analysis tool
License: MIT License
Found a possible stats bug whilst creating a unit test to verify statistics.
Test setup:
10 pings - 8 successful and 2 timed out
6 Pings with 10ms RT, 2 with 5ms RT and 2 time out so RT is 0.
Formula used for calculating AverageRoundtrip = totalRoundtrip / PacketsReceived
For our test case - calculating manually:
totalRoundtrip = 70
PacketsReceived = 8
AverageRoundtrip = 70 / 8 = 8.75
I am thinking that our result to two or maybe three decimal places, rounded up, would suffice?
Or should we more explicitly round this off to an integer?
Currently the application comes up with the AverageRoundtrip as 8 - no decimal places.
This appears to be because we use implicit typing to declare totalRoundtrip and assign a value of 0 as a long.
var totalRoundtrip = 0L;
PacketsReceived is an int
AverageRoundtrip is a double
double = long / int
This is truncating decimal places before being stored in the double
Explicitly setting totalRoundtrip to a double resolves the issue.
However we need to test further for results with more decimal places and maybe look to round to either 2 or 3 decimal places.
To replicate the issue:
Command Line Arguments: -t --layout 2 --export test.csv 56.56.56.56
This IP fails to respond to ping - for all requests
PingSession.cs:line 65
AverageRoundtrip = totalRoundtrip / PacketsReceived;
On the first ping PacketsReceived will be zero - triggering the DivideByZeroException
Picked this up when creating unit tests for PingSession
Possibly we just need to wrap line 65 with a conditional statement that sets AverageRoundtrip to 0 if PacketsReceived is 0.
Will add a unit test for this specific scenario
Based on the same concept in this: https://en.wikipedia.org/wiki/MTR_(software)
Effectively trace the hops between two targets, then ping each of the hops to see where the packet loss might be happening.
PacketsLostPercentage is a double.
Good idea to round this to two decimal places?
Currently it stores a list for final export but that isn't ideal for memory allocations. Instead, if the code was setup to write to the file every ping, if the application crashes the data isn't lost.
The core library does the heavy lifting of pinging. It is mostly a utility wrapper but might prove useful to those that want to embed pinging into their own applications.
Further research needs to be done on the applicability of this and how best to do it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.