This commit is contained in:
2026-06-15 18:18:16 +08:00
parent 97c9fba14e
commit 2b9f134e5f
4164 changed files with 386922 additions and 79 deletions

View File

@@ -0,0 +1,39 @@
using System;
namespace Best.HTTP.Request.Timings
{
public enum TimingEvents
{
StartNext,
Finish
}
public readonly struct TimingEventInfo
{
public readonly HTTPRequest SourceRequest;
public readonly TimingEvents Event;
public readonly string Name;
public readonly DateTime Time;
public TimingEventInfo(HTTPRequest parentRequest, TimingEvents timingEvent)
{
this.SourceRequest = parentRequest;
this.Event = timingEvent;
this.Name = null;
this.Time = DateTime.UtcNow;
}
public TimingEventInfo(HTTPRequest parentRequest, TimingEvents timingEvent, string eventName)
{
this.SourceRequest = parentRequest;
this.Event = timingEvent;
this.Name = eventName;
this.Time = DateTime.UtcNow;
}
public override string ToString() => $"[{Event} \"{Name}\", Time: \"{Time.ToString("hh:mm:ss.fffffff")}\", Source: {SourceRequest.Context.Hash}]";
}
}