Giter Club home page Giter Club logo

pingalot's People

Contributors

danielspindler83 avatar turnerj avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

pingalot's Issues

AverageRoundTrip statistic calculated without decimal places

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.

DivideByZeroException when first ping fails

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

Stream data to export file while running

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.

Add Pingalot.Core to NuGet

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.