Table of Contents

Class PerformanceMetrics

Namespace
DotCompute.Abstractions.Performance
Assembly
DotCompute.Abstractions.dll

Comprehensive performance metrics collection for DotCompute operations. This is the canonical PerformanceMetrics type used across all projects.

public sealed class PerformanceMetrics
Inheritance
PerformanceMetrics
Inherited Members

Properties

AverageTimeMs

Gets or sets the average execution time in milliseconds.

public double AverageTimeMs { get; set; }

Property Value

double

CacheHitRate

Gets or sets the cache hit rate percentage (0.0 to 100.0).

public double CacheHitRate { get; set; }

Property Value

double

CallCount

Gets or sets the number of times this operation was called.

public int CallCount { get; set; }

Property Value

int

ComputeUtilization

Gets or sets the compute utilization percentage (0.0 to 100.0).

public double ComputeUtilization { get; set; }

Property Value

double

CustomMetrics

Gets or sets additional custom metrics specific to the backend or operation.

public Dictionary<string, object> CustomMetrics { get; }

Property Value

Dictionary<string, object>

ErrorMessage

Gets or sets the error information if the operation failed.

public string? ErrorMessage { get; set; }

Property Value

string

ExecutionTimeMs

Gets or sets the execution time in milliseconds.

public long ExecutionTimeMs { get; set; }

Property Value

long

IsSuccessful

Gets a value indicating whether the operation completed successfully.

public bool IsSuccessful { get; }

Property Value

bool

KernelExecutionTimeMs

Gets or sets the kernel execution time in milliseconds (GPU-specific).

public long KernelExecutionTimeMs { get; set; }

Property Value

long

MaxTimeMs

Gets or sets the maximum execution time in milliseconds.

public double MaxTimeMs { get; set; }

Property Value

double

MemoryTransferTimeMs

Gets or sets the memory transfer time in milliseconds.

public long MemoryTransferTimeMs { get; set; }

Property Value

long

MemoryUsageBytes

Gets or sets the memory usage in bytes.

public long MemoryUsageBytes { get; set; }

Property Value

long

MemoryUtilization

Gets or sets the memory utilization percentage (0.0 to 100.0).

public double MemoryUtilization { get; set; }

Property Value

double

MinTimeMs

Gets or sets the minimum execution time in milliseconds.

public double MinTimeMs { get; set; }

Property Value

double

Operation

Gets or sets the name or description of the operation being measured.

public string Operation { get; set; }

Property Value

string

OperationsPerSecond

Gets or sets the number of operations per second.

public long OperationsPerSecond { get; set; }

Property Value

long

PeakMemoryUsageBytes

Gets or sets the peak memory usage in bytes.

public long PeakMemoryUsageBytes { get; set; }

Property Value

long

StandardDeviation

Gets or sets the standard deviation of execution times.

public double StandardDeviation { get; set; }

Property Value

double

ThroughputGBps

Gets or sets the throughput in gigabytes per second.

public double ThroughputGBps { get; set; }

Property Value

double

Timestamp

Gets or sets the timestamp when these metrics were collected.

public DateTimeOffset Timestamp { get; set; }

Property Value

DateTimeOffset

TotalExecutionTimeMs

Gets or sets the total execution time including all operations.

public long TotalExecutionTimeMs { get; set; }

Property Value

long

TotalFlops

Gets or sets the total floating point operations performed.

public long TotalFlops { get; set; }

Property Value

long

Methods

Aggregate(IEnumerable<PerformanceMetrics>)

Merges multiple performance metrics into a single aggregated result.

public static PerformanceMetrics Aggregate(IEnumerable<PerformanceMetrics> metrics)

Parameters

metrics IEnumerable<PerformanceMetrics>

The metrics to merge.

Returns

PerformanceMetrics

An aggregated PerformanceMetrics instance.

FromStopwatch(Stopwatch, string)

Creates a new PerformanceMetrics instance with basic timing information.

public static PerformanceMetrics FromStopwatch(Stopwatch stopwatch, string operation = "")

Parameters

stopwatch Stopwatch

The stopwatch used to measure execution time.

operation string

The name of the operation.

Returns

PerformanceMetrics

A new PerformanceMetrics instance.

FromTimeSpan(TimeSpan, string)

Creates a new PerformanceMetrics instance with timing information from a TimeSpan.

public static PerformanceMetrics FromTimeSpan(TimeSpan elapsed, string operation = "")

Parameters

elapsed TimeSpan

The elapsed time.

operation string

The name of the operation.

Returns

PerformanceMetrics

A new PerformanceMetrics instance.

ToString()

Returns a string representation of the performance metrics.

public override string ToString()

Returns

string