Table of Contents

Class PerformanceProfiler

Namespace
DotCompute.Core.Telemetry
Assembly
DotCompute.Core.dll

Advanced performance profiler for detailed kernel analysis, bottleneck identification, and optimization recommendations. Provides deep insights into kernel execution patterns, memory access efficiency, and device utilization.

public sealed class PerformanceProfiler : IPerformanceProfiler, IDisposable
Inheritance
PerformanceProfiler
Implements
Inherited Members
Extension Methods

Constructors

PerformanceProfiler(ILogger<PerformanceProfiler>, IOptions<PerformanceProfilerOptions>)

Initializes a new instance of the PerformanceProfiler class.

public PerformanceProfiler(ILogger<PerformanceProfiler> logger, IOptions<PerformanceProfilerOptions> options)

Parameters

logger ILogger<PerformanceProfiler>

The logger.

options IOptions<PerformanceProfilerOptions>

The options.

Methods

AnalyzeKernelPerformance(string, TimeSpan?)

Analyzes kernel performance characteristics and identifies optimization opportunities.

public KernelAnalysisResult AnalyzeKernelPerformance(string kernelName, TimeSpan? timeWindow = null)

Parameters

kernelName string

Name of the kernel to analyze

timeWindow TimeSpan?

Time window for analysis

Returns

KernelAnalysisResult

Detailed kernel analysis results

AnalyzeMemoryAccessPatterns(TimeSpan?)

Analyzes memory access patterns across all profiled operations.

public MemoryAccessAnalysisResult AnalyzeMemoryAccessPatterns(TimeSpan? timeWindow = null)

Parameters

timeWindow TimeSpan?

Time window for analysis

Returns

MemoryAccessAnalysisResult

Memory access pattern analysis results

CreateProfileAsync(string, ProfileOptions?, CancellationToken)

Creates a comprehensive performance profile for a specific operation or kernel.

public Task<PerformanceProfile> CreateProfileAsync(string correlationId, ProfileOptions? profileOptions = null, CancellationToken cancellationToken = default)

Parameters

correlationId string

Correlation ID for the operation being profiled

profileOptions ProfileOptions

Profiling configuration options

cancellationToken CancellationToken

Cancellation token

Returns

Task<PerformanceProfile>

Detailed performance profile

Dispose()

Performs dispose.

public void Dispose()

FinishProfilingAsync(string, CancellationToken)

Finishes profiling for a correlation ID and generates comprehensive analysis.

public Task<PerformanceProfile> FinishProfilingAsync(string correlationId, CancellationToken cancellationToken = default)

Parameters

correlationId string

Correlation ID of the profile to finish

cancellationToken CancellationToken

Cancellation token

Returns

Task<PerformanceProfile>

Complete performance profile with analysis

GetSystemPerformanceSnapshot()

Gets real-time system performance snapshot for monitoring.

public SystemPerformanceSnapshot GetSystemPerformanceSnapshot()

Returns

SystemPerformanceSnapshot

Current system performance metrics

RecordKernelExecution(string, string, string, KernelExecutionMetrics)

Records kernel execution details for profiling analysis.

public void RecordKernelExecution(string correlationId, string kernelName, string deviceId, KernelExecutionMetrics executionMetrics)

Parameters

correlationId string

Correlation ID of the active profile

kernelName string

Name of the executed kernel

deviceId string

ID of the device that executed the kernel

executionMetrics KernelExecutionMetrics

Detailed execution metrics

RecordMemoryOperation(string, string, string, MemoryOperationMetrics)

Records memory operation details for access pattern analysis.

public void RecordMemoryOperation(string correlationId, string operationType, string deviceId, MemoryOperationMetrics memoryMetrics)

Parameters

correlationId string

Correlation ID of the active profile

operationType string

Type of memory operation

deviceId string

Device performing the operation

memoryMetrics MemoryOperationMetrics

Detailed memory operation metrics