Example #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);
        }
Example #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);
        }
Example #3
0
 private void TrySetWorker(QuicEvent evt, QuicState state)
 {
     if (Worker == null)
     {
         Worker = state.GetWorkerFromThread(evt.ProcessId, evt.ThreadId);
         Worker?.OnConnectionAdded();
     }
 }
Example #4
0
        internal void AddEvent(QuicEvent evt)
        {
            switch (evt.ObjectType)
            {
            case QuicObjectType.Global:
                if (evt.EventId >= QuicEventId.ApiEnter &&
                    evt.EventId <= QuicEventId.ApiExitStatus)
                {
                    DataAvailableFlags |= QuicDataAvailableFlags.Api;
                }
                break;

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

            case QuicObjectType.Connection:
                DataAvailableFlags |= QuicDataAvailableFlags.Connection;
                var Conn = ConnectionSet.FindOrCreateActive(evt);
                Conn.AddEvent(evt, this);
                LastConnections[evt.ThreadId] = Conn;
                break;

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

            case QuicObjectType.Datapath:
                DatapathSet.FindOrCreateActive(evt).AddEvent(evt, this);
                if (evt.EventId == QuicEventId.DatapathSend &&
                    LastConnections.TryGetValue(evt.ThreadId, out var LastConn))
                {
                    LastConn.AddEvent(evt, this);
                }
                break;

            default:
                break;
            }

            Events.Add(evt);
        }
Example #5
0
        internal void AddEvent(QuicEvent evt)
        {
            switch (evt.ObjectType)
            {
            case QuicObjectType.Global:
                if (evt.EventId >= QuicEventId.ApiEnter &&
                    evt.EventId <= 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);
        }
Example #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 !.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);
        }
Example #7
0
 public QuicObjectKey(QuicEvent evt) : this(evt.PointerSize, evt.ObjectPointer, evt.ProcessId)
 {
 }
Example #8
0
 public T FindOrCreateActive(QuicEvent evt) => FindOrCreateActive((ushort)evt.EventId, new QuicObjectKey(evt));