• 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: ioproc thread priority
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ioproc thread priority


  • Subject: Re: ioproc thread priority
  • From: Jeff Moore <email@hidden>
  • Date: Fri, 25 Sep 2009 12:15:15 -0700


On Sep 25, 2009, at 10:31 AM, email@hidden wrote:

I need to do quite a bit of processing in the ioproc due to low
latency requirements.  I have been experiencing dropouts with cpu
loads as low as 40%.

As an experiment, I sent the audio data coming in to the ioproc to
another process, via udp processed the data, then sent the data back,
all in one cycle of the ioproc.  The result is stunning, I was able to
add much more processing and did not experience dropouts till 100% cpu
usage.

Interesting. You don't describe exactly what you are measuring when you say things like "cpu loads as low as 40%". For example, tools like top are terrible ways to track how close to the deadline you are getting in your IOProc. The main reason why is that these tools just show averages that can hide minute CPU spikes and what not. Tools based on sampling, like Shark, have different issues as you try to look at the sorts of durations that go on with audio IO.


One good tool you can use is the IO cycle telemetry window in HALLab (in /Developer/Applications/Audio). This allows you to target your application and get a detailed break-down of what's going on in the IO thread including things like the scheduling latency, the time spent in the IOProc and the general reason for an overload. Lately, I have also been using dtrace to do detailed function level profiling in my code.

At any rate, my first reaction is to be skeptical. One thing to consider is that another possible reason you get occasional overloads at lower CPU utilizations is that you might be having CPU spikes or hitting locks, etc. To be honest, these are among the top reasons I've seen for the behavior you are describing. Quite often, worse case scenarios like this don't show up in CPU load measurements.

My second reaction is to give you the benefit of the doubt and let you explain your claims in more detail.

Using pthread api, it seems that the ioproc thread sched is
SCHED_OTHER and the priority is 31, with the minimum 15 and the max
47.   I set the schedule of my processing thread to SCHED_FIFO and
priority the max at 47.

It seems that the ioproc's thread priority is wimpy.   Am I being
deluded somehow here?

The pthread scheduling parameters aren't really the final word on actual scheduling parameters. You need to use the mach API for that (an example of which you can see in the CAPThread class in the PublicUtility code in /Developer/Extras/CoreAudio). By doing so, you'd find that the IO thread is actually a time constraint thread.


--

Jeff Moore
Core Audio
Apple



_______________________________________________
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


References: 
 >ioproc thread priority (From: email@hidden)

  • Prev by Date: playback on simulator vs. on device
  • Next by Date: Re: playback on simulator vs. on device
  • Previous by thread: ioproc thread priority
  • Next by thread: playback on simulator vs. on device
  • Index(es):
    • Date
    • Thread