diff --git a/libs/ardour/run-profiling.sh b/libs/ardour/run-profiling.sh index f490080446..30daac9e6e 100644 --- a/libs/ardour/run-profiling.sh +++ b/libs/ardour/run-profiling.sh @@ -8,6 +8,11 @@ if [ ! -f './tempo.cc' ]; then exit 1; fi +if [ "$1" == "" ]; then + echo "Syntax: run-profiling.sh [flag] []" + exit 1; +fi + cd ../.. top=`pwd` cd build @@ -23,15 +28,23 @@ export ARDOUR_MCP_PATH="../mcp" export ARDOUR_DLL_PATH=$libs export ARDOUR_DATA_PATH=$top/gtk2_ardour:$top/build/gtk2_ardour:. -# export LD_PRELOAD=/home/carl/src/libfakejack/libjack.so -session='32tracks' +export LD_PRELOAD=/home/carl/src/libfakejack/libjack.so +# session='32tracks' -if [ "$1" == "--debug" ]; then - gdb --args ./libs/ardour/run-profiling $session -elif [ "$1" == "--valgrind" ]; then - valgrind ./libs/ardour/run-profiling $session -elif [ "$1" == "--callgrind" ]; then - valgrind --tool=callgrind ./libs/ardour/run-profiling $session -else - ./libs/ardour/run-profiling $session +p=$1 +if [ "$p" == "--debug" -o "$p" == "--valgrind" -o "$p" == "--callgrind" ]; then + f=$p + p=$2 + shift 1 +fi +shift 1 + +if [ "$f" == "--debug" ]; then + gdb --args ./libs/ardour/$p $* +elif [ "$f" == "--valgrind" ]; then + valgrind ./libs/ardour/$p $* +elif [ "$f" == "--callgrind" ]; then + valgrind --tool=callgrind ./libs/ardour/$p $* +else + ./libs/ardour/$p $* fi diff --git a/libs/ardour/test/profiling/lots_of_regions.cc b/libs/ardour/test/profiling/lots_of_regions.cc new file mode 100644 index 0000000000..51166265bf --- /dev/null +++ b/libs/ardour/test/profiling/lots_of_regions.cc @@ -0,0 +1,47 @@ +#include "test_util.h" +#include "ardour/ardour.h" +#include "ardour/midi_track.h" +#include "ardour/midi_region.h" +#include "ardour/session.h" +#include "ardour/playlist.h" +#include "pbd/stateful_diff_command.h" + +using namespace std; +using namespace ARDOUR; +using namespace PBD; + +int +main (int argc, char* argv[]) +{ + ARDOUR::init (false, true); + Session* session = load_session ("../libs/ardour/test/profiling/sessions/1region", "1region.ardour"); + + /* Find the track */ + boost::shared_ptr track = boost::dynamic_pointer_cast (session->get_routes()->back()); + assert (track); + + /* And the playlist */ + boost::shared_ptr playlist = track->playlist (); + assert (playlist); + + /* And the region */ + boost::shared_ptr region = boost::dynamic_pointer_cast (playlist->region_list().rlist().front()); + assert (region); + + /* Duplicate it a lot */ + session->begin_reversible_command ("foo"); + playlist->clear_changes (); + playlist->duplicate (region, region->last_frame(), 1000); + session->add_command (new StatefulDiffCommand (playlist)); + session->commit_reversible_command (); + + /* Undo that */ + session->undo (1); + + /* And do it again */ + session->begin_reversible_command ("foo"); + playlist->clear_changes (); + playlist->duplicate (region, region->last_frame(), 1000); + session->add_command (new StatefulDiffCommand (playlist)); + session->commit_reversible_command (); +} diff --git a/libs/ardour/test/profiling/sessions/1region/1region.ardour b/libs/ardour/test/profiling/sessions/1region/1region.ardour new file mode 100644 index 0000000000..b846225009 --- /dev/null +++ b/libs/ardour/test/profiling/sessions/1region/1region.ardour @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/ardour/test/profiling/sessions/1region/1region.ardour.bak b/libs/ardour/test/profiling/sessions/1region/1region.ardour.bak new file mode 100644 index 0000000000..ff17374272 --- /dev/null +++ b/libs/ardour/test/profiling/sessions/1region/1region.ardour.bak @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/ardour/test/profiling/sessions/1region/1region.history b/libs/ardour/test/profiling/sessions/1region/1region.history new file mode 100644 index 0000000000..d836783943 --- /dev/null +++ b/libs/ardour/test/profiling/sessions/1region/1region.history @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/ardour/test/profiling/sessions/1region/1region.history.bak b/libs/ardour/test/profiling/sessions/1region/1region.history.bak new file mode 100644 index 0000000000..6dd2506a89 --- /dev/null +++ b/libs/ardour/test/profiling/sessions/1region/1region.history.bak @@ -0,0 +1,2 @@ + + diff --git a/libs/ardour/test/profiling/sessions/1region/instant.xml b/libs/ardour/test/profiling/sessions/1region/instant.xml new file mode 100644 index 0000000000..6ee1811962 --- /dev/null +++ b/libs/ardour/test/profiling/sessions/1region/instant.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/libs/ardour/test/test_util.h b/libs/ardour/test/test_util.h index 4ee33b3dd6..436580d6cb 100644 --- a/libs/ardour/test/test_util.h +++ b/libs/ardour/test/test_util.h @@ -1,3 +1,7 @@ +#include + +class XMLNode; + namespace ARDOUR { class Session; } diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 9d135392f6..89efbdab49 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -475,37 +475,39 @@ def build(bld): testobj.source += [ 'sse_functions_64bit.s' ] # Profiling - profilingobj = bld(features = 'cxx cxxprogram') - profilingobj.source = ''' - test/dummy_lxvst.cc - test/test_util.cc - test/profiling/runpc.cc - '''.split() + for p in ['runpc', 'lots_of_regions']: + profilingobj = bld(features = 'cxx cxxprogram') + profilingobj.source = ''' + test/dummy_lxvst.cc + test/test_util.cc + '''.split() - profilingobj.includes = obj.includes - profilingobj.includes.append ('test') - profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', + profilingobj.source.append('test/profiling/%s.cc' % p) + + profilingobj.includes = obj.includes + profilingobj.includes.append ('test') + profilingobj.uselib = ['CPPUNIT','SIGCPP','JACK','GLIBMM','GTHREAD', 'SAMPLERATE','XML','LRDF','COREAUDIO'] - profilingobj.use = ['libpbd','libmidipp','libardour'] - profilingobj.name = 'libardour-profiling' - profilingobj.target = 'run-profiling' - profilingobj.install_path = '' - profilingobj.defines = [ - 'PACKAGE="libardour3profile"', - 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"', - 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', - 'LOCALEDIR="' + os.path.join( - os.path.normpath(bld.env['DATADIR']), 'locale') + '"', - 'VAMP_DIR="' + os.path.join( - os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"' - ] - if bld.env['FPU_OPTIMIZATION']: - profilingobj.source += [ 'sse_functions_xmm.cc' ] - if (bld.env['build_target'] == 'i386' - or bld.env['build_target'] == 'i686'): - profilingobj.source += [ 'sse_functions.s' ] - elif bld.env['build_target'] == 'x86_64': - profilingobj.source += [ 'sse_functions_64bit.s' ] + profilingobj.use = ['libpbd','libmidipp','libardour'] + profilingobj.name = 'libardour-profiling' + profilingobj.target = p + profilingobj.install_path = '' + profilingobj.defines = [ + 'PACKAGE="libardour3profile"', + 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"', + 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', + 'LOCALEDIR="' + os.path.join( + os.path.normpath(bld.env['DATADIR']), 'locale') + '"', + 'VAMP_DIR="' + os.path.join( + os.path.normpath(bld.env['LIBDIR']), 'ardour3', 'vamp') + '"' + ] + if bld.env['FPU_OPTIMIZATION']: + profilingobj.source += [ 'sse_functions_xmm.cc' ] + if (bld.env['build_target'] == 'i386' + or bld.env['build_target'] == 'i686'): + profilingobj.source += [ 'sse_functions.s' ] + elif bld.env['build_target'] == 'x86_64': + profilingobj.source += [ 'sse_functions_64bit.s' ] def shutdown(): autowaf.shutdown()