예제 #1
0
        internal void AddEvent(QuicEvent evt, QuicState state)
        {
            if (InitialTimeStamp == Timestamp.MaxValue)
            {
                InitialTimeStamp = evt.TimeStamp;
            }

            switch (evt.ID)
            {
            case QuicEventId.StreamCreated:
            case QuicEventId.StreamRundown:
            {
                var payload = (evt.Payload as QuicStreamCreatedPayload);
                StreamId   = payload !.ID;
                Connection = state.FindOrCreateConnection(new QuicObjectKey(evt.PointerSize, payload !.Connection, evt.ProcessId));
                Connection.OnStreamAdded(this);
            }
            break;

            case QuicEventId.StreamOutFlowBlocked:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.StreamFlowBlocked;
                break;
            }

            default:
                break;
            }

            FinalTimeStamp = evt.TimeStamp;

            Events.Add(evt);
        }
예제 #2
0
        internal void AddEvent(QuicEvent evt, QuicState state)
        {
            switch (evt.EventId)
            {
            case QuicEventId.DatapathSend:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.Datapath;
                var _evt = evt as QuicDatapathSendEvent;
                BytesSent += _evt !.TotalSize;
                SendEventCount++;

                var worker = state.GetWorkerFromThread(evt.ProcessId, evt.ThreadId);
                if (worker != null && worker.LastConnection != null)
                {
                    worker.LastConnection.AddEvent(evt, state);
                }
                break;
            }

            case QuicEventId.DatapathRecv:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.Datapath;
                var _evt = evt as QuicDatapathRecvEvent;
                BytesReceived += _evt !.TotalSize;
                ReceiveEventCount++;
                break;
            }

            default:
                break;
            }

            Events.Add(evt);
        }
예제 #3
0
        internal void AddEvent(QuicEvent evt, QuicState state)
        {
            switch (evt.ID)
            {
            case QuicEventId.DatapathSend:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.Datapath;
                var payload = (evt.Payload as QuicDatapathSendPayload);
                BytesSent += payload !.TotalSize;
                SendEventCount++;
                break;
            }

            case QuicEventId.DatapathRecv:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.Datapath;
                var payload = (evt.Payload as QuicDatapathRecvPayload);
                BytesReceived += payload !.TotalSize;
                ReceiveEventCount++;
                break;
            }

            default:
                break;
            }

            Events.Add(evt);
        }
예제 #4
0
 private void TrySetWorker(QuicEvent evt, QuicState state)
 {
     if (Worker == null)
     {
         Worker = state.GetWorkerFromThread(evt.ProcessId, evt.ThreadId);
         Worker?.OnConnectionAdded();
     }
 }
예제 #5
0
        internal void AddEvent(QuicEvent evt)
        {
            switch (evt.ObjectType)
            {
            case QuicObjectType.Global:
                if (evt.ID >= QuicEventId.ApiEnter &&
                    evt.ID <= QuicEventId.ApiExitStatus)
                {
                    DataAvailableFlags |= QuicDataAvailableFlags.Api;
                }
                break;

            case QuicObjectType.Worker:
                DataAvailableFlags |= QuicDataAvailableFlags.Worker;
                WorkerSet.FindOrCreateActive(new QuicObjectKey(evt)).AddEvent(evt, this);
                break;

            case QuicObjectType.Connection:
                DataAvailableFlags |= QuicDataAvailableFlags.Connection;
                ConnectionSet.FindOrCreateActive(new QuicObjectKey(evt)).AddEvent(evt, this);
                break;

            case QuicObjectType.Stream:
                DataAvailableFlags |= QuicDataAvailableFlags.Stream;
                StreamSet.FindOrCreateActive(new QuicObjectKey(evt)).AddEvent(evt, this);
                break;

            case QuicObjectType.Datapath:
                DatapathSet.FindOrCreateActive(new QuicObjectKey(evt)).AddEvent(evt, this);
                break;

            default:
                break;
            }

            Events.Add(evt);
        }
예제 #6
0
        internal void AddEvent(QuicEvent evt, QuicState state)
        {
            if (InitialTimeStamp == Timestamp.MaxValue)
            {
                InitialTimeStamp = evt.TimeStamp;
            }

            switch (evt.EventId)
            {
            case QuicEventId.ConnCreated:
            case QuicEventId.ConnRundown:
            {
                var _evt = evt as QuicConnectionCreatedEvent;
                CorrelationId       = _evt !.CorrelationId;
                State               = QuicConnectionState.Allocated;
                IsServer            = _evt !.IsServer != 0;
                IsHandshakeComplete = false;
            }
            break;

            case QuicEventId.ConnHandshakeComplete:
            {
                State = QuicConnectionState.HandshakeComplete;
                IsHandshakeComplete = true;
                break;
            }

            case QuicEventId.ConnScheduleState:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.ConnectionSchedule;
                var _evt = evt as QuicConnectionScheduleStateEvent;
                if (_evt !.State == (uint)QuicScheduleState.Processing)
                {
                    TrySetWorker(evt, state);
                }
                break;
            }

            case QuicEventId.ConnExecOper:
            case QuicEventId.ConnExecApiOper:
            case QuicEventId.ConnExecTimerOper:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.ConnectionExec;
                TrySetWorker(evt, state);
                break;
            }

            case QuicEventId.ConnAssignWorker:
            {
                Worker?.OnConnectionRemoved();
                var _evt = evt as QuicConnectionAssignWorkerEvent;
                var key  = new QuicObjectKey(evt.PointerSize, _evt !.WorkerPointer, evt.ProcessId);
                Worker = state.FindOrCreateWorker(key);
                Worker.OnConnectionAdded();
                break;
            }

            case QuicEventId.ConnTransportShutdown:
            {
                var _evt = evt as QuicConnectionTransportShutdownEvent;
                State             = QuicConnectionState.Shutdown;
                IsAppShutdown     = false;
                IsShutdownRemote  = _evt !.IsRemoteShutdown != 0;
                ShutdownTimeStamp = evt.TimeStamp;
                break;
            }

            case QuicEventId.ConnAppShutdown:
            {
                var _evt = evt as QuicConnectionAppShutdownEvent;
                State             = QuicConnectionState.Shutdown;
                IsAppShutdown     = true;
                IsShutdownRemote  = _evt !.IsRemoteShutdown != 0;
                ShutdownTimeStamp = evt.TimeStamp;
                break;
            }

            case QuicEventId.ConnHandleClosed:
            {
                State = QuicConnectionState.Closed;
                break;
            }

            case QuicEventId.ConnOutFlowStats:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.ConnectionTput;
                var _evt = evt as QuicConnectionOutFlowStatsEvent;
                BytesSent = _evt !.BytesSent;
                TrySetWorker(evt, state);
                break;
            }

            case QuicEventId.ConnOutFlowBlocked:
            {
                var _evt = evt as QuicConnectionOutFlowBlockedEvent;
                if (_evt !.ReasonFlags != 0)
                {
                    state.DataAvailableFlags |= QuicDataAvailableFlags.ConnectionFlowBlocked;
                }
                break;
            }

            case QuicEventId.ConnInFlowStats:
            {
                var _evt = evt as QuicConnectionInFlowStatsEvent;
                BytesReceived = _evt !.BytesRecv;
                TrySetWorker(evt, state);
                break;
            }

            case QuicEventId.ConnStats:
            {
                state.DataAvailableFlags |= QuicDataAvailableFlags.ConnectionTput;
                var _evt = evt as QuicConnectionStatsEvent;
                BytesSent     = _evt !.SendTotalBytes;
                BytesReceived = _evt !.RecvTotalBytes;
                break;
            }

            default:
                break;
            }

            FinalTimeStamp = evt.TimeStamp;

            Worker?.OnConnectionEvent(this, evt);

            Events.Add(evt);
        }
예제 #7
0
 internal QuicObjectKey(QuicEvent evt) : this(evt.PointerSize, evt.ObjectPointer, evt.ProcessId)
 {
 }