Esempio n. 1
0
        private static void StatisticsHandler(PacketSampleStatistics statistics)
        {
            DateTime currentTimestamp = statistics.Timestamp;


            DateTime previousTimestamp = _lastTimestamp;


            _lastTimestamp = currentTimestamp;


            if (previousTimestamp == DateTime.MinValue)
            {
                return;
            }


            double delayInSeconds = (currentTimestamp - previousTimestamp).TotalSeconds;


            double bitsPerSecond = statistics.AcceptedBytes * 8 / delayInSeconds;


            double packetsPerSecond = statistics.AcceptedPackets / delayInSeconds;

            MessageBox.Show(statistics.Timestamp + " BPS: " + bitsPerSecond + " PPS: " + packetsPerSecond);
            // Print timestamp and samples
        }
Esempio n. 2
0
        private static void StatisticsHandler(PacketSampleStatistics statistics)
        {
            // Current sample time
            DateTime currentTimestamp = statistics.Timestamp;

            // Previous sample time
            DateTime previousTimestamp = _lastTimestamp;

            // Set _lastTimestamp for the next iteration
            _lastTimestamp = currentTimestamp;

            // If there wasn't a previous sample than skip this iteration (it's the first iteration)
            if (previousTimestamp == DateTime.MinValue)
                return;

            // Calculate the delay from the last sample
            double delayInSeconds = (currentTimestamp - previousTimestamp).TotalSeconds;

            // Calculate bits per second
            double bitsPerSecond = statistics.AcceptedBytes * 8 / delayInSeconds;

            // Calculate packets per second
            double packetsPerSecond = statistics.AcceptedPackets / delayInSeconds;

            // Print timestamp and samples
            Console.WriteLine(statistics.Timestamp + " BPS: " + bitsPerSecond + " PPS: " + packetsPerSecond);
        }
Esempio n. 3
0
        private static void StatisticsHandler(PacketSampleStatistics statistics)
        {
            // Current sample time
            DateTime currentTimestamp = statistics.Timestamp;

            // Previous sample time
            DateTime previousTimestamp = _lastTimestamp;

            // Set _lastTimestamp for the next iteration
            _lastTimestamp = currentTimestamp;

            // If there wasn't a previous sample than skip this iteration (it's the first iteration)
            if (previousTimestamp == DateTime.MinValue)
            {
                return;
            }

            // Calculate the delay from the last sample
            double delayInSeconds = (currentTimestamp - previousTimestamp).TotalSeconds;

            // Calculate bits per second
            double bitsPerSecond = statistics.AcceptedBytes * 8 / delayInSeconds;

            // Calculate packets per second
            double packetsPerSecond = statistics.AcceptedPackets / delayInSeconds;

            // Print timestamp and samples
            _tr.WriteLine(statistics.Timestamp + " BPS: " + bitsPerSecond + " PPS: " + packetsPerSecond);

            //if (_wr.IsExecutionAborted())
            //    __communicator.Break();
        }