From e23e8761e2ceef393c7a5f245ea389264b27a0ff Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 19 May 2004 00:57:39 +0000 Subject: [PATCH] (untested) measure IOProc time --- stepmania/src/arch/Sound/RageSoundDriver_CA.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp index 2ae6337181..a872d64df2 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp @@ -3,6 +3,7 @@ #include "RageSoundDriver_CA.h" #include "CAHelpers.h" #include "RageLog.h" +#include "RageTimer.h" #include "CAAudioHardwareSystem.h" #include "CAAudioHardwareDevice.h" @@ -16,6 +17,10 @@ static AudioConverter *gConverter; +/* temporary hack: */ +static float g_fIOProcTime = 0; +static float g_iIOProcTimeSamples = 0; + static CString FormatToString( int fmt ) { char c[4]; @@ -219,6 +224,9 @@ RageSound_CA::~RageSound_CA() mOutputDevice->StopIOProc(GetData); delete gConverter; delete mOutputDevice; + + LOG->Info( "IOProc time: %f in %i calls, %f per call", + g_fIOProcTime, g_iIOProcTimeSamples, g_fIOProcTime/g_iIOProcTimeSamples ); } int64_t RageSound_CA::GetPosition(const RageSoundBase *sound) const @@ -243,6 +251,8 @@ OSStatus RageSound_CA::GetData(AudioDeviceID inDevice, const AudioTimeStamp *inOutputTime, void *inClientData) { + RageTimer tm; + RageSound_CA *This = (RageSound_CA *)inClientData; UInt32 dataPackets = outOutputData->mBuffers[0].mDataByteSize; @@ -250,7 +260,11 @@ OSStatus RageSound_CA::GetData(AudioDeviceID inDevice, This->mDecodePos = int64_t(inOutputTime->mSampleTime); gConverter->FillComplexBuffer(dataPackets, *outOutputData, NULL); - return noErr; + + g_fIOProcTime += tm.GetDeltaTime(); + ++g_iIOProcTimeSamples; + + return noErr; } OSStatus RageSound_CA::OverloadListener(AudioDeviceID inDevice,