#nullable enable using System; using System.Diagnostics; namespace ShrinkEventBus { public readonly struct ShrinkEventDiagnostic { internal ShrinkEventDiagnostic(DateTime timestampUtc, Type eventType, ShrinkBusKey busKey, ShrinkBusSchedulerKind scheduler, ShrinkDispatchMode dispatchMode, int threadId, long elapsedTimestampTicks, ShrinkPostResult result, bool isAsync) { TimestampUtc = timestampUtc; EventType = eventType; BusKey = busKey; Scheduler = scheduler; DispatchMode = dispatchMode; ThreadId = threadId; ElapsedTimestampTicks = elapsedTimestampTicks; Result = result; IsAsync = isAsync; } public DateTime TimestampUtc { get; } public Type EventType { get; } public ShrinkBusKey BusKey { get; } public ShrinkBusSchedulerKind Scheduler { get; } public ShrinkDispatchMode DispatchMode { get; } public int ThreadId { get; } public long ElapsedTimestampTicks { get; } public double ElapsedMilliseconds => ElapsedTimestampTicks * 1000d / Stopwatch.Frequency; public TimeSpan Elapsed => TimeSpan.FromSeconds(ElapsedTimestampTicks / (double)Stopwatch.Frequency); public ShrinkPostResult Result { get; } public bool IsAsync { get; } } }