public CtfEventStream( ICtfInputStream inputStream, ICtfMetadata metadata, ICtfPlaybackCustomization playbackCustomization) { this.InputStream = inputStream; this.Metadata = metadata; this.PlaybackCustomization = playbackCustomization; }
public void ProcessEvent(ICtfEvent ctfEvent, ICtfPacket eventPacket, ICtfTraceInput traceInput, ICtfInputStream ctfEventStream) { var eventDescriptor = ctfEvent.EventDescriptor as EventDescriptor; Debug.Assert(eventDescriptor != null); if (eventDescriptor == null) { throw new LTTngPlaybackException("EventDescriptor is not an LTTng descriptor."); } if (!this.streamToCpu.TryGetValue(ctfEventStream, out var cpuId)) { var cpuIndex = ctfEventStream.StreamSource.LastIndexOf('_'); string cpu = ctfEventStream.StreamSource.Substring(cpuIndex + 1); if (!uint.TryParse(cpu, out cpuId)) { Debug.Assert(false, "Unable to parse cpu from LTTng stream channel"); cpuId = uint.MaxValue; } this.streamToCpu.Add(ctfEventStream, cpuId); } if (!this.traceContexts.TryGetValue(traceInput, out var traceContext)) { traceContext = new TraceContext(this.metadataCustomization.LTTngMetadata); this.traceContexts.Add(traceInput, traceContext); } var callbackEvent = new LTTngEvent(ctfEvent); var callbackContext = new LTTngContext(this.metadataCustomization, ctfEventStream, traceContext) { // todo: when supporting multiple traces, this timestamp needs to become relative to the earliest timestamp all traces // todo: when supporting multiple traces, this one event number needs to become cumulative across traces, and one specific to the current trace CurrentCpu = cpuId, Timestamp = (long)ctfEvent.Timestamp.NanosecondsFromClockBase,/// - this.baseTimestamp, CurrentEventNumber = this.eventNumber, CurrentEventNumberWithinTrace = this.eventNumber, }; foreach (var callback in this.eventCallbacks) { callback(callbackEvent, callbackContext); } ++this.eventNumber; }
internal PerfContext(PerfMetadataCustomization metadata, ICtfInputStream eventStream, TraceContext traceContext) { this.metadata = metadata; this.eventStream = eventStream; this.traceContext = traceContext; }
internal void PrepareForNewTrace(ICtfInputStream metadataStream) { this.currentMetadata = new LTTngMetadata(); this.metadata.Add(this.currentMetadata); }