File: render_from_log.cc

package info (click to toggle)
ardour 1%3A8.12.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 147,336 kB
  • sloc: cpp: 645,609; ansic: 515,891; xml: 123,665; python: 35,344; javascript: 15,340; sh: 4,983; asm: 1,800; perl: 958; php: 785; makefile: 298; objc: 28
file content (62 lines) | stat: -rw-r--r-- 1,281 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#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 RenderFromLog : public Benchmark
{
public:
	RenderFromLog (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;
		canvas.set_log_renders (false);

		list<Rect> const & renders = canvas.renders ();

		for (list<Rect>::const_iterator i = renders.begin(); i != renders.end(); ++i) {
			canvas.render_to_image (*i);
		}
	}

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 ();

	RenderFromLog render_from_log (argv[1]);

//	int tests[] = { 16, 32, 64, 128, 256, 512, 1024, 1e4, 1e5, 1e6 };
	int tests[] = { 16 };

	for (unsigned int i = 0; i < sizeof (tests) / sizeof (int); ++i) {
		render_from_log.set_items_per_cell (tests[i]);
		cout << tests[i] << " " << render_from_log.run () << "\n";
	}

	return 0;
}