public List <double> getDataRates() { int timeInterval = 60; TimeSpan RecordingLength = getDurationOfRecording(); DateTime DataStartPoint = PacketStartTime; DateTime DataEndPoint = PacketStartTime.AddSeconds(timeInterval); int seconds = (int)Math.Round(RecordingLength.TotalSeconds / timeInterval); List <double> datarate = new List <double>(); for (int i = 0; i < seconds; i++) { DataStartPoint = DataStartPoint.AddSeconds(timeInterval); DataEndPoint = DataEndPoint.AddSeconds(timeInterval); Console.WriteLine(i); int packets = 0; for (int j = 0; j < ListOfPackets.Count; j++) { TimeSpan a = ListOfPackets[j].Time.Subtract(DataStartPoint); TimeSpan b = DataEndPoint.Subtract(ListOfPackets[j].Time); if (ListOfPackets[j].Time.Subtract(DataStartPoint).TotalSeconds <= timeInterval && DataEndPoint.Subtract(ListOfPackets[j].Time).TotalSeconds <= timeInterval) { packets += ListOfPackets[j].getNumberOfBytes(); } } datarate.Add(packets); } return(datarate); }
public void AddInputEvent(int tickAck, float deltaTime) { if (ci.inputEvents.Count == 0) { PacketStartTime.StartStopWatch(); } SetInput(); InputEvent newInputEvent = new InputEvent(tickAck, deltaTime, pressedKeys, zAngle, mouseDown); ci.AddEvent(newInputEvent); }
private void ClientTick() { ci = AIInputHandler.GetClientInput(); if (ci.inputEvents.Count > 0) { // Network Tick NetworkTick.tickSeq++; ci.UpdateStatistics(NetworkTick.tickSeq, statisticsModule.tickAck, statisticsModule.GetTimeSpentIdleInTicks()); Send(ClientPktSerializer.Serialize(ci)); statisticsModule.RecordSentPacket(); // Clear the list of events. ci.inputEvents.Clear(); PacketStartTime.ResetStopWatch(); } }