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
loggerILogger<PerformanceProfiler>The logger.
optionsIOptions<PerformanceProfilerOptions>The options.
Methods
AnalyzeKernelPerformance(string, TimeSpan?)
Analyzes kernel performance characteristics and identifies optimization opportunities.
public KernelAnalysisResult AnalyzeKernelPerformance(string kernelName, TimeSpan? timeWindow = null)
Parameters
Returns
- KernelAnalysisResult
Detailed kernel analysis results
AnalyzeMemoryAccessPatterns(TimeSpan?)
Analyzes memory access patterns across all profiled operations.
public MemoryAccessAnalysisResult AnalyzeMemoryAccessPatterns(TimeSpan? timeWindow = null)
Parameters
timeWindowTimeSpan?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
correlationIdstringCorrelation ID for the operation being profiled
profileOptionsProfileOptionsProfiling configuration options
cancellationTokenCancellationTokenCancellation 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
correlationIdstringCorrelation ID of the profile to finish
cancellationTokenCancellationTokenCancellation 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
correlationIdstringCorrelation ID of the active profile
kernelNamestringName of the executed kernel
deviceIdstringID of the device that executed the kernel
executionMetricsKernelExecutionMetricsDetailed 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
correlationIdstringCorrelation ID of the active profile
operationTypestringType of memory operation
deviceIdstringDevice performing the operation
memoryMetricsMemoryOperationMetricsDetailed memory operation metrics