getCPUUsage question

Hi FMOD team!
I’m integrating FMOD into our performance collection system. We use Unity, so some questions are in the context of FMOD Unity integration.

  • FMOD_CPU_USAGE return values in “percentage”. Could you give information on how this value is calculated?
  • If FMOD runs on a separate thread, is it a percentage of time that thread was active? Or CPU core load percentage? Or something else?
    For “update” time on mainthread, is it a percentage of Unity frame time? If it’s frame time, how is it calculated? Is it the full distance between two frames or PlayerLoop time?

Our mixer has a predetermined amount of time to complete processing. The are a couple of factors that determine what this amount of time is, but let’s say in general it’s about 10ms.
If we find that it takes 5ms to complete processing, we know that the mixer is using half of the available time to perform processing- this is the percentage value we return in FMOD_CPU_USAGE:

  • 5ms/10ms = 50%
  • 7ms/10ms = 70%
  • 11ms/10ms = 110%

If FMOD is run on a separate thread, it is still the same thing- how long it took the mixer to complete processing with respect to what its processing deadline was.

The Core API that you are calling into is ignorant of Unity, or any other engine for that matter, and only knows what’s happening inside the fmod libraries. This “update” time is how long it took for the call to System::update to complete, with respect to what update’s deadline was. If we have 50ms to perform the update:

  • 25ms/50ms = 50%
  • 35ms/50ms = 70%
  • 55ms/50ms = 110%

You can find more information about performance metrics in the What is the mixer and how is it measured? section of the CPU Performance whitepaper, and related concepts in the Reading a Recorded Session section of our FMOD Studio Profiling documentation.