Re: Using getrusage function in a CoreAudio callback
Re: Using getrusage function in a CoreAudio callback
- Subject: Re: Using getrusage function in a CoreAudio callback
- From: Stephane Letz <email@hidden>
- Date: Thu, 27 Mar 2003 10:05:37 +0100
>
Message: 5
>
Date: Wed, 26 Mar 2003 11:23:01 -0800
>
Subject: Re: Using getrusage function in a CoreAudio callback
>
From: Jeff Moore <email@hidden>
>
To: email@hidden
>
>
I don't know too much about getrusage or how it's implemented. From
>
reading the man page, I would guess that it does sysctl or ioctl call
>
or possibly uses a mach message, probably including waiting for a
>
reply, directly. All these mechanisms involve system locks and other
>
things that can block. So, I would expect that calling getrusage from
>
inside an IOProc would interfere with the timing.
>
>
When I do profiling of the IO thread, I just use the host time clock as
>
follows:
>
>
OSStatus MyIOProc(...)
>
{
>
UInt64 theStartTime = AudioGetCurrentHostTime();
>
>
do the work;
>
>
UInt64 theEndTime = AudioGetCurrentHostTime();
>
>
log the performance metrics to a safe place so another thread can
>
write them out;
>
}
>
But what happens if other real-time applications are running at the same
time? The IOProc may be interrupted and AudioGetCurrentHostTime will not
only reflect time consumed in the measured code. The problem is to measure
the CPU consumed *only* for MyIOProc.
Stephane Letz
Grame: Centre National de creation musicale
9, Rue du Garet
69001 Lyon
Tel: 04-72-07-37-00
Fax: 04-72-07-37-01
Web: www.grame.fr
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.