Unusual wakes on CPU

Here is a normal Xcode project. When it runs, there will only be no more than 5 wakes per second on CPU. But when I created a class inherited by MTKView in this project, there would be more than 100 wakes per second on CPU, which may make my device hot.

Besides, I also find many possible ways to create unusual wakes on CPU. But I need more test.

Steps:

  1. Create a new Xcode project using Swift.
  2. Run the project and see the wakes using Xcode, expect less than 5.
  3. Add the following code in the project:
  4. Run the project and see the wakes using Xcode, expect more than 100.
import Foundation
import MetalKit
class MTKPlayerView : MTKView {
    init() {
        let dev = MTLCreateSystemDefaultDevice()!
        super.init(frame: .zero, device: dev)
    }
    required init(coder: NSCoder) {
        super.init(coder: coder)
    }
}

I haven't find any information about this thread named gputools_smt_poll. If you know anything about it you can share with me.

Replies

The gputools_smt_poll thread was surfaced from the Metal Debugger, but this thread is no longer present in the Metal Debugger on Xcode 15 with macOS 14 Sonoma / iOS 17. If you're using an older OS and older version of Xcode, you can try to edit your Scheme and disable GPU Frame Capture and Shader Validation under Options and Diagnostics respectively.