Esempio n. 1
0
        private void RetrieverResultsChanged(object sender, EventArgs e)
        {
            if (sender != iRetriever)
            {
                return;
            }

            // get the current results from the retriever
            NetmonRetriever.Results results = iRetriever.GetResults();

            UserLog.WriteLine(String.Format("{0} Netmon: T:{1} O:{2} D:{3} M:{4} Min:{5} Max:{6} StdDev:{7}", DateTime.Now, results.Total, results.OutOfSeq, results.Duplicates, results.Missed, results.Min, results.Max, results.StdDev));

            // calculate the current latency for these results
            uint latencyMs = CalculateLatency(results);

            // update the latency only if is is greater than the current latency - this means that the latency will only change during the run if
            // if is larger than what it was at the start of the run
            if (latencyMs > iLatencyMs)
            {
                iLatencyMs = latencyMs;

                if (EventLatencyChanged != null)
                {
                    EventLatencyChanged(this, EventArgs.Empty);
                }
            }
        }
Esempio n. 2
0
        private uint CalculateLatency(NetmonRetriever.Results aResults)
        {
            int dt = aResults.Max + aResults.Min;

            const uint ThresholdExcellent = 10;
            const uint ThresholdGood      = 50;
            const uint ThresholdPoor      = 100;

            if (dt < ThresholdExcellent)
            {
                return(LatencyMsExcellent);
            }
            else if (dt < ThresholdGood)
            {
                return(LatencyMsGood);
            }
            else if (dt < ThresholdPoor)
            {
                return(LatencyMsPoor);
            }
            else
            {
                return(LatencyMsVeryPoor);
            }
        }
Esempio n. 3
0
        private void SenderFinished(object sender, EventArgs e)
        {
            if (sender != iSender)
            {
                return;
            }

            // dispose of the sender
            iSender.EventFinished        -= SenderFinished;
            iSender.EventProgressChanged -= SenderProgressChanged;
            iSender.Dispose();
            iSender = null;

            // just skip the last couple of results for the retriever and dispose it
            NetmonRetriever.Results results = iRetriever.GetResults();
            iRetriever.EventResultsChanged -= RetrieverResultsChanged;
            iRetriever.Dispose();
            iRetriever = null;

            UserLog.WriteLine(String.Format("{0} Netmon Final: T:{1} O:{2} D:{3} M:{4} Min:{5} Max:{6} StdDev:{7}", DateTime.Now, results.Total, results.OutOfSeq, results.Duplicates, results.Missed, results.Min, results.Max, results.StdDev));

            // make sure latency is updated with the final results
            iLatencyMs = CalculateLatency(results);

            if (EventLatencyChanged != null)
            {
                EventLatencyChanged(this, EventArgs.Empty);
            }

            if (EventProgressChanged != null)
            {
                EventProgressChanged(this, EventArgs.Empty);
            }
        }