Counter Sampling

Retrieve information about how the GPU executed your commands.


Sample Buffers

class MTLCounterSampleBufferDescriptor

A description of how to create a counter sample buffer.

protocol MTLCounterSampleBuffer

An object that stores counter samples.

var MTLCounterDontSample: Int

A value that indicates that you want a sample to be omitted.

Counters and Counter Sets

struct MTLCommonCounter

Names of common counters.

struct MTLCommonCounterSet

Options for specifying commonly used sets of counters.

protocol MTLCounterSet

A set of counters to sample.

protocol MTLCounter

A descriptor for a single counter.

Sample Results

struct MTLCounterResultStageUtilization

The result from sampling a stage-utilization counter set.

struct MTLCounterResultStatistic

The result from sampling a statistics counter set.

struct MTLCounterResultTimestamp

The result from sampling a timestamp counter set.

Error Handling

struct MTLCounterSampleBufferError

Errors returned by Metal for counter sampling errors.

enum MTLCounterSampleBufferError.Code

Constants for error codes returned by Metal for counter sampling errors.

let MTLCounterErrorDomain: String

The error domain for counter errors.

var MTLCounterErrorValue: UInt64

A value in a counter sample indicating that this counter does not contain valid information.

See Also

Command Setup

Setting Up a Command Structure

Discover how Metal executes commands on a GPU.

Preparing Your Metal App to Run in the Background

Prepare your app to move into the background by pausing future GPU use and ensuring previous work is scheduled.

protocol MTLCommandQueue

A queue that organizes command buffers to be executed by a GPU.

protocol MTLCommandBuffer

A container that stores encoded commands for the GPU to execute.

protocol MTLCommandEncoder

An encoder that writes GPU commands into a command buffer.