Esempio n. 1
0
    public static unsafe void GatherReliabilityStats(ref SoakStatisticsPoint stats, ref SoakStatisticsPoint lastStats, NetworkDriver driver,
                                                     NetworkPipeline pipeline, NetworkPipelineStageId reliableStageId, NetworkConnection con, long timestamp)
    {
        driver.GetPipelineBuffers(pipeline, reliableStageId, con, out var receiveBuffer, out var sendBuffer, out var sharedBuffer);

        var sharedCtx = (ReliableUtility.SharedContext *)sharedBuffer.GetUnsafeReadOnlyPtr();

        stats.ReliableSent += sharedCtx->stats.PacketsSent - lastStats.ReliableSent;
        //Console.WriteLine("sharedCtx->stats.PacketsSent=" + sharedCtx->stats.PacketsSent + " lastStats.ReliableSent=" + lastStats.ReliableSent + " stats.ReliableSent=" + stats.ReliableSent);
        stats.ReliableResent    += sharedCtx->stats.PacketsResent - lastStats.ReliableResent;
        stats.ReliableDropped   += sharedCtx->stats.PacketsDropped - lastStats.ReliableDropped;
        stats.ReliableReceived  += sharedCtx->stats.PacketsReceived - lastStats.ReliableReceived;
        stats.ReliableDuplicate += sharedCtx->stats.PacketsDuplicated - lastStats.ReliableDuplicate;
        stats.ReliableRTT        = sharedCtx->RttInfo.LastRtt;
        stats.ReliableSRTT       = sharedCtx->RttInfo.SmoothedRtt;
        int resendQueueSize       = 0;
        int oldestResendPacketAge = 0;
        int maxRtt            = 0;
        int maxProcessingTime = 0;

        GatherExtraStats(sendBuffer, sharedBuffer, timestamp, ref resendQueueSize, ref oldestResendPacketAge, ref maxRtt, ref maxProcessingTime);
        stats.ReliableResendQueue           = resendQueueSize;
        stats.ReliableOldestResendPacketAge = oldestResendPacketAge;
        stats.ReliableMaxRTT            = maxRtt;
        stats.ReliableMaxProcessingTime = maxProcessingTime;

        lastStats.ReliableSent      = sharedCtx->stats.PacketsSent;
        lastStats.ReliableResent    = sharedCtx->stats.PacketsResent;
        lastStats.ReliableDropped   = sharedCtx->stats.PacketsDropped;
        lastStats.ReliableReceived  = sharedCtx->stats.PacketsReceived;
        lastStats.ReliableDuplicate = sharedCtx->stats.PacketsDuplicated;
    }
Esempio n. 2
0
    public unsafe void DumpSimulatorStatistics()
    {
        DriverHandle.GetPipelineBuffers(Pipeline, SimulatorStageId, ConnectionHandle[0], out var receiveBuffer, out var sendBuffer, out var sharedBuffer);

        /*var simCtx = (Simulator.Context*)sharedBuffer.GetUnsafeReadOnlyPtr();
         * Debug.Log("Simulator stats\n" +
         *  "PacketCount: " + simCtx->PacketCount + "\n" +
         *  "PacketDropCount: " + simCtx->PacketDropCount + "\n" +
         *  "MaxPacketCount: " + simCtx->MaxPacketCount + "\n" +
         *  "ReadyPackets: " + simCtx->ReadyPackets + "\n" +
         *  "WaitingPackets: " + simCtx->WaitingPackets + "\n" +
         *  "NextPacketTime: " + simCtx->NextPacketTime + "\n" +
         *  "StatsTime: " + simCtx->StatsTime);*/
    }
Esempio n. 3
0
    public static unsafe void DumpReliabilityStatistics(NetworkDriver driver, NetworkPipeline pipeline, NetworkPipelineStageId reliableStageId, NetworkConnection con)
    {
        driver.GetPipelineBuffers(pipeline, reliableStageId, con, out var receiveBuffer, out var sendBuffer, out var sharedBuffer);

        /*var relCtx = (ReliableUtility.SharedContext*)sharedBuffer.GetUnsafeReadOnlyPtr();
        *  var sendCtx = (ReliableUtility.Context*)sendBuffer.GetUnsafeReadOnlyPtr();
        *  UnityEngine.Debug.Log("Reliability stats\nPacketsDropped: " + relCtx->stats.PacketsDropped + "\n" +
        *         "PacketsDuplicated: " + relCtx->stats.PacketsDuplicated + "\n" +
        *         "PacketsOutOfOrder: " + relCtx->stats.PacketsOutOfOrder + "\n" +
        *         "PacketsReceived: " + relCtx->stats.PacketsReceived + "\n" +
        *         "PacketsResent: " + relCtx->stats.PacketsResent + "\n" +
        *         "PacketsSent: " + relCtx->stats.PacketsSent + "\n" +
        *         "PacketsStale: " + relCtx->stats.PacketsStale + "\n" +
        *         "Last received remote seqId: " + relCtx->ReceivedPackets.Sequence + "\n" +
        *         "Last received remote ackMask: " + SequenceHelpers.BitMaskToString(relCtx->ReceivedPackets.AckMask) + "\n" +
        *         "Last sent seqId: " + (relCtx->SentPackets.Sequence - 1)+ "\n" +
        *         "Last acked seqId: " + relCtx->SentPackets.Acked + "\n" +
        *         "Last ackmask: " + SequenceHelpers.BitMaskToString(relCtx->SentPackets.AckMask));*/
    }