Ejemplo n.º 1
0
        internal void AddEvent(QuicEvent evt, QuicState state)
        {
            if (InitialTimeStamp == Timestamp.MaxValue)
            {
                InitialTimeStamp = evt.TimeStamp;
            }

            switch (evt.EventId)
            {
            case QuicEventId.StreamCreated:
            case QuicEventId.StreamRundown:
            {
                var _evt = evt as QuicStreamCreatedEvent;
                StreamId   = _evt !.StreamID;
                Connection = state.FindOrCreateConnection(new QuicObjectKey(evt.PointerSize, _evt !.Connection, evt.ProcessId));
                Connection.OnStreamAdded(this);
            }
            break;

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

            default:
                break;
            }

            FinalTimeStamp = evt.TimeStamp;

            Events.Add(evt);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 private void TrySetWorker(QuicEvent evt, QuicState state)
 {
     if (Worker == null)
     {
         Worker = state.GetWorkerFromThread(evt.ProcessId, evt.ThreadId);
         Worker?.OnConnectionAdded();
     }
 }
Ejemplo n.º 4
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 !.ScheduleState == QuicScheduleState.Processing)
                {
                    TrySetWorker(evt, state);
                }
                if (LastScheduleStateTimeStamp != Timestamp.MinValue)
                {
                    Worker?.AddSchedulingCpuTime(_evt !.ScheduleState, _evt.TimeStamp - LastScheduleStateTimeStamp);
                }
                LastScheduleStateTimeStamp = _evt.TimeStamp;
                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);
        }