summaryrefslogtreecommitdiff
path: root/libs/canvas/benchmark/render_parts.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-04 00:32:52 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-04 00:32:52 -0400
commitaaea166135ace01709f7e0be64f40be80f4107ec (patch)
tree0e794ef7a723e4aaf909b841a6816e405b4ceca1 /libs/canvas/benchmark/render_parts.cc
parent1d8bac08c0c00d44e22c581768a275e1b21a99a7 (diff)
initial commit of hand merging, plus getting "ancient" waf script to work correctly
Diffstat (limited to 'libs/canvas/benchmark/render_parts.cc')
-rw-r--r--libs/canvas/benchmark/render_parts.cc58
1 files changed, 58 insertions, 0 deletions
diff --git a/libs/canvas/benchmark/render_parts.cc b/libs/canvas/benchmark/render_parts.cc
new file mode 100644
index 0000000000..14988ab5c6
--- /dev/null
+++ b/libs/canvas/benchmark/render_parts.cc
@@ -0,0 +1,58 @@
+#include <sys/time.h>
+#include <pangomm/init.h>
+#include "pbd/compose.h"
+#include "pbd/xml++.h"
+#include "canvas/group.h"
+#include "canvas/canvas.h"
+#include "canvas/root_group.h"
+#include "canvas/rectangle.h"
+#include "benchmark.h"
+
+using namespace std;
+using namespace ArdourCanvas;
+
+class RenderParts : public Benchmark
+{
+public:
+ RenderParts (string const & session) : Benchmark (session) {}
+
+ void set_items_per_cell (int items)
+ {
+ _items_per_cell = items;
+ }
+
+ void do_run (ImageCanvas& canvas)
+ {
+ Group::default_items_per_cell = _items_per_cell;
+
+ for (int i = 0; i < 1e4; i += 50) {
+ canvas.render_to_image (Rect (i, 0, i + 50, 1024));
+ }
+ }
+
+private:
+ int _items_per_cell;
+};
+
+int main (int argc, char* argv[])
+{
+ if (argc < 2) {
+ cerr << "Syntax: render_parts <session>\n";
+ exit (EXIT_FAILURE);
+ }
+
+ Pango::init ();
+
+ RenderParts render_parts (argv[1]);
+
+ int tests[] = { 16, 32, 64, 128, 256, 512, 1024, 1e4, 1e5, 1e6 };
+
+ for (unsigned int i = 0; i < sizeof (tests) / sizeof (int); ++i) {
+ render_parts.set_items_per_cell (tests[i]);
+ cout << tests[i] << " " << render_parts.run () << "\n";
+ }
+
+ return 0;
+}
+
+