Basic process thread profiling code.

git-svn-id: svn://localhost/ardour2/branches/3.0@11310 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-01-23 15:01:08 +00:00
parent 61c57e7c4d
commit 62304d57c6
5 changed files with 274 additions and 0 deletions

View File

@ -0,0 +1,30 @@
#!/bin/bash
#
# Run libardour profiling tests.
#
if [ ! -f './tempo.cc' ]; then
echo "This script must be run from within the libs/ardour directory";
exit 1;
fi
srcdir=`pwd`
cd ../../build
libs='libs'
export LD_LIBRARY_PATH=$libs/audiographer:$libs/vamp-sdk:$libs/surfaces:$libs/surfaces/control_protocol:$libs/ardour:$libs/midi++2:$libs/pbd:$libs/rubberband:$libs/soundtouch:$libs/gtkmm2ext:$libs/appleutility:$libs/taglib:$libs/evoral:$libs/evoral/src/libsmf:$libs/timecode:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
export ARDOUR_PANNER_PATH=$libs/panners/2in2out:$libs/panners/1in2out:$libs/panners/vbap
export LD_PRELOAD=/home/carl/src/libfakejack/libjack.so
if [ "$1" == "--debug" ]; then
gdb ./libs/ardour/run-profiling
elif [ "$1" == "--valgrind" ]; then
valgrind ./libs/ardour/run-profiling
elif [ "$1" == "--callgrind" ]; then
valgrind --tool=callgrind ./libs/ardour/run-profiling
else
./libs/ardour/run-profiling $*
fi

View File

@ -0,0 +1,77 @@
#include <iostream>
#include "midi++/manager.h"
#include "pbd/textreceiver.h"
#include "pbd/compose.h"
#include "pbd/enumwriter.h"
#include "ardour/session.h"
#include "ardour/audioengine.h"
using namespace std;
using namespace PBD;
using namespace ARDOUR;
class TestReceiver : public Receiver
{
protected:
void receive (Transmitter::Channel chn, const char * str) {
const char *prefix = "";
switch (chn) {
case Transmitter::Error:
prefix = ": [ERROR]: ";
break;
case Transmitter::Info:
/* ignore */
return;
case Transmitter::Warning:
prefix = ": [WARNING]: ";
break;
case Transmitter::Fatal:
prefix = ": [FATAL]: ";
break;
case Transmitter::Throw:
/* this isn't supposed to happen */
abort ();
}
/* note: iostreams are already thread-safe: no external
lock required.
*/
cout << prefix << str << endl;
if (chn == Transmitter::Fatal) {
exit (9);
}
}
};
TestReceiver test_receiver;
int
main ()
{
string const test_session_path = "../libs/ardour/test/profiling/sessions/0tracks";
string const test_session_snapshot = "0tracks.ardour";
init (false, true);
SessionEvent::create_per_thread_pool ("test", 512);
test_receiver.listen_to (error);
test_receiver.listen_to (info);
test_receiver.listen_to (fatal);
test_receiver.listen_to (warning);
AudioEngine* engine = new AudioEngine ("test", "");
engine->start ();
MIDI::Manager::create (engine->jack ());
Session* session = new Session (*engine, test_session_path, test_session_snapshot);
engine->set_session (session);
for (int i = 0; i < 32768; ++i) {
session->process (64);
}
return 0;
}

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<Session version="3.0.0" name="3-0tracks" sample-rate="48000" id-counter="83" event-counter="0">
<Config>
<Option name="xfade-model" value="FullCrossfade"/>
<Option name="auto-xfade" value="1"/>
<Option name="short-xfade-seconds" value="0.015"/>
<Option name="xfades-active" value="1"/>
<Option name="xfades-visible" value="1"/>
<Option name="destructive-xfade-msecs" value="2"/>
<Option name="use-region-fades" value="1"/>
<Option name="show-region-fades" value="1"/>
<Option name="native-file-data-format" value="FormatFloat"/>
<Option name="native-file-header-format" value="WAVE"/>
<Option name="auto-play" value="0"/>
<Option name="auto-return" value="0"/>
<Option name="auto-input" value="1"/>
<Option name="punch-in" value="0"/>
<Option name="punch-out" value="0"/>
<Option name="subframes-per-frame" value="100"/>
<Option name="timecode-format" value="timecode_30"/>
<Option name="raid-path" value=""/>
<Option name="audio-search-path" value=""/>
<Option name="midi-search-path" value=""/>
<Option name="bwf-country-code" value="US"/>
<Option name="bwf-organization-code" value="US"/>
<Option name="auditioner-output-left" value="default"/>
<Option name="auditioner-output-right" value="default"/>
<Option name="timecode-source-is-synced" value="1"/>
<Option name="jack-time-master" value="1"/>
<Option name="use-video-sync" value="0"/>
<Option name="video-pullup" value="0"/>
<Option name="show-summary" value="1"/>
<Option name="show-group-tabs" value="1"/>
<Option name="external-sync" value="0"/>
<Option name="sync-source" value="JACK"/>
<Option name="insert-merge-policy" value="InsertMergeRelax"/>
<Option name="timecode-offset" value="0"/>
<Option name="timecode-offset-negative" value="1"/>
<Option name="glue-new-markers-to-bars-and-beats" value="0"/>
<Option name="midi-copy-is-fork" value="0"/>
<Option name="glue-new-regions-to-bars-and-beats" value="0"/>
</Config>
<Metadata/>
<Sources/>
<Regions/>
<Locations>
<Location id="81" name="Loop" start="0" end="1" flags="IsAutoLoop,IsHidden" locked="no" position-lock-style="AudioTime"/>
<Location id="82" name="Punch" start="0" end="1" flags="IsAutoPunch,IsHidden" locked="no" position-lock-style="AudioTime"/>
</Locations>
<Bundles/>
<Routes>
<Route id="22" name="master" default-type="audio" flags="MasterOut" active="yes" phase-invert="00" denormal-protection="no" meter-point="MeterPostFader" order-keys="editor=0:signal=0" self-solo="no" soloed-by-upstream="0" soloed-by-downstream="0" solo-isolated="no" solo-safe="no">
<IO name="master" id="39" direction="Input" default-type="audio" user-latency="0">
<Port type="audio" name="master/audio_in 1"/>
<Port type="audio" name="master/audio_in 2"/>
</IO>
<IO name="master" id="40" direction="Output" default-type="audio" user-latency="0">
<Port type="audio" name="master/audio_out 1">
<Connection other="system:playback_1"/>
</Port>
<Port type="audio" name="master/audio_out 2">
<Connection other="system:playback_2"/>
</Port>
</IO>
<Controllable name="solo" id="24" flags="Toggle" value="0.000000000000"/>
<Controllable name="mute" id="26" flags="Toggle" value="0.000000000000"/>
<MuteMaster mute-point="PreFader,PostFader,Listen,Main" muted="no"/>
<RemoteControl id="1"/>
<Pannable>
<Controllable name="pan-azimuth" id="30" flags="" value="0.500000000000"/>
<Controllable name="pan-width" id="34" flags="" value="1.000000000000"/>
<Controllable name="pan-elevation" id="32" flags="" value="0.000000000000"/>
<Controllable name="pan-frontback" id="36" flags="" value="0.000000000000"/>
<Controllable name="pan-lfe" id="38" flags="" value="0.000000000000"/>
<Automation/>
</Pannable>
<Processor id="41" name="Amp" active="yes" user-latency="0" type="amp">
<Controllable name="gaincontrol" id="43" flags="GainLike" value="1.000000000000"/>
</Processor>
<Processor id="44" name="Meter" active="yes" user-latency="0" type="meter"/>
<Processor id="45" name="master" active="yes" user-latency="0" own-input="yes" own-output="no" output="master" type="main-outs" role="Main">
<PannerShell bypassed="no">
<Panner type="Equal Power Stereo"/>
</PannerShell>
</Processor>
</Route>
</Routes>
<Playlists/>
<UnusedPlaylists/>
<RouteGroups/>
<Click>
<IO name="click" id="47" direction="Output" default-type="audio" user-latency="0">
<Port type="audio" name="click/audio_out 1">
<Connection other="system:playback_1"/>
</Port>
<Port type="audio" name="click/audio_out 2">
<Connection other="system:playback_2"/>
</Port>
</IO>
</Click>
<NamedSelections/>
<Speakers>
<Speaker azimuth="0" elevation="0" distance="1"/>
<Speaker azimuth="180" elevation="0" distance="0"/>
</Speakers>
<TempoMap>
<Tempo start="1|1|0" beats-per-minute="120.000000" note-type="4.000000" movable="no"/>
<Meter start="1|1|0" note-type="4.000000" divisions-per-bar="4.000000" movable="no"/>
</TempoMap>
<ControlProtocols>
<Protocol name="Open Sound Control (OSC)" active="no"/>
<Protocol name="Generic MIDI" active="no"/>
<Protocol name="Mackie" active="no"/>
</ControlProtocols>
<Extra>
<UI>
<Window name="R-22-41" visible="no" x-off="-1" y-off="-1" x-size="-1" y-size="-1"/>
<Window name="R-22-44" visible="no" x-off="-1" y-off="-1" x-size="-1" y-size="-1"/>
<Window name="R-22-45" visible="no" x-off="-1" y-off="-1" x-size="-1" y-size="-1"/>
<Window name="M-22-41" visible="no" x-off="-1" y-off="-1" x-size="-1" y-size="-1"/>
<Window name="M-22-44" visible="no" x-off="-1" y-off="-1" x-size="-1" y-size="-1"/>
<Window name="M-22-45" visible="no" x-off="-1" y-off="-1" x-size="-1" y-size="-1"/>
<GUIObjectState>
<Object id="automation 30" height="58" visible="0"/>
<Object id="automation 34" height="58" visible="0"/>
<Object id="automation 43" height="58" visible="0"/>
<Object id="route 22" color="3506:22021:40784"/>
<Object id="rtav 22" height="58" visible="1"/>
<Object id="strip 22" visible="1"/>
</GUIObjectState>
</UI>
</Extra>
</Session>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<UndoHistory/>

View File

@ -464,6 +464,38 @@ def build(bld):
elif bld.env['build_target'] == 'x86_64':
testobj.source += [ 'sse_functions_64bit.s' ]
# Profiling
profilingobj = bld(features = 'cxx cxxprogram')
profilingobj.source = '''
test/dummy_lxvst.cc
test/profiling/runpc.cc
'''.split()
profilingobj.includes = obj.includes
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']) + '"',
'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"',
'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()