High CPU Usage for low latency USBDriverKit Audio Driver

I'm using USBDriverKit to write an audio driver for a High Speed USB device.

In an attempt to understand the difference between DriverKit Extension and Kernel Extension latencies, I'm dispatching individual isochronous microframes that for this device each account for a duration 125µs, or 6 samples at 48kHz.

I don't yet know what kind of latency I'm actually getting but I was surprised to see a high CPU usage of ~11% on a 512GB M1 mac mini running Big Sur 11.6.

That's 8000 IsochIO() calls and 8000 completion callbacks per second.

Instruments.app tells me that most of my time (60%) is being spent inside mach_msg, as part of a remote procedure call.

Multiple questions occur to me:

  1. is this normal? should I expect lower CPU usage?
  2. isn't mach_msg blocking? shouldn't CPU usage be low?
  3. don't low latency audio folks avoid things like remote procedure calls?
  4. is seeking low latency throughput with USBDriverKit futile?
  5. does Monterey's AudioDriverKit enable lower latency, or is it a convenience API?
  • Can you provide a code example project that can reproduce the problem? I am facing the same problem, but apple is not responding to this issue.

Add a Comment