• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AU processor load
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AU processor load


  • Subject: Re: AU processor load
  • From: William Stewart <email@hidden>
  • Date: Tue, 27 Jan 2009 17:27:40 -0800

For the purposes of a real-time engine, you are most interested in the time it takes before you being rendering until you finish. If your thread gets suspended during that process, well, you'd want to reflect that as it has a direct effect on whether you meet your deadline or not.

So, you can do what tahome recommends below. But a more complete way would be to:

Add a render notify callback to the head of your processing chain - for instance AUHAL if you are using that to attach to the device for I/ O - AudioUnitAddRenderNotify

In the pre-render notification for bus 0, take the current time

In the post-render notification for bus 0, take the current time. tahome's calcs below are fine

You aren't going to display every I/O cycle, so you need to figure out an average - AUGraph publishes two figures, average and max - and we keep both between calls... You probably want to display both, as the max figure really matters ;)

Bill

On Jan 27, 2009, at 9:18 AM, tahome izwah wrote:

Sure, that's easy. On entry of your callback (before doing any DSP) simply do:

	UnsignedWide start, end;
	Microseconds(&start);

------------------------------------------------------------------------------------------

DSP code goes here

------------------------------------------------------------------------------------------

Microseconds(&end);

double microsecondsForDsp = end.lo - start.lo;
double microsecondsForBuffer = 1000000. * inNumberFrames / mSampleRate;


double cpuLoadPercent = 100. * microsecondsForDsp / microsecondsForBuffer;

That's really all you need to do.

Hope this helps,
--th



2009/1/26 Ethan Funk <email@hidden>:
Is there an easy way to track the processor load from with in a AU render
callback? I am NOT using AUGraphs in my application and am instead using
the callbacks to connect AUs, but I still need a way to gauge how much of
the total available processor(s) time I am spending in the render callback
chain so I can report processor load to the user.


Thanks,
Ethan...

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: AU processor load
      • From: Ethan Funk <email@hidden>
References: 
 >AU processor load (From: Ethan Funk <email@hidden>)
 >Re: AU processor load (From: tahome izwah <email@hidden>)

  • Prev by Date: Re: Few sample rate conversion questions
  • Next by Date: Re: Determining Pitch from Microphone
  • Previous by thread: Re: AU processor load
  • Next by thread: Re: AU processor load
  • Index(es):
    • Date
    • Thread