< Summary

Information
Class: InferenceEngine.Core.Diagnostics.InferenceEngineInfo
Assembly: InferenceEngine.Core
File(s): /home/runner/work/inference-engine-lib/inference-engine-lib/InferenceEngine.Core/Diagnostics/InferenceEngineInfo.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 55
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Provider()100%11100%
get_Platform()100%11100%
get_DeviceId()100%11100%
get_GpuAccelerationRequested()100%11100%
get_ModelName()100%11100%
get_ModelPath()100%11100%
get_ModelSource()100%11100%
get_IsFallback()100%11100%
get_FallbackReason()100%11100%
get_ProviderOptions()100%11100%
.ctor()100%11100%
get_OnnxRuntimeVersion()100%11100%
get_SessionCreatedAt()100%11100%
get_Checks()100%11100%
get_Empty()100%11100%

File(s)

/home/runner/work/inference-engine-lib/inference-engine-lib/InferenceEngine.Core/Diagnostics/InferenceEngineInfo.cs

#LineLine coverage
 1using System.Collections.Immutable;
 2
 3namespace InferenceEngine.Core.Diagnostics;
 4
 5/// <summary>How the engine resolved the model it loaded.</summary>
 6public enum ModelSource
 7{
 8    /// <summary>Not reported (engine not loaded, or an older engine version).</summary>
 9    Unspecified = 0,
 10
 11    /// <summary>The consumer supplied the location explicitly
 12    /// (<see cref="InferenceEngineOptions.ModelPath"/> or a custom <c>ModelProvider</c>).</summary>
 13    ExplicitPath,
 14
 15    /// <summary>The engine's default registry/provider resolved it (downloading to the model
 16    /// cache on first use) — i.e. the consumer did not pin a location.</summary>
 17    RegistryManaged,
 18}
 19
 20/// <summary>Immutable snapshot of a loaded inference engine's provider, platform, and diagnostic trail.</summary>
 21public sealed record InferenceEngineInfo
 22{
 18923    public InferenceProvider Provider { get; init; } = InferenceProvider.Unknown;
 20224    public HostPlatform Platform { get; init; } = HostPlatformDetector.Current();
 9025    public int DeviceId { get; init; }
 9026    public bool GpuAccelerationRequested { get; init; }
 27
 28    /// <summary>Model file name the engine loaded (e.g. "yolov8n-face.onnx"). Empty until loaded.</summary>
 23329    public string ModelName { get; init; } = string.Empty;
 30
 31    /// <summary>Absolute path the model was actually loaded from (consumer-supplied asset path or
 32    /// the registry's cache location). Empty until loaded.</summary>
 23333    public string ModelPath { get; init; } = string.Empty;
 34
 35    /// <summary>How <see cref="ModelPath"/> was determined.</summary>
 12136    public ModelSource ModelSource { get; init; } = ModelSource.Unspecified;
 37
 38    /// <summary>True when a fall-back occurred (FallbackReason != None).</summary>
 18039    public bool IsFallback { get; init; }
 13540    public InferenceFallbackReason FallbackReason { get; init; } = InferenceFallbackReason.None;
 41
 42    /// <summary>Per-provider key/value options actually applied.</summary>
 9343    public IReadOnlyDictionary<string, string> ProviderOptions { get; init; }
 11344        = ImmutableDictionary<string, string>.Empty;
 45
 46    /// <summary>Not populated in v1; always <see cref="string.Empty"/>.</summary>
 15147    public string OnnxRuntimeVersion { get; init; } = string.Empty;
 48
 20349    public DateTimeOffset SessionCreatedAt { get; init; } = DateTimeOffset.UtcNow;
 50
 51    /// <summary>Ordered diagnostic trail of every check performed during provider selection.</summary>
 29652    public IReadOnlyList<ProviderDiagnosticCheck> Checks { get; init; } = Array.Empty<ProviderDiagnosticCheck>();
 53
 18654    public static InferenceEngineInfo Empty { get; } = new();
 55}