summaryrefslogtreecommitdiff
path: root/libs/ardour/test/profiling/lots_of_regions.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-06-17 21:20:51 +0000
committerCarl Hetherington <carl@carlh.net>2012-06-17 21:20:51 +0000
commita8773900a8268917e3949dbe750df9df688a557c (patch)
treea1a796f20d625b53f3cc6c7bf839a348d2ea9673 /libs/ardour/test/profiling/lots_of_regions.cc
parent8fc866309f4a03c157a329cbfdb6d9eb9150d9fe (diff)
Profile of duplicating lots of regions.
git-svn-id: svn://localhost/ardour2/branches/3.0@12750 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/test/profiling/lots_of_regions.cc')
-rw-r--r--libs/ardour/test/profiling/lots_of_regions.cc47
1 files changed, 47 insertions, 0 deletions
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<MidiTrack> track = boost::dynamic_pointer_cast<MidiTrack> (session->get_routes()->back());
+ assert (track);
+
+ /* And the playlist */
+ boost::shared_ptr<Playlist> playlist = track->playlist ();
+ assert (playlist);
+
+ /* And the region */
+ boost::shared_ptr<MidiRegion> region = boost::dynamic_pointer_cast<MidiRegion> (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 ();
+}