PortAudio  2.0
Macros | Functions

Functions to assist in measuring the CPU utilization of a callback stream. Used to implement the Pa_GetStreamCpuLoad() function. More...

#include "pa_cpuload.h"
#include <assert.h>
#include "pa_util.h"

Macros

#define LOWPASS_COEFFICIENT_0   (0.9)
 
#define LOWPASS_COEFFICIENT_1   (0.99999 - LOWPASS_COEFFICIENT_0)
 

Functions

void PaUtil_InitializeCpuLoadMeasurer (PaUtilCpuLoadMeasurer *measurer, double sampleRate)
 
void PaUtil_ResetCpuLoadMeasurer (PaUtilCpuLoadMeasurer *measurer)
 
void PaUtil_BeginCpuLoadMeasurement (PaUtilCpuLoadMeasurer *measurer)
 
void PaUtil_EndCpuLoadMeasurement (PaUtilCpuLoadMeasurer *measurer, unsigned long framesProcessed)
 
double PaUtil_GetCpuLoad (PaUtilCpuLoadMeasurer *measurer)
 

Detailed Description

Functions to assist in measuring the CPU utilization of a callback stream. Used to implement the Pa_GetStreamCpuLoad() function.

Todo:
Dynamically calculate the coefficients used to smooth the CPU Load Measurements over time to provide a uniform characterisation of CPU Load independent of rate at which PaUtil_BeginCpuLoadMeasurement / PaUtil_EndCpuLoadMeasurement are called. see http://www.portaudio.com/trac/ticket/113

Macro Definition Documentation

#define LOWPASS_COEFFICIENT_0   (0.9)
#define LOWPASS_COEFFICIENT_1   (0.99999 - LOWPASS_COEFFICIENT_0)

Function Documentation

void PaUtil_BeginCpuLoadMeasurement ( PaUtilCpuLoadMeasurer measurer)
void PaUtil_EndCpuLoadMeasurement ( PaUtilCpuLoadMeasurer measurer,
unsigned long  framesProcessed 
)
double PaUtil_GetCpuLoad ( PaUtilCpuLoadMeasurer measurer)
void PaUtil_InitializeCpuLoadMeasurer ( PaUtilCpuLoadMeasurer measurer,
double  sampleRate 
)
void PaUtil_ResetCpuLoadMeasurer ( PaUtilCpuLoadMeasurer measurer)