Table of Contents

Class MetalGraphStatistics

Namespace
DotCompute.Backends.Metal.Execution.Graph.Statistics
Assembly
DotCompute.Backends.Metal.dll

Contains comprehensive statistics and performance metrics for Metal compute graphs.

public class MetalGraphStatistics
Inheritance
MetalGraphStatistics
Inherited Members

Properties

AverageCommandBufferUtilization

Gets or sets the average command buffer utilization percentage.

public double AverageCommandBufferUtilization { get; set; }

Property Value

double

AverageCommandBuffersPerExecution

Gets or sets the average number of command buffers per execution.

public double AverageCommandBuffersPerExecution { get; set; }

Property Value

double

AverageCpuOverheadTimeMs

Gets or sets the average CPU overhead time per execution in milliseconds.

public double AverageCpuOverheadTimeMs { get; set; }

Property Value

double

AverageGpuExecutionTimeMs

Gets or sets the average GPU execution time per execution in milliseconds.

public double AverageGpuExecutionTimeMs { get; set; }

Property Value

double

AverageMemoryBandwidthGBps

Gets or sets the average memory bandwidth utilization in GB/s.

public double AverageMemoryBandwidthGBps { get; set; }

Property Value

double

AverageMemoryTransferred

Gets or sets the average memory transferred per execution in bytes.

public long AverageMemoryTransferred { get; set; }

Property Value

long

AveragePerformanceOpsPerSec

Gets the average performance in operations per second.

[JsonIgnore]
public double AveragePerformanceOpsPerSec { get; }

Property Value

double

BarrierNodeCount

Gets or sets the number of barrier nodes in the graph.

public int BarrierNodeCount { get; set; }

Property Value

int

CommandBufferBatchingsApplied

Gets or sets the number of command buffer batching optimizations applied.

public int CommandBufferBatchingsApplied { get; set; }

Property Value

int

CommandBufferCreationFailures

Gets or sets the total number of command buffer creation failures.

public long CommandBufferCreationFailures { get; set; }

Property Value

long

CreatedAt

Gets or sets the timestamp when the graph was created.

public DateTime CreatedAt { get; set; }

Property Value

DateTime

CriticalPathLength

Gets or sets the critical path length through the graph.

public int CriticalPathLength { get; set; }

Property Value

int

EfficiencyRatio

Gets the efficiency ratio (GPU time / total time).

[JsonIgnore]
public double EfficiencyRatio { get; }

Property Value

double

ErrorFrequency

Gets or sets error frequency statistics.

public Dictionary<string, int> ErrorFrequency { get; }

Property Value

Dictionary<string, int>

EstimatedMemoryFootprint

Gets or sets the estimated memory footprint of the graph in bytes.

public long EstimatedMemoryFootprint { get; set; }

Property Value

long

ExecutionLevels

Gets or sets the number of execution levels in the graph.

public int ExecutionLevels { get; set; }

Property Value

int

FailedExecutions

Gets or sets the number of failed executions.

public long FailedExecutions { get; set; }

Property Value

long

KernelFusionsApplied

Gets or sets the number of kernel fusion optimizations applied.

public int KernelFusionsApplied { get; set; }

Property Value

int

KernelNodeCount

Gets or sets the number of kernel nodes in the graph.

public int KernelNodeCount { get; set; }

Property Value

int

LastExecutedAt

Gets or sets the timestamp of the last execution.

public DateTime? LastExecutedAt { get; set; }

Property Value

DateTime?

LastExecutionTimeMs

Gets or sets the execution time of the last run in milliseconds.

public double LastExecutionTimeMs { get; set; }

Property Value

double

LastSuccessfulExecutionAt

Gets or sets the timestamp of the last successful execution.

public DateTime? LastSuccessfulExecutionAt { get; set; }

Property Value

DateTime?

LastUpdated

Gets or sets the timestamp when statistics were last updated.

public DateTime LastUpdated { get; set; }

Property Value

DateTime

MaxGpuExecutionTimeMs

Gets or sets the maximum GPU execution time recorded in milliseconds.

public double MaxGpuExecutionTimeMs { get; set; }

Property Value

double

MemoryAllocationFailures

Gets or sets the total number of memory allocation failures.

public long MemoryAllocationFailures { get; set; }

Property Value

long

MemoryCoalescingsApplied

Gets or sets the number of memory coalescing optimizations applied.

public int MemoryCoalescingsApplied { get; set; }

Property Value

int

MemoryOperationNodeCount

Gets or sets the number of memory operation nodes in the graph.

public int MemoryOperationNodeCount { get; set; }

Property Value

int

MemoryReductionFactor

Gets or sets the memory reduction factor from optimizations.

public double MemoryReductionFactor { get; set; }

Property Value

double

MinGpuExecutionTimeMs

Gets or sets the minimum GPU execution time recorded in milliseconds.

public double MinGpuExecutionTimeMs { get; set; }

Property Value

double

MostCommonError

Gets or sets the most common error message.

public string? MostCommonError { get; set; }

Property Value

string

Name

Gets or sets the name of the graph these statistics represent.

public string Name { get; set; }

Property Value

string

NodeCount

Gets or sets the total number of nodes in the graph.

public int NodeCount { get; set; }

Property Value

int

NodeExecutionFailures

Gets or sets the total number of node execution failures.

public long NodeExecutionFailures { get; set; }

Property Value

long

OptimizationPasses

Gets or sets the number of optimization passes applied to the graph.

public int OptimizationPasses { get; set; }

Property Value

int

OptimizationSpeedup

Gets or sets the performance improvement factor from optimizations.

public double OptimizationSpeedup { get; set; }

Property Value

double

ParallelismOpportunities

Gets or sets the maximum parallelism opportunities in the graph.

public int ParallelismOpportunities { get; set; }

Property Value

int

ParallelizationEffectiveness

Gets the parallelization effectiveness.

[JsonIgnore]
public double ParallelizationEffectiveness { get; }

Property Value

double

PeakMemoryBandwidthGBps

Gets or sets the peak memory bandwidth utilization in GB/s.

public double PeakMemoryBandwidthGBps { get; set; }

Property Value

double

PeakMemoryUsage

Gets or sets the peak memory usage recorded in bytes.

public long PeakMemoryUsage { get; set; }

Property Value

long

ResourceUtilizationScore

Gets the resource utilization score (0-100).

[JsonIgnore]
public double ResourceUtilizationScore { get; }

Property Value

double

SuccessRate

Gets the success rate as a percentage.

[JsonIgnore]
public double SuccessRate { get; }

Property Value

double

SuccessfulExecutions

Gets or sets the number of successful executions.

public long SuccessfulExecutions { get; set; }

Property Value

long

ThroughputExecutionsPerSec

Gets the throughput in executions per second.

[JsonIgnore]
public double ThroughputExecutionsPerSec { get; }

Property Value

double

TimeoutOccurrences

Gets or sets the total number of timeout occurrences.

public long TimeoutOccurrences { get; set; }

Property Value

long

TotalBlitEncoders

Gets or sets the total number of blit command encoders used.

public long TotalBlitEncoders { get; set; }

Property Value

long

TotalCommandBuffers

Gets or sets the total number of command buffers used across all executions.

public long TotalCommandBuffers { get; set; }

Property Value

long

TotalComputeEncoders

Gets or sets the total number of compute command encoders used.

public long TotalComputeEncoders { get; set; }

Property Value

long

TotalCpuOverheadTimeMs

Gets or sets the total CPU overhead time in milliseconds.

public double TotalCpuOverheadTimeMs { get; set; }

Property Value

double

TotalExecutions

Gets or sets the total number of times the graph has been executed.

public long TotalExecutions { get; set; }

Property Value

long

TotalGpuExecutionTimeMs

Gets or sets the total GPU execution time across all executions in milliseconds.

public double TotalGpuExecutionTimeMs { get; set; }

Property Value

double

TotalMemoryAllocations

Gets or sets the total number of memory allocations performed.

public long TotalMemoryAllocations { get; set; }

Property Value

long

TotalMemoryTransferred

Gets or sets the total memory transferred across all executions in bytes.

public long TotalMemoryTransferred { get; set; }

Property Value

long

Methods

GenerateReport()

Creates a summary report of the statistics.

public string GenerateReport()

Returns

string

A formatted string containing the statistics summary.

RecordError(string, string)

Records an execution error.

public void RecordError(string errorType, string errorMessage)

Parameters

errorType string

The type of error that occurred.

errorMessage string

The error message.

Reset()

Resets all statistics to their initial state.

public void Reset()

UpdateExecutionStatistics(double, double, long, int, bool)

Updates the statistics with execution results.

public void UpdateExecutionStatistics(double executionTimeMs, double cpuOverheadMs, long memoryTransferred, int commandBuffersUsed, bool success)

Parameters

executionTimeMs double

The GPU execution time in milliseconds.

cpuOverheadMs double

The CPU overhead time in milliseconds.

memoryTransferred long

The amount of memory transferred in bytes.

commandBuffersUsed int

The number of command buffers used.

success bool

Whether the execution was successful.

UpdateOptimizationStatistics(int, int, int, double)

Updates optimization statistics.

public void UpdateOptimizationStatistics(int fusionsApplied, int coalescingsApplied, int batchingsApplied, double speedupFactor = 1)

Parameters

fusionsApplied int

Number of kernel fusions applied.

coalescingsApplied int

Number of memory coalescings applied.

batchingsApplied int

Number of command buffer batchings applied.

speedupFactor double

Performance speedup factor achieved.