Documentation
¶
Overview ¶
Package telemetry provides diagnostic and performance measurement types for the Apple Neural Engine.
Telemetry fields may return zeros on production hardware. Many ANE performance counters and diagnostic selectors are gated by ANEDevicePropertyIsInternalBuild in the IOKit registry. Each struct field has a Known bool that distinguishes "unavailable" from "zero": if Known is false, the underlying selector was not available.
Use [EvalWithStats] to collect hardware execution time and performance counters after evaluation. Use [ProbeDiagnostics] to inspect model queue depth, program state, and async request counts. Use [ProbeClientInfo], [ProbeCacheInfo], and [Snapshot] to capture the host environment.
All telemetry types have an Available method that reports whether any data was collected, and a ReportMetrics method that emits available data to a testing.B-compatible reporter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PerfCounterPlaceholder ¶
func PerfCounterPlaceholder() string
PerfCounterPlaceholder returns the firmware placeholder sentinel string.
func SanitizeMetricName ¶
SanitizeMetricName normalizes a raw firmware counter name into a stable, parseable metric name suitable for benchmark output. It lowercases the input, replaces non-alphanumeric characters with hyphens, collapses runs of hyphens, and trims leading/trailing hyphens.
Types ¶
type ClientInfo ¶
type ClientInfo struct {
NumANEs uint32
NumANEsKnown bool
NumCores uint32
NumCoresKnown bool
ArchitectureStr string
ArchitectureStrKnown bool
BoardType int64
BoardTypeKnown bool
CapabilityMask uint64
CapabilityMaskKnown bool
DataInterfaceVersion uint64
DataInterfaceVersionKnown bool
PrecompiledBinarySupported bool
PrecompiledBinarySupportedKnown bool
}
ClientInfo describes the ANE client connection capabilities.
func (ClientInfo) Available ¶
func (ci ClientInfo) Available() bool
Available reports whether any Known field is true.
type Diagnostics ¶
type Diagnostics struct {
ModelQueueDepth int
ModelQueueDepthKnown bool
ProgramClass string
ProgramClassKnown bool
AsyncRequestsInFlight int64
AsyncRequestsInFlightKnown bool
ProgramQueueDepth int
ProgramQueueDepthKnown bool
ProgramHandle uint64
ProgramHandleKnown bool
ModelState uint64
ModelStateKnown bool
}
Diagnostics contains best-effort runtime diagnostic information about a kernel.
func (Diagnostics) Available ¶
func (d Diagnostics) Available() bool
Available reports whether any diagnostic field was probed.
func (Diagnostics) ReportMetrics ¶
func (d Diagnostics) ReportMetrics(b interface{ ReportMetric(float64, string) })
ReportMetrics reports diagnostic state to a testing.B-compatible reporter.
func (Diagnostics) String ¶
func (d Diagnostics) String() string
String returns a compact human-readable summary of the diagnostics.
type EvalStats ¶
type EvalStats struct {
HWExecutionNS uint64 // hardware execution time in nanoseconds
PerfCounterData []byte // raw bytes from perfStats.PerfCounterData()
RawStatsData []byte // raw bytes from perfStats.PStatsRawData()
PerfCounters []PerfCounter // parsed named counters
PerfCountersTruncated bool // true if counter list was capped
PerfStatsEntries int // number of entries in the PerfStatsArray (one per procedure)
}
EvalStats contains hardware performance statistics from an evaluation.
func (EvalStats) ReportMetrics ¶
ReportMetrics reports evaluation statistics to a testing.B-compatible reporter.
type EvalTelemetry ¶
type EvalTelemetry struct {
Stats EvalStats
Diagnostics Diagnostics
Timing EventTiming // zero unless set by caller after shared-event eval
}
EvalTelemetry bundles post-evaluation telemetry from a kernel.
func (EvalTelemetry) Available ¶
func (t EvalTelemetry) Available() bool
Available reports whether any telemetry component has data.
func (EvalTelemetry) ReportMetrics ¶
func (t EvalTelemetry) ReportMetrics(b interface{ ReportMetric(float64, string) })
ReportMetrics reports all available telemetry to a testing.B-compatible reporter.
func (EvalTelemetry) String ¶
func (t EvalTelemetry) String() string
String returns a compact human-readable summary of the telemetry bundle.
type EventTiming ¶
type EventTiming struct {
EnqueueNS int64 // CPU wall-clock cost to submit the evaluation
TotalNS int64 // same as EnqueueNS for synchronous evals
}
EventTiming contains timing measurements from a shared event evaluation.
func (EventTiming) Available ¶
func (t EventTiming) Available() bool
Available reports whether timing data was collected.
func (EventTiming) ReportMetrics ¶
func (t EventTiming) ReportMetrics(b interface{ ReportMetric(float64, string) })
ReportMetrics reports event timing to a testing.B-compatible reporter.
func (EventTiming) String ¶
func (t EventTiming) String() string
String returns a compact human-readable summary of the timing.
type PerfCounter ¶
PerfCounter represents a named hardware performance counter from an evaluation.
type RuntimeSnapshot ¶
type RuntimeSnapshot struct {
Device ane.DeviceInfo
Client ClientInfo
Cache CacheInfo
}
RuntimeSnapshot captures the host and ANE environment at a point in time.
func (RuntimeSnapshot) Available ¶
func (s RuntimeSnapshot) Available() bool
Available reports whether any component snapshot has data.
func (RuntimeSnapshot) ReportMetrics ¶
func (s RuntimeSnapshot) ReportMetrics(b interface{ ReportMetric(float64, string) })
ReportMetrics reports the runtime environment to a testing.B-compatible reporter.
func (RuntimeSnapshot) String ¶
func (s RuntimeSnapshot) String() string
String returns a compact human-readable summary of the runtime snapshot.