<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/size(ofCounterHeapEntry:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLDevice(im)sizeOfCounterHeapEntry:"
  },
  "title" : "size(ofCounterHeapEntry:)"
}
-->

# size(ofCounterHeapEntry:)

Returns the size, in bytes, of each entry in a counter heap of a specific counter heap type when
your app resolves it into a usable format.

```
func size(ofCounterHeapEntry type: MTL4CounterHeapType) -> Int
```

## Parameters

`type`

[`MTL4CounterHeapType`](/documentation/Metal/MTL4CounterHeapType) value that represents the type of the [`MTL4CounterHeap`](/documentation/Metal/MTL4CounterHeap) to resolve.

## Return Value

The size of the post-transformation entry from a [`MTL4CounterHeap`](/documentation/Metal/MTL4CounterHeap) of type [`MTL4CounterHeapType`](/documentation/Metal/MTL4CounterHeapType).

## Discussion

In order to use the data available in a [`MTL4CounterHeap`](/documentation/Metal/MTL4CounterHeap), your app first resolves it either in the CPU timeline
or in the GPU timeline. When your app calls [`resolveCounterHeap:withRange:intoBuffer:waitFence:updateFence:`](/documentation/Metal/MTL4CommandBuffer/resolveCounterHeap:withRange:intoBuffer:waitFence:updateFence:)
to resolve counter data in the GPU timeline, Metal writes the data into a [`MTLBuffer`](/documentation/Metal/MTLBuffer).

During this process, Metal transform the data in the heap into a format consisting of entries of the size
that this method advertises, based on the [`MTL4CounterHeapType`](/documentation/Metal/MTL4CounterHeapType).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)