Commit 9e33ba0d authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding source management benchmark

parent e5a55862
......@@ -371,3 +371,10 @@ if( ITA_VA_WITH_TESTS OR ITA_VACORE_WITH_TESTS )
set( VACORE_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
endif( )
# benchmarks
if( ITA_VA_WITH_BENCHMARKS OR ITA_VACORE_WITH_BENCHMARKS )
set( VACORE_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks" )
endif( )
cmake_minimum_required( VERSION 2.8 )
project( VACoreBenchmarks )
add_subdirectory( "core" )
cmake_minimum_required( VERSION 2.8 )
project( VACoreBenchmarks )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaBase )
vista_use_package( VACore REQUIRED FIND_DEPENDENCIES )
add_executable( VACoreSourceManagementBenchmark VACoreSourceManagementBenchmark.cpp )
target_link_libraries( VACoreSourceManagementBenchmark ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( VACoreSourceManagementBenchmark )
vista_install( VACoreSourceManagementBenchmark )
vista_create_default_info_file( VACoreSourceManagementBenchmark )
set_property( TARGET VACoreSourceManagementBenchmark PROPERTY FOLDER "VA/Benchmarks/VACore" )
#include <VACore.h>
#include <VACoreEvent.h>
#include <VACoreFactory.h>
#include <VACoreVersion.h>
#include <VAException.h>
#include <iostream>
#include <vector>
#include <VistaBase/VistaTimeUtils.h>
#include <ITAStopWatch.h>
using namespace std;
int main( int, char** )
{
IVACore* pCore = NULL;
try
{
CVAStruct oConfig;
CVAStruct oSectionDebug;
oSectionDebug[ "loglevel" ] = 1;
oConfig[ "debug" ] = oSectionDebug;
CVAStruct oSectionDriver;
oSectionDriver[ "driver" ] = "Portaudio";
oConfig[ "audio driver" ] = oSectionDriver;
CVAStruct oDevice1;
oDevice1[ "type" ] = "HP";
oDevice1[ "channels" ] = "1,2";
oConfig[ "OutputDevice:MyHP" ] = oDevice1;
CVAStruct oOutput1;
oOutput1[ "devices" ] = "MyHP";
oConfig[ "Output:MyDesktopHP" ] = oOutput1;
CVAStruct oReproduction;
oReproduction[ "class" ] = "Talkthrough";
oReproduction[ "outputs" ] = "MyDesktopHP";
oConfig[ "Reproduction:MyTalkthroughHeadphones" ] = oReproduction;
CVAStruct oRenderer;
oRenderer[ "class" ] = "PrototypeDummy";
oRenderer[ "outputs" ] = "MyTalkthroughHeadphones";
oRenderer[ "outputgroup" ] = "MyDesktopHP";
oConfig[ "Renderer:BenchmarkDummyRenderer" ] = oRenderer;
pCore = VACore::CreateCoreInstance( oConfig );
pCore->Initialize();
int iIterations = 100;
int iMaxNumParallelSources = 200;
for( int i = 1; i < iMaxNumParallelSources; i++ )
{
ITAStopWatch swIterations;
for( int j = 0; j < iIterations; j++ )
{
swIterations.start();
std::vector< int > viSourceIDs( i );
for( int k = 0; k < i; k++ )
viSourceIDs[ k ] = pCore->CreateSoundSource( "BenchmarkSoundSource" );
for( int k = 0; k < i; k++ )
pCore->DeleteSoundSource( viSourceIDs[ k ] );
swIterations.stop();
}
cout << "Statistics for " << i << " parallel source: " << swIterations.ToString() << endl;
}
delete pCore;
}
catch( CVAException& e )
{
delete pCore;
cerr << "Error with core " << e.GetErrorCode() << ": " << e << endl;
return 255;
}
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment