| | | 1 | | //======================================================================= |
| | | 2 | | // GravitasQuerySummaryDiagnosticView.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2026-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using FixedMathSharp; |
| | | 9 | | |
| | | 10 | | namespace Gravitas.Diagnostics; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Typed read-only view over query reducer quality counters. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct GravitasQuerySummaryDiagnosticView |
| | | 16 | | { |
| | 8 | 17 | | internal GravitasQuerySummaryDiagnosticView(GravitasDiagnosticEvent diagnosticEvent) => Event = diagnosticEvent; |
| | | 18 | | |
| | | 19 | | /// <summary>Gets the underlying diagnostic event.</summary> |
| | | 20 | | public GravitasDiagnosticEvent Event { get; } |
| | | 21 | | |
| | | 22 | | /// <summary>Gets the simulation frame in which the summary was captured.</summary> |
| | 1 | 23 | | public long Frame => Event.Frame; |
| | | 24 | | |
| | | 25 | | /// <summary>Gets the event's sequence within its capture buffer.</summary> |
| | 1 | 26 | | public int Sequence => Event.Sequence; |
| | | 27 | | |
| | | 28 | | /// <summary>Gets the query source dimension.</summary> |
| | 5 | 29 | | public GravitasColliderDimension SourceDimension => Event.ColliderADimension; |
| | | 30 | | |
| | | 31 | | /// <summary>Gets the query target dimension.</summary> |
| | 5 | 32 | | public GravitasColliderDimension TargetDimension => Event.ColliderBDimension; |
| | | 33 | | |
| | | 34 | | /// <summary>Gets the query start point.</summary> |
| | 1 | 35 | | public Vector3d Start => Event.Start; |
| | | 36 | | |
| | | 37 | | /// <summary>Gets the query endpoint.</summary> |
| | 1 | 38 | | public Vector3d End => Event.End; |
| | | 39 | | |
| | | 40 | | /// <summary>Gets the number of exact reducer attempts.</summary> |
| | 5 | 41 | | public int ExactReducerAttempts => Event.DataA; |
| | | 42 | | |
| | | 43 | | /// <summary>Gets the number of accepted hits.</summary> |
| | 5 | 44 | | public int AcceptedHits => Event.DataB; |
| | | 45 | | |
| | | 46 | | /// <summary>Gets the number of conservative fallback hits.</summary> |
| | 11 | 47 | | public int FallbackHits => (int)Event.ScalarA; |
| | | 48 | | |
| | | 49 | | /// <summary>Gets the number of rejected conservative candidates.</summary> |
| | 10 | 50 | | public int RejectedConservativeCandidates => (int)Event.ScalarB; |
| | | 51 | | |
| | | 52 | | /// <summary>Gets whether conservative fallback affected the query.</summary> |
| | 6 | 53 | | public bool HasConservativeFallback => FallbackHits > 0 || RejectedConservativeCandidates > 0; |
| | | 54 | | } |