File: autotimetest.pl

package info (click to toggle)
swh-plugins 0.4.17-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,264 kB
  • sloc: ansic: 23,551; xml: 12,633; perl: 1,114; sh: 964; makefile: 218
file content (134 lines) | stat: -rwxr-xr-x 2,475 bytes parent folder | download | duplicates (2)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/perl -w

$html = 0;
$skip = 0;

while (@ARGV) {
	$plugin = shift(@ARGV)."";

	if ($plugin eq "--html") {
		$html = 1;
		print "<table cellpadding=\"4\" cellspacing=\"0\" border=\"1\">\n";
		print "<tr><th>UID</th><th>Name</th><th>PIII MHz</th><th>Cycles /<br>sample</th></tr>\n";
		next;
	}

	@data = `analyseplugin $plugin`;

	$port = 0;
	$ins = 0;
	$id = 0;
	$seen = 0;

	for (@data) {
		if (/Plugin Name: "(.*?)"/) {
			if ($seen) {
				#&run($port, $ins, $id, $title);
				&run;
			}
			if (/Debug/) {
				$skip = 1;
			}
			$title = $1;
			$seen = 1;
			$ins = 0;
			$id = 0;
			$port = 0;
		}
		if (/Plugin Label: "(.*?)"/) {
			$label = $1;
		}
		if (/Plugin Unique ID: (\d+)/) {
			$id = $1;
		}
		if (/"(.*?)" input, control, ([0-9.e-]+).*? to ([0-9.e-]+)/i) {
			#$name[$port] = $1;
			$min[$port] = $2;
			if ($min[$port] eq "...") {
				$min[$port] = 0.0;
			}
			$max[$port] = $3;
			if ($max[$port] eq "...") {
				$max[$port] = $min[$port];
			}
			$port++;
		}
		if (/input, audio/) {
			$ins++;
		}
	}

	if ($skip) {
		$skip = 0;
		next;
	}

	&run;
}

#&run;
#&run($port, $ins, $id, $title);

if ($html) {
	print "</table>\n";
}

sub run {
	#local ($port, $ins, $id, $title) = @_;

	my $afile = "XXX";
	if ($ins == 1) {
		$afile = "happyness-ext-m.wav";
	} elsif ($ins == 2) {
		$afile = "happyness-ext-s.wav";
	} else {
		print STDERR "No valid input file for $id\n";
		#next;
	}

	if ($html) {
		printf("<tr><td>$id</td><td><a href=\"/ladspa-swh/docs/ladspa-swh.html#id$id\">$title</a></td>");
	} else {
		printf("%-48s ", $title);
	}

	my $base = "";
	for $i (0..$port-1) {
		$base .= " ".($min[$i]+$max[$i])/2;
	}

	$cycles = 9999999999999;
	$pers = 99999999;
	for (1..5) {
		$cmd = "applyplugin ../testdata/$afile /dev/null $plugin $label$base 2>&1";
		$out = `$cmd`;
		last if ($? != 0);
                chomp $out;
                $out =~ /Plugin cycles: (\d+) \((\d+)\//;
		if (!$1) {
			print STDERR "$? $out\n$cmd\n";
			$err = 1;
		}
                if ($1 < $cycles) {
                        $cycles = $1;
                }
                if ($2 < $pers) {
                        $pers = $2;
                }
	}
	if ($err || $?) {
		if ($html) {
			print "<td>???</td><td>???</td>\n\n";
		} else {
			print "???\n$cmd\n";
		}
		$err = 0;
		return;
	}
	$cycles /= 8000000.0;
	if ($html) {
		printf "<td align=\"right\">%.1f</td><td align=\"right\">$pers</td></tr>\n", $cycles;
	} else {
		printf "%3.1f\t%d\n", $cycles, $pers;
	}
}