• 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 19:18:41 -0800

We don't normally use Microseconds, but rather the AudioTime calls - so, we'd get the raw clock ticks and then when we want to do a calculation, convert to nanos.

On Jan 27, 2009, at 5:43 PM, Ethan Funk wrote:

I am interested in the maximum (peak) figure, as drop outs are unacceptable, so max is what matters to the user. I think I will go with the Microseconds approach as long as I can be certain it does not, under any conditions, block so long as the variables I pass it are in memory. If they are allocated on the stack just before I use them, then they would have to be paged in right? I can imagine the OS would ever page out the stack of a thread that has the processor.

I plan to pass the load results from each render cycle through the same peak detect and time-constant-decay algorithm I am using for the peak element of my VU metering.

Thanks for the help everyone!
Ethan...

On Jan 27, 2009, at 6:27 PM, William Stewart wrote:

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: Shawn Erickson <email@hidden>
References: 
 >AU processor load (From: Ethan Funk <email@hidden>)
 >Re: AU processor load (From: tahome izwah <email@hidden>)
 >Re: AU processor load (From: William Stewart <email@hidden>)
 >Re: AU processor load (From: Ethan Funk <email@hidden>)

  • Prev by Date: Re: ExtAudioFileRead and seeking from non-zero
  • Next by Date: 64 Bit AU with GUI question
  • Previous by thread: Re: AU processor load
  • Next by thread: Re: AU processor load
  • Index(es):
    • Date
    • Thread