Documentation
¶
Overview ¶
Package gputrace provides parsing and analysis for .gputrace GPU trace files from Metal.
A .gputrace file is a directory bundle containing multiple files that represent Metal GPU capture data. This package provides utilities to parse trace metadata, extract kernel names, labels, and timing information.
The main entry point is the Open function which returns a Trace:
trace, err := gputrace.Open("path/to/trace.gputrace")
if err != nil {
log.Fatal(err)
}
The Trace struct provides access to all parsed data and analysis capabilities.
For command-line usage, see cmd/gputrace which provides various subcommands for analyzing traces, exporting to different formats, and generating insights.
Index ¶
- Constants
- Variables
- type APICallList
- type BufferAccessAnalysis
- type BufferAccessInfo
- type BufferAlias
- type BufferChange
- type BufferDiff
- type BufferLifecycle
- type BufferMetadata
- type BufferSizeInfo
- type BufferTimelineAnalysis
- type BufferTimelineEvent
- type CommandBuffer
- type CommandBufferCalls
- type CommandBufferTiming
- type CommandQueueInfo
- type ComputeEncoder
- type CorrelatedShaderMetrics
- type CounterSamplingConfig
- type CounterSamplingResult
- type CounterSamplingSimulation
- type CountersCSVExporter
- type EncoderAccessInfo
- type EncoderProfile
- type EncoderTiming
- type EncoderTimingInfo
- type FormattedAPICall
- type GPRWCNTRTimestamp
- type InitCall
- type InsightSeverity
- type InsightType
- type InsightsReport
- type KernelStat
- type KernelTiming
- type Metadata
- type PerfCounterStats
- type PerformanceInsight
- type PipelineFunctionMap
- type PipelineStats
- type ProfilerRawTiming
- type RecordType
- type ReplayCommand
- type ReplayEncoderInfo
- type ReplayEngine
- type ReplayPlan
- type ReplayValidation
- type ShaderCorrelationReport
- type ShaderHardwareMetrics
- type ShaderMetrics
- type ShaderMetricsReport
- type ShaderSourceAttribution
- type ShaderSourceMapper
- type SourceLineAttribution
- type Store0Encoder
- type Store0TimingData
- type StreamDataStats
- type TimelineInfo
- type TimingComparison
- type TimingExtractorProfilerRaw
- type TimingMetrics
- type TimingMetricsExtractor
- type TimingStat
- type Trace
- type TraceStatistics
- type XcodeCounterData
- type XcodeEncoderCounters
Constants ¶
const ( RecordTypeCommand = trace.RecordTypeCommand RecordTypeString = trace.RecordTypeString RecordTypeFunction = trace.RecordTypeFunction RecordTypeInteger = trace.RecordTypeInteger RecordTypeUnsignedLong = trace.RecordTypeUnsignedLong )
Re-export constants
const ( MagicMTSP = trace.MagicMTSP MagicXDIC = trace.MagicXDIC MagicBPList = trace.MagicBPList )
Re-export magic constants
const ( InsightBottleneck = analysis.InsightBottleneck InsightOptimization = analysis.InsightOptimization InsightAntiPattern = analysis.InsightAntiPattern InsightInfo = analysis.InsightInfo )
Re-export insight type constants (gputrace-97)
const ( SeverityCritical = analysis.SeverityCritical SeverityHigh = analysis.SeverityHigh SeverityMedium = analysis.SeverityMedium SeverityLow = analysis.SeverityLow SeverityInfo = analysis.SeverityInfo )
Re-export insight severity constants (gputrace-97)
Variables ¶
var ( ErrInvalidTrace = trace.ErrInvalidTrace ErrInvalidMagic = trace.ErrInvalidMagic ErrMissingMetadata = trace.ErrMissingMetadata )
Re-export errors
var ( ExtractTimingData = timing.ExtractTimingData ExtractStore0Timing = timing.ExtractStore0Timing ConvertStore0ToEncoderTimings = timing.ConvertStore0ToEncoderTimings GenerateSyntheticTiming = timing.GenerateSyntheticTiming ExtractShaderMetrics = shader.ExtractShaderMetrics NewShaderSourceMapper = shader.NewShaderSourceMapper FormatShadersSimple = shader.FormatShadersSimple FormatShadersXcodeStyle = shader.FormatShadersXcodeStyle ParseDetailedCommandBuffer = command.ParseDetailedCommandBuffer DumpCommandBuffer = command.DumpCommandBuffer ToPprof = export.ToPprof ToPprofWithSource = export.ToPprofWithSource ToPprofWithSourceLines = export.ToPprofWithSourceLines ToPprofWithMetrics = export.ToPprofWithMetrics ParseXcodeCountersCSV = counter.ParseXcodeCountersCSV ExtractStatistics = analysis.ExtractStatistics NewTimingMetricsExtractor = timing.NewTimingMetricsExtractor ParsePerfCounters = counter.ParsePerfCounters // Buffer access analysis functions (gputrace-93) AnalyzeBufferAccess = analysis.AnalyzeBufferAccess FormatBufferAccessReport = analysis.FormatBufferAccessReport // Buffer timeline functions (gputrace-94) ExtractBufferTimeline = analysis.ExtractBufferTimeline FormatBufferTimelineASCII = analysis.FormatBufferTimelineASCII FormatBufferTimelineSummary = analysis.FormatBufferTimelineSummary // Buffer diff functions (gputrace-95) ExtractBufferSizes = analysis.ExtractBufferSizes CompareBuffers = analysis.CompareBuffers FormatBufferDiff = analysis.FormatBufferDiff // Counter export functions (gputrace-101) NewCountersCSVExporter = counter.NewCountersCSVExporter // Counter sampling functions (gputrace-104) FormatCounterSamplingSimulation = replay.FormatCounterSamplingSimulation FormatCounterSamplingResult = counter.FormatCounterSamplingResult // Replay engine functions (gputrace-103, gputrace-104) NewReplayEngine = replay.NewReplayEngine FormatReplayPlan = replay.FormatReplayPlan FormatReplayValidation = replay.FormatReplayValidation FormatReplayAnalysis = replay.FormatReplayAnalysis // Shader source attribution functions (gputrace-105) ExtractShaderSourceAttribution = shader.ExtractShaderSourceAttribution FormatShaderSourceAttribution = shader.FormatShaderSourceAttribution FormatShaderSourceAttributionHTML = shader.FormatShaderSourceAttributionHTML // Timing metrics functions (gputrace-106) FormatTimingMetrics = timing.FormatTimingMetrics ExportTimingMetricsJSON = timing.ExportTimingMetricsJSON ExportTimingMetricsCSV = timing.ExportTimingMetricsCSV CompareTraces = timing.CompareTraces FormatTimingComparison = timing.FormatTimingComparison // Timing profiler functions (gputrace-107) NewTimingExtractorProfilerRaw = timing.NewTimingExtractorProfilerRaw // Shader export functions (gputrace-98) FormatShaderMetricsReport = shader.FormatShaderMetricsReport ExportShaderMetricsCSV = shader.ExportShaderMetricsCSV ExportShaderMetricsJSON = shader.ExportShaderMetricsJSON // Correlation functions (gputrace-96) CorrelateShaderMetrics = shader.CorrelateShaderMetrics FormatCorrelationReport = shader.FormatCorrelationReport // Insights functions (gputrace-97) GenerateInsights = analysis.GenerateInsights FormatInsightsReport = analysis.FormatInsightsReport )
Re-export functions
Functions ¶
This section is empty.
Types ¶
type BufferAccessAnalysis ¶
type BufferAccessAnalysis = analysis.BufferAccessAnalysis
Buffer access analysis types (gputrace-93)
type BufferAccessInfo ¶
type BufferAccessInfo = analysis.BufferAccessInfo
Re-export main types from internal packages
type BufferAlias ¶
type BufferAlias = analysis.BufferAlias
Re-export main types from internal packages
type BufferChange ¶
type BufferChange = analysis.BufferChange
Re-export main types from internal packages
type BufferLifecycle ¶
type BufferLifecycle = analysis.BufferLifecycle
Re-export main types from internal packages
type BufferMetadata ¶
type BufferMetadata = analysis.BufferMetadata
Re-export main types from internal packages
type BufferTimelineAnalysis ¶
type BufferTimelineAnalysis = analysis.BufferTimelineAnalysis
Buffer timeline types (gputrace-94)
type BufferTimelineEvent ¶
type BufferTimelineEvent = analysis.BufferTimelineEvent
Re-export main types from internal packages
type CommandBuffer ¶
type CommandBuffer = trace.CommandBuffer
Re-export main types from internal packages
type CommandBufferCalls ¶
type CommandBufferCalls = trace.CommandBufferCalls
Re-export main types from internal packages
type CommandBufferTiming ¶
type CommandBufferTiming = timing.CommandBufferTiming
Re-export main types from internal packages
type CommandQueueInfo ¶
type CommandQueueInfo = replay.CommandQueueInfo
Re-export main types from internal packages
type ComputeEncoder ¶
type ComputeEncoder = trace.ComputeEncoder
Re-export main types from internal packages
type CorrelatedShaderMetrics ¶
type CorrelatedShaderMetrics = shader.CorrelatedShaderMetrics
Correlation types (gputrace-96)
type CounterSamplingConfig ¶
type CounterSamplingConfig = counter.CounterSamplingConfig
Counter sampling types (gputrace-104)
type CounterSamplingResult ¶
type CounterSamplingResult = counter.CounterSamplingResult
Re-export main types from internal packages
type CounterSamplingSimulation ¶
type CounterSamplingSimulation = replay.CounterSamplingSimulation
Re-export main types from internal packages
type CountersCSVExporter ¶
type CountersCSVExporter = counter.CountersCSVExporter
Counter export types (gputrace-101)
type EncoderAccessInfo ¶
type EncoderAccessInfo = analysis.EncoderAccessInfo
Re-export main types from internal packages
type EncoderProfile ¶
type EncoderProfile = counter.EncoderProfile
Re-export main types from internal packages
type EncoderTiming ¶
type EncoderTiming = trace.EncoderTiming
Re-export main types from internal packages
type EncoderTimingInfo ¶
type EncoderTimingInfo = counter.EncoderTimingInfo
Encoder timing from profiler data (streamData plist)
func ExtractEncoderTimingsFromProfiler ¶
func ExtractEncoderTimingsFromProfiler(t *Trace) ([]EncoderTimingInfo, int, error)
ExtractEncoderTimingsFromProfiler extracts real timing data from .gpuprofiler_raw streamData. Returns per-encoder timing info, total time in microseconds, and any error.
type FormattedAPICall ¶
type FormattedAPICall = trace.FormattedAPICall
Re-export main types from internal packages
type GPRWCNTRTimestamp ¶
type GPRWCNTRTimestamp = counter.GPRWCNTRTimestamp
Re-export main types from internal packages
type InsightSeverity ¶
type InsightSeverity = analysis.InsightSeverity
Re-export main types from internal packages
type InsightType ¶
type InsightType = analysis.InsightType
Re-export main types from internal packages
type InsightsReport ¶
type InsightsReport = analysis.InsightsReport
Re-export main types from internal packages
type KernelTiming ¶
type KernelTiming = timing.KernelTiming
Re-export main types from internal packages
type PerfCounterStats ¶
type PerfCounterStats = counter.PerfCounterStats
Re-export main types from internal packages
type PerformanceInsight ¶
type PerformanceInsight = analysis.PerformanceInsight
Insights types (gputrace-97)
type PipelineFunctionMap ¶
type PipelineFunctionMap = trace.PipelineFunctionMap
Pipeline function mapping types
type PipelineStats ¶
type PipelineStats = counter.PipelineStats
PipelineStats contains shader compilation statistics from streamData.
type ProfilerRawTiming ¶
type ProfilerRawTiming = timing.ProfilerRawTiming
Re-export main types from internal packages
type ReplayCommand ¶
type ReplayCommand = replay.ReplayCommand
Re-export main types from internal packages
type ReplayEncoderInfo ¶
type ReplayEncoderInfo = replay.ReplayEncoderInfo
Re-export main types from internal packages
type ReplayEngine ¶
type ReplayEngine = replay.ReplayEngine
Replay engine types (gputrace-103, gputrace-104)
type ReplayValidation ¶
type ReplayValidation = replay.ReplayValidation
Re-export main types from internal packages
type ShaderCorrelationReport ¶
type ShaderCorrelationReport = shader.ShaderCorrelationReport
Re-export main types from internal packages
type ShaderHardwareMetrics ¶
type ShaderHardwareMetrics = counter.ShaderHardwareMetrics
Re-export main types from internal packages
type ShaderMetrics ¶
type ShaderMetrics = shader.ShaderMetrics
Re-export main types from internal packages
type ShaderMetricsReport ¶
type ShaderMetricsReport = shader.ShaderMetricsReport
Re-export main types from internal packages
type ShaderSourceAttribution ¶
type ShaderSourceAttribution = shader.ShaderSourceAttribution
Shader source attribution types (gputrace-105)
type ShaderSourceMapper ¶
type ShaderSourceMapper = shader.ShaderSourceMapper
Re-export main types from internal packages
type SourceLineAttribution ¶
type SourceLineAttribution = shader.SourceLineAttribution
Re-export main types from internal packages
type Store0Encoder ¶
type Store0Encoder = timing.Store0Encoder
Re-export main types from internal packages
type Store0TimingData ¶
type Store0TimingData = timing.Store0TimingData
Re-export main types from internal packages
type StreamDataStats ¶
type StreamDataStats = counter.StreamDataStats
StreamDataStats contains all parsed statistics from streamData.
func ExtractPipelineStats ¶
func ExtractPipelineStats(t *Trace) (*StreamDataStats, error)
ExtractPipelineStats extracts pipeline compilation stats from .gpuprofiler_raw streamData. This provides instruction counts, register allocation, and other compilation metrics.
type TimingComparison ¶
type TimingComparison = timing.TimingComparison
Re-export main types from internal packages
type TimingExtractorProfilerRaw ¶
type TimingExtractorProfilerRaw = timing.TimingExtractorProfilerRaw
Timing profiler types (gputrace-107)
type TimingMetricsExtractor ¶
type TimingMetricsExtractor = timing.TimingMetricsExtractor
Re-export main types from internal packages
type TraceStatistics ¶
type TraceStatistics = analysis.TraceStatistics
Re-export main types from internal packages
type XcodeCounterData ¶
type XcodeCounterData = counter.XcodeCounterData
Re-export main types from internal packages
type XcodeEncoderCounters ¶
type XcodeEncoderCounters = counter.XcodeEncoderCounters
Re-export main types from internal packages
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
axperms
command
axperms is a utility to check and manage Accessibility permissions on macOS.
|
axperms is a utility to check and manage Accessibility permissions on macOS. |
|
gputrace
command
Command gputrace provides tools for analyzing and converting GPU trace files.
|
Command gputrace provides tools for analyzing and converting GPU trace files. |
|
gputrace/cmd
Package cmd implements the gputrace CLI commands.
|
Package cmd implements the gputrace CLI commands. |
|
mlxprof
command
|
|
|
examples
|
|
|
source_mapping
command
|
|
|
internal
|
|
|
agxps
Package agxps provides a small adapter over github.com/tmc/apple/private/xcode/gtshaderprofiler.
|
Package agxps provides a small adapter over github.com/tmc/apple/private/xcode/gtshaderprofiler. |
|
buildinfo
Package buildinfo exposes build metadata for release binaries.
|
Package buildinfo exposes build metadata for release binaries. |
|
graph
Package graph provides graph visualization generation for GPU traces.
|
Package graph provides graph visualization generation for GPU traces. |
|
osa
Package osa provides in-process AppleScript execution via CGO.
|
Package osa provides in-process AppleScript execution via CGO. |
|
trace
Package gputrace provides parsing for .gputrace GPU trace files from Metal.
|
Package gputrace provides parsing for .gputrace GPU trace files from Metal. |
|
pkg
|
|
|
axuiautomation
Package axuiautomation is a compatibility shim.
|
Package axuiautomation is a compatibility shim. |
|
axuiautomation/cmd/axperms
command
Command axperms automates granting accessibility permissions.
|
Command axperms automates granting accessibility permissions. |
|
axuiautomation/cmd/axui
command
Command axui is a CLI for macOS accessibility UI automation.
|
Command axui is a CLI for macOS accessibility UI automation. |