1#!/usr/bin/perl -w 2 3use strict; 4 5 6############################################################################ 7# gfx-x11: a front-end for x11perf. Runs a selected x11perf test, and 8# produces output in the format needed by UnixBench. 9############################################################################ 10# Modification Log: 11# 2007.09.26 Ian Smith Created 12############################################################################ 13 14# This program runs sets of x11perf tests, indexes the results against 15# a common base reference system (see $testData below), and reports the 16# final score. 17# 18# Usage: 19# gfx-x11 <group> <reps> <time> 20# where: 21# <group> is one of the test groups defined in $testGroups below 22# <reps> is the number of repeats to do per test (the -repeat 23# argument to x11perf) 24# <time> is the number of seconds to run each repeat for (the 25# -time argument to x11perf) 26# Note that x11perf runs a calibration pass before the requested number 27# of test passes. The score we compute for a test is the average of the 28# test passes, divided by the base value in $testData, times 1000.0. 29# The final score we report is the average of the test scores. 30 31 32############################################################################ 33# TEST DATA 34############################################################################ 35 36# This array lists all of the x11perf tests, together with their scores 37# on an HP Compaq nc8430, with an ATI Mobility Radeon X1600 (256MB) 38# graphics adapter. There isn't anything special about this reference 39# system, but scaling all the scores back to a single reference system 40# allows us to average them in a roughly meaningful way, which in turn 41# allows us to produce sensible scores for the test groups defined below. 42# 43# The results we report are indexed to these values, at a base of 1000.0. 44my $testData = { 45 'dot' => [ 31700000.0, "Dot" ], 46 'rect1' => [ 18400000.0, "1x1 rectangle" ], 47 'rect10' => [ 7180000.0, "10x10 rectangle" ], 48 'rect100' => [ 110000.0, "100x100 rectangle" ], 49 'rect500' => [ 4110.0, "500x500 rectangle" ], 50 'srect1' => [ 15800000.0, "1x1 stippled rectangle (8x8 stipple)" ], 51 'srect10' => [ 7400000.0, "10x10 stippled rectangle (8x8 stipple)" ], 52 'srect100' => [ 110000.0, "100x100 stippled rectangle (8x8 stipple)" ], 53 'srect500' => [ 4110.0, "500x500 stippled rectangle (8x8 stipple)" ], 54 'osrect1' => [ 15900000.0, "1x1 opaque stippled rectangle (8x8 stipple)" ], 55 'osrect10' => [ 7170000.0, "10x10 opaque stippled rectangle (8x8 stipple)" ], 56 'osrect100' => [ 110000.0, "100x100 opaque stippled rectangle (8x8 stipple)" ], 57 'osrect500' => [ 4110.0, "500x500 opaque stippled rectangle (8x8 stipple)" ], 58 'tilerect1' => [ 15800000.0, "1x1 tiled rectangle (4x4 tile)" ], 59 'tilerect10' => [ 7170000.0, "10x10 tiled rectangle (4x4 tile)" ], 60 'tilerect100' => [ 110000.0, "100x100 tiled rectangle (4x4 tile)" ], 61 'tilerect500' => [ 4110.0, "500x500 tiled rectangle (4x4 tile)" ], 62 'oddsrect1' => [ 2990000.0, "1x1 stippled rectangle (17x15 stipple)" ], 63 'oddsrect10' => [ 1490000.0, "10x10 stippled rectangle (17x15 stipple)" ], 64 'oddsrect100' => [ 55600.0, "100x100 stippled rectangle (17x15 stipple)" ], 65 'oddsrect500' => [ 2360.0, "500x500 stippled rectangle (17x15 stipple)" ], 66 'oddosrect1' => [ 2990000.0, "1x1 opaque stippled rectangle (17x15 stipple)" ], 67 'oddosrect10' => [ 1430000.0, "10x10 opaque stippled rectangle (17x15 stipple)" ], 68 'oddosrect100' => [ 54500.0, "100x100 opaque stippled rectangle (17x15 stipple)" ], 69 'oddosrect500' => [ 2320.0, "500x500 opaque stippled rectangle (17x15 stipple)" ], 70 'oddtilerect1' => [ 2990000.0, "1x1 tiled rectangle (17x15 tile)" ], 71 'oddtilerect10' => [ 1430000.0, "10x10 tiled rectangle (17x15 tile)" ], 72 'oddtilerect100' => [ 54500.0, "100x100 tiled rectangle (17x15 tile)" ], 73 'oddtilerect500' => [ 2320.0, "500x500 tiled rectangle (17x15 tile)" ], 74 'bigsrect1' => [ 4300000.0, "1x1 stippled rectangle (161x145 stipple)" ], 75 'bigsrect10' => [ 705000.0, "10x10 stippled rectangle (161x145 stipple)" ], 76 'bigsrect100' => [ 12300.0, "100x100 stippled rectangle (161x145 stipple)" ], 77 'bigsrect500' => [ 524.0, "500x500 stippled rectangle (161x145 stipple)" ], 78 'bigosrect1' => [ 3980000.0, "1x1 opaque stippled rectangle (161x145 stipple)" ], 79 'bigosrect10' => [ 644000.0, "10x10 opaque stippled rectangle (161x145 stipple)" ], 80 'bigosrect100' => [ 12800.0, "100x100 opaque stippled rectangle (161x145 stipple)" ], 81 'bigosrect500' => [ 584.0, "500x500 opaque stippled rectangle (161x145 stipple)" ], 82 'bigtilerect1' => [ 5970000.0, "1x1 tiled rectangle (161x145 tile)" ], 83 'bigtilerect10' => [ 684000.0, "10x10 tiled rectangle (161x145 tile)" ], 84 'bigtilerect100' => [ 16200.0, "100x100 tiled rectangle (161x145 tile)" ], 85 'bigtilerect500' => [ 872.0, "500x500 tiled rectangle (161x145 tile)" ], 86 'eschertilerect1' => [ 5940000.0, "1x1 tiled rectangle (216x208 tile)" ], 87 'eschertilerect10' => [ 639000.0, "10x10 tiled rectangle (216x208 tile)" ], 88 'eschertilerect100' => [ 18000.0, "100x100 tiled rectangle (216x208 tile)" ], 89 'eschertilerect500' => [ 922.0, "500x500 tiled rectangle (216x208 tile)" ], 90 'seg1' => [ 28800000.0, "1-pixel line segment" ], 91 'seg10' => [ 4460000.0, "10-pixel line segment" ], 92 'seg100' => [ 470000.0, "100-pixel line segment" ], 93 'seg500' => [ 94600.0, "500-pixel line segment" ], 94 'seg100c1' => [ 449000.0, "100-pixel line segment (1 kid)" ], 95 'seg100c2' => [ 432000.0, "100-pixel line segment (2 kids)" ], 96 'seg100c3' => [ 421000.0, "100-pixel line segment (3 kids)" ], 97 'dseg10' => [ 3720000.0, "10-pixel dashed segment" ], 98 'dseg100' => [ 687000.0, "100-pixel dashed segment" ], 99 'ddseg100' => [ 454000.0, "100-pixel double-dashed segment" ], 100 'hseg10' => [ 7020000.0, "10-pixel horizontal line segment" ], 101 'hseg100' => [ 2170000.0, "100-pixel horizontal line segment" ], 102 'hseg500' => [ 456000.0, "500-pixel horizontal line segment" ], 103 'vseg10' => [ 3990000.0, "10-pixel vertical line segment" ], 104 'vseg100' => [ 411000.0, "100-pixel vertical line segment" ], 105 'vseg500' => [ 82400.0, "500-pixel vertical line segment" ], 106 'whseg10' => [ 2880000.0, "10x1 wide horizontal line segment" ], 107 'whseg100' => [ 616000.0, "100x10 wide horizontal line segment" ], 108 'whseg500' => [ 33300.0, "500x50 wide horizontal line segment" ], 109 'wvseg10' => [ 2890000.0, "10x1 wide vertical line segment" ], 110 'wvseg100' => [ 584000.0, "100x10 wide vertical line segment" ], 111 'wvseg500' => [ 31700.0, "500x50 wide vertical line segment" ], 112 'line1' => [ 28300000.0, "1-pixel line" ], 113 'line10' => [ 4470000.0, "10-pixel line" ], 114 'line100' => [ 472000.0, "100-pixel line" ], 115 'line500' => [ 94200.0, "500-pixel line" ], 116 'dline10' => [ 3640000.0, "10-pixel dashed line" ], 117 'dline100' => [ 673000.0, "100-pixel dashed line" ], 118 'ddline100' => [ 453000.0, "100-pixel double-dashed line" ], 119 'wline10' => [ 908000.0, "10x1 wide line" ], 120 'wline100' => [ 146000.0, "100x10 wide line" ], 121 'wline500' => [ 30600.0, "500x50 wide line" ], 122 'wdline100' => [ 69900.0, "100x10 wide dashed line" ], 123 'wddline100' => [ 60600.0, "100x10 wide double-dashed line" ], 124 'orect10' => [ 5100000.0, "10x10 rectangle outline" ], 125 'orect100' => [ 709000.0, "100x100 rectangle outline" ], 126 'orect500' => [ 146000.0, "500x500 rectangle outline" ], 127 'worect10' => [ 4530000.0, "10x10 wide rectangle outline" ], 128 'worect100' => [ 204000.0, "100x100 wide rectangle outline" ], 129 'worect500' => [ 9790.0, "500x500 wide rectangle outline" ], 130 'circle1' => [ 5160000.0, "1-pixel circle" ], 131 'circle10' => [ 1160000.0, "10-pixel circle" ], 132 'circle100' => [ 141000.0, "100-pixel circle" ], 133 'circle500' => [ 28900.0, "500-pixel circle" ], 134 'dcircle100' => [ 98400.0, "100-pixel dashed circle" ], 135 'ddcircle100' => [ 75000.0, "100-pixel double-dashed circle" ], 136 'wcircle10' => [ 780000.0, "10-pixel wide circle" ], 137 'wcircle100' => [ 90900.0, "100-pixel wide circle" ], 138 'wcircle500' => [ 11300.0, "500-pixel wide circle" ], 139 'wdcircle100' => [ 8100.0, "100-pixel wide dashed circle" ], 140 'wddcircle100' => [ 8300.0, "100-pixel wide double-dashed circle" ], 141 'pcircle10' => [ 1270000.0, "10-pixel partial circle" ], 142 'pcircle100' => [ 212000.0, "100-pixel partial circle" ], 143 'wpcircle10' => [ 104000.0, "10-pixel wide partial circle" ], 144 'wpcircle100' => [ 39000.0, "100-pixel wide partial circle" ], 145 'fcircle1' => [ 61300000.0, "1-pixel solid circle" ], 146 'fcircle10' => [ 1720000.0, "10-pixel solid circle" ], 147 'fcircle100' => [ 120000.0, "100-pixel solid circle" ], 148 'fcircle500' => [ 5170.0, "500-pixel solid circle" ], 149 'fcpcircle10' => [ 981000.0, "10-pixel fill chord partial circle" ], 150 'fcpcircle100' => [ 205000.0, "100-pixel fill chord partial circle" ], 151 'fspcircle10' => [ 876000.0, "10-pixel fill slice partial circle" ], 152 'fspcircle100' => [ 187000.0, "100-pixel fill slice partial circle" ], 153 'ellipse10' => [ 1410000.0, "10-pixel ellipse" ], 154 'ellipse100' => [ 172000.0, "100-pixel ellipse" ], 155 'ellipse500' => [ 35100.0, "500-pixel ellipse" ], 156 'dellipse100' => [ 114000.0, "100-pixel dashed ellipse" ], 157 'ddellipse100' => [ 88900.0, "100-pixel double-dashed ellipse" ], 158 'wellipse10' => [ 889000.0, "10-pixel wide ellipse" ], 159 'wellipse100' => [ 124000.0, "100-pixel wide ellipse" ], 160 'wellipse500' => [ 15600.0, "500-pixel wide ellipse" ], 161 'wdellipse100' => [ 7730.0, "100-pixel wide dashed ellipse" ], 162 'wddellipse100' => [ 6680.0, "100-pixel wide double-dashed ellipse" ], 163 'pellipse10' => [ 1350000.0, "10-pixel partial ellipse" ], 164 'pellipse100' => [ 260000.0, "100-pixel partial ellipse" ], 165 'wpellipse10' => [ 97900.0, "10-pixel wide partial ellipse" ], 166 'wpellipse100' => [ 16800.0, "100-pixel wide partial ellipse" ], 167 'fellipse10' => [ 2110000.0, "10-pixel filled ellipse" ], 168 'fellipse100' => [ 212000.0, "100-pixel filled ellipse" ], 169 'fellipse500' => [ 11000.0, "500-pixel filled ellipse" ], 170 'fcpellipse10' => [ 1060000.0, "10-pixel fill chord partial ellipse" ], 171 'fcpellipse100' => [ 296000.0, "100-pixel fill chord partial ellipse" ], 172 'fspellipse10' => [ 945000.0, "10-pixel fill slice partial ellipse" ], 173 'fspellipse100' => [ 269000.0, "100-pixel fill slice partial ellipse" ], 174 'triangle1' => [ 2460000.0, "Fill 1x1 equivalent triangle" ], 175 'triangle10' => [ 969000.0, "Fill 10x10 equivalent triangle" ], 176 'triangle100' => [ 97000.0, "Fill 100x100 equivalent triangle" ], 177 'trap1' => [ 2630000.0, "Fill 1x1 trapezoid" ], 178 'trap10' => [ 1260000.0, "Fill 10x10 trapezoid" ], 179 'trap100' => [ 106000.0, "Fill 100x100 trapezoid" ], 180 'trap300' => [ 11600.0, "Fill 300x300 trapezoid" ], 181 'strap1' => [ 2010000.0, "Fill 1x1 stippled trapezoid (8x8 stipple)" ], 182 'strap10' => [ 910000.0, "Fill 10x10 stippled trapezoid (8x8 stipple)" ], 183 'strap100' => [ 104000.0, "Fill 100x100 stippled trapezoid (8x8 stipple)" ], 184 'strap300' => [ 11700.0, "Fill 300x300 stippled trapezoid (8x8 stipple)" ], 185 'ostrap1' => [ 2000000.0, "Fill 1x1 opaque stippled trapezoid (8x8 stipple)" ], 186 'ostrap10' => [ 907000.0, "Fill 10x10 opaque stippled trapezoid (8x8 stipple)" ], 187 'ostrap100' => [ 104000.0, "Fill 100x100 opaque stippled trapezoid (8x8 stipple)" ], 188 'ostrap300' => [ 11600.0, "Fill 300x300 opaque stippled trapezoid (8x8 stipple)" ], 189 'tiletrap1' => [ 1430000.0, "Fill 1x1 tiled trapezoid (4x4 tile)" ], 190 'tiletrap10' => [ 778000.0, "Fill 10x10 tiled trapezoid (4x4 tile)" ], 191 'tiletrap100' => [ 104000.0, "Fill 100x100 tiled trapezoid (4x4 tile)" ], 192 'tiletrap300' => [ 11600.0, "Fill 300x300 tiled trapezoid (4x4 tile)" ], 193 'oddstrap1' => [ 1700000.0, "Fill 1x1 stippled trapezoid (17x15 stipple)" ], 194 'oddstrap10' => [ 296000.0, "Fill 10x10 stippled trapezoid (17x15 stipple)" ], 195 'oddstrap100' => [ 18600.0, "Fill 100x100 stippled trapezoid (17x15 stipple)" ], 196 'oddstrap300' => [ 2090.0, "Fill 300x300 stippled trapezoid (17x15 stipple)" ], 197 'oddostrap1' => [ 1830000.0, "Fill 1x1 opaque stippled trapezoid (17x15 stipple)" ], 198 'oddostrap10' => [ 296000.0, "Fill 10x10 opaque stippled trapezoid (17x15 stipple)" ], 199 'oddostrap100' => [ 18400.0, "Fill 100x100 opaque stippled trapezoid (17x15 stipple)" ], 200 'oddostrap300' => [ 2080.0, "Fill 300x300 opaque stippled trapezoid (17x15 stipple)" ], 201 'oddtiletrap1' => [ 1710000.0, "Fill 1x1 tiled trapezoid (17x15 tile)" ], 202 'oddtiletrap10' => [ 296000.0, "Fill 10x10 tiled trapezoid (17x15 tile)" ], 203 'oddtiletrap100' => [ 18400.0, "Fill 100x100 tiled trapezoid (17x15 tile)" ], 204 'oddtiletrap300' => [ 2080.0, "Fill 300x300 tiled trapezoid (17x15 tile)" ], 205 'bigstrap1' => [ 1510000.0, "Fill 1x1 stippled trapezoid (161x145 stipple)" ], 206 'bigstrap10' => [ 235000.0, "Fill 10x10 stippled trapezoid (161x145 stipple)" ], 207 'bigstrap100' => [ 9110.0, "Fill 100x100 stippled trapezoid (161x145 stipple)" ], 208 'bigstrap300' => [ 1260.0, "Fill 300x300 stippled trapezoid (161x145 stipple)" ], 209 'bigostrap1' => [ 1480000.0, "Fill 1x1 opaque stippled trapezoid (161x145 stipple)" ], 210 'bigostrap10' => [ 213000.0, "Fill 10x10 opaque stippled trapezoid (161x145 stipple)" ], 211 'bigostrap100' => [ 8830.0, "Fill 100x100 opaque stippled trapezoid (161x145 stipple)" ], 212 'bigostrap300' => [ 1420.0, "Fill 300x300 opaque stippled trapezoid (161x145 stipple)" ], 213 'bigtiletrap1' => [ 1630000.0, "Fill 1x1 tiled trapezoid (161x145 tile)" ], 214 'bigtiletrap10' => [ 272000.0, "Fill 10x10 tiled trapezoid (161x145 tile)" ], 215 'bigtiletrap100' => [ 12900.0, "Fill 100x100 tiled trapezoid (161x145 tile)" ], 216 'bigtiletrap300' => [ 2350.0, "Fill 300x300 tiled trapezoid (161x145 tile)" ], 217 'eschertiletrap1' => [ 1650000.0, "Fill 1x1 tiled trapezoid (216x208 tile)" ], 218 'eschertiletrap10' => [ 273000.0, "Fill 10x10 tiled trapezoid (216x208 tile)" ], 219 'eschertiletrap100' => [ 13400.0, "Fill 100x100 tiled trapezoid (216x208 tile)" ], 220 'eschertiletrap300' => [ 2450.0, "Fill 300x300 tiled trapezoid (216x208 tile)" ], 221 'aatrap1' => [ 260000.0, "Fill 1x1 aa trap" ], 222 'aatrap10' => [ 23500.0, "Fill 10x10 aa trap" ], 223 'aatrap100' => [ 13300.0, "Fill 100x100 aa trap" ], 224 'aatrap300' => [ 4450.0, "Fill 300x300 aa trap" ], 225 'aa4trap1' => [ 2150.0, "Fill 1x1 aa trap with 4 bit alpha" ], 226 'aa4trap10' => [ 2130.0, "Fill 10x10 aa trap with 4 bit alpha" ], 227 'aa4trap100' => [ 1890.0, "Fill 100x100 aa trap with 4 bit alpha" ], 228 'aa4trap300' => [ 1460.0, "Fill 300x300 aa trap with 4 bit alpha" ], 229 'aa1trap1' => [ 2200000.0, "Fill 1x1 aa trap with 1 bit alpha" ], 230 'aa1trap10' => [ 357000.0, "Fill 10x10 aa trap with 1 bit alpha" ], 231 'aa1trap100' => [ 167000.0, "Fill 100x100 aa trap with 1 bit alpha" ], 232 'aa1trap300' => [ 67000.0, "Fill 300x300 aa trap with 1 bit alpha" ], 233 'aatrap2x1' => [ 368000.0, "Fill 2x1 aa trap" ], 234 'aatrap2x10' => [ 25700.0, "Fill 2x10 aa trap" ], 235 'aatrap2x100' => [ 12400.0, "Fill 2x100 aa trap" ], 236 'aatrap2x300' => [ 5710.0, "Fill 2x300 aa trap" ], 237 'aatrapezoid1' => [ 372000.0, "Fill 1x1 aa trapezoid" ], 238 'aatrapezoid10' => [ 137000.0, "Fill 10x10 aa trapezoid" ], 239 'aatrapezoid100' => [ 9590.0, "Fill 100x100 aa trapezoid" ], 240 'aatrapezoid300' => [ 1420.0, "Fill 300x300 aa trapezoid" ], 241 'addaatrapezoid1' => [ 433000.0, "Fill 1x1 aa pre-added trapezoid" ], 242 'addaatrapezoid10' => [ 24100.0, "Fill 10x10 aa pre-added trapezoid" ], 243 'addaatrapezoid100' => [ 13300.0, "Fill 100x100 aa pre-added trapezoid" ], 244 'addaatrapezoid300' => [ 4460.0, "Fill 300x300 aa pre-added trapezoid" ], 245 'complex10' => [ 655000.0, "Fill 10x10 equivalent complex polygon" ], 246 'complex100' => [ 87000.0, "Fill 100x100 equivalent complex polygons" ], 247 '64poly10convex' => [ 481000.0, "Fill 10x10 64-gon (Convex)" ], 248 '64poly100convex' => [ 105000.0, "Fill 100x100 64-gon (Convex)" ], 249 '64poly10complex' => [ 353000.0, "Fill 10x10 64-gon (Complex)" ], 250 '64poly100complex' => [ 105000.0, "Fill 100x100 64-gon (Complex)" ], 251 'ftext' => [ 2200000.0, "Char in 80-char line (6x13)" ], 252 'f8text' => [ 1970000.0, "Char in 70-char line (8x13)" ], 253 'f9text' => [ 1690000.0, "Char in 60-char line (9x15)" ], 254 'f14text16' => [ 679000.0, "Char16 in 40-char line (k14)" ], 255 'f24text16' => [ 272000.0, "Char16 in 23-char line (k24)" ], 256 'tr10text' => [ 2520000.0, "Char in 80-char line (TR 10)" ], 257 'tr24text' => [ 940000.0, "Char in 30-char line (TR 24)" ], 258 'polytext' => [ 2230000.0, "Char in 20/40/20 line (6x13, TR 10)" ], 259 'polytext16' => [ 369000.0, "Char16 in 7/14/7 line (k14, k24)" ], 260 'fitext' => [ 1350000.0, "Char in 80-char image line (6x13)" ], 261 'f8itext' => [ 1130000.0, "Char in 70-char image line (8x13)" ], 262 'f9itext' => [ 902000.0, "Char in 60-char image line (9x15)" ], 263 'f14itext16' => [ 449000.0, "Char16 in 40-char image line (k14)" ], 264 'f24itext16' => [ 169000.0, "Char16 in 23-char image line (k24)" ], 265 'tr10itext' => [ 1590000.0, "Char in 80-char image line (TR 10)" ], 266 'tr24itext' => [ 435000.0, "Char in 30-char image line (TR 24)" ], 267 'aa10text' => [ 53200.0, "Char in 80-char aa line (Charter 10)" ], 268 'aa24text' => [ 13300.0, "Char in 30-char aa line (Charter 24)" ], 269 'aaftext' => [ 45200.0, "Char in 80-char aa line (Courier 12)" ], 270 'a10text' => [ 53100.0, "Char in 80-char a line (Charter 10)" ], 271 'a24text' => [ 13300.0, "Char in 30-char a line (Charter 24)" ], 272 'aftext' => [ 45200.0, "Char in 80-char a line (Courier 12)" ], 273 'rgb10text' => [ 49400.0, "Char in 80-char rgb line (Charter 10)" ], 274 'rgb24text' => [ 10200.0, "Char in 30-char rgb line (Charter 24)" ], 275 'rgbftext' => [ 42200.0, "Char in 80-char rgb line (Courier 12)" ], 276 'caa10text' => [ 15300.0, "Char in 80-char aa core line (Charter 10)" ], 277 'caa24text' => [ 2540.0, "Char in 30-char aa core line (Charter 24)" ], 278 'caaftext' => [ 10900.0, "Char in 80-char aa core line (Courier 12)" ], 279 'ca10text' => [ 15300.0, "Char in 80-char a core line (Charter 10)" ], 280 'ca24text' => [ 2540.0, "Char in 30-char a core line (Charter 24)" ], 281 'caftext' => [ 10900.0, "Char in 80-char a core line (Courier 12)" ], 282 'rgb10text' => [ 15000.0, "Char in 80-char rgb core line (Charter 10)" ], 283 'rgb24text' => [ 2510.0, "Char in 30-char rgb core line (Charter 24)" ], 284 'rgbftext' => [ 10700.0, "Char in 80-char rgb core line (Courier 12)" ], 285 'scroll10' => [ 1310000.0, "Scroll 10x10 pixels" ], 286 'scroll100' => [ 52000.0, "Scroll 100x100 pixels" ], 287 'scroll500' => [ 2190.0, "Scroll 500x500 pixels" ], 288 'copywinwin10' => [ 1030000.0, "Copy 10x10 from window to window" ], 289 'copywinwin100' => [ 52200.0, "Copy 100x100 from window to window" ], 290 'copywinwin500' => [ 2080.0, "Copy 500x500 from window to window" ], 291 'copypixwin10' => [ 502000.0, "Copy 10x10 from pixmap to window" ], 292 'copypixwin100' => [ 20300.0, "Copy 100x100 from pixmap to window" ], 293 'copypixwin500' => [ 1020.0, "Copy 500x500 from pixmap to window" ], 294 'copywinpix10' => [ 7730.0, "Copy 10x10 from window to pixmap" ], 295 'copywinpix100' => [ 127.0, "Copy 100x100 from window to pixmap" ], 296 'copywinpix500' => [ 5.0, "Copy 500x500 from window to pixmap" ], 297 'copypixpix10' => [ 1260000.0, "Copy 10x10 from pixmap to pixmap" ], 298 'copypixpix100' => [ 56300.0, "Copy 100x100 from pixmap to pixmap" ], 299 'copypixpix500' => [ 2470.0, "Copy 500x500 from pixmap to pixmap" ], 300 'copyplane10' => [ 466000.0, "Copy 10x10 1-bit deep plane" ], 301 'copyplane100' => [ 13700.0, "Copy 100x100 1-bit deep plane" ], 302 'copyplane500' => [ 671.0, "Copy 500x500 1-bit deep plane" ], 303 'deepcopyplane10' => [ 151000.0, "Copy 10x10 n-bit deep plane" ], 304 'deepcopyplane100' => [ 6090.0, "Copy 100x100 n-bit deep plane" ], 305 'deepcopyplane500' => [ 278.0, "Copy 500x500 n-bit deep plane" ], 306 'putimage10' => [ 434000.0, "PutImage 10x10 square" ], 307 'putimage100' => [ 13600.0, "PutImage 100x100 square" ], 308 'putimage500' => [ 713.0, "PutImage 500x500 square" ], 309 'putimagexy10' => [ 321.0, "PutImage XY 10x10 square" ], 310 'putimagexy100' => [ 3.2, "PutImage XY 100x100 square" ], 311 'putimagexy500' => [ 0.1, "PutImage XY 500x500 square" ], 312 'shmput10' => [ 465000.0, "ShmPutImage 10x10 square" ], 313 'shmput100' => [ 20200.0, "ShmPutImage 100x100 square" ], 314 'shmput500' => [ 1020.0, "ShmPutImage 500x500 square" ], 315 'shmputxy10' => [ 31400.0, "ShmPutImage XY 10x10 square" ], 316 'shmputxy100' => [ 458.0, "ShmPutImage XY 100x100 square" ], 317 'shmputxy500' => [ 19.0, "ShmPutImage XY 500x500 square" ], 318 'getimage10' => [ 6650.0, "GetImage 10x10 square" ], 319 'getimage100' => [ 77.0, "GetImage 100x100 square" ], 320 'getimage500' => [ 3.1, "GetImage 500x500 square" ], 321 'getimagexy10' => [ 320.0, "GetImage XY 10x10 square" ], 322 'getimagexy100' => [ 3.2, "GetImage XY 100x100 square" ], 323 'getimagexy500' => [ 0.1, "GetImage XY 500x500 square" ], 324 'noop' => [ 8760000.0, "X protocol NoOperation" ], 325 'pointer' => [ 54800.0, "QueryPointer" ], 326 'prop' => [ 50900.0, "GetProperty" ], 327 'gc' => [ 1190000.0, "Change graphics context" ], 328 'create' => [ 597000.0, "Create and map subwindows (25 kids)" ], 329 'ucreate' => [ 1100000.0, "Create unmapped window (25 kids)" ], 330 'map' => [ 1350000.0, "Map window via parent (25 kids)" ], 331 'unmap' => [ 3360000.0, "Unmap window via parent (25 kids)" ], 332 'destroy' => [ 1190000.0, "Destroy window via parent (25 kids)" ], 333 'popup' => [ 660000.0, "Hide/expose window via popup (25 kids)" ], 334 'move' => [ 120000.0, "Move window (25 kids)" ], 335 'umove' => [ 1990000.0, "Moved unmapped window (25 kids)" ], 336 'movetree' => [ 877000.0, "Move window via parent (25 kids)" ], 337 'resize' => [ 136000.0, "Resize window (25 kids)" ], 338 'uresize' => [ 1870000.0, "Resize unmapped window (25 kids)" ], 339 'circulate' => [ 56300.0, "Circulate window (25 kids)" ], 340 'ucirculate' => [ 3630000.0, "Circulate Unmapped window (25 kids)" ], 341}; 342 343 344# This array defines named groups of tests. This is designed to allow 345# for simpler runs of related tests. 346# 347# Note that this array does *not* include all the x11perf tests. The idea 348# here is to run a representative sampling of the available tests, to get 349# a general idea of a system's performance, without taking forever to 350# do it. If you want to do detailed analysis of an X server or graphics 351# chip, then use x11perf directly. 352my $testGroups = { 353 'rects' => [ "rect10", "rect100", "oddtilerect10", "eschertilerect100" ], 354 'lines' => [ "seg100c3", "wvseg100", "ddline100", "worect500" ], 355 'circle' => [ "circle500", "wddcircle100", "wpcircle100", "fspcircle100" ], 356 'ellipse' => [ "ddellipse100", "wddellipse100", "pellipse10", "fspellipse100" ], 357 'shapes' => [ "triangle10", "trap300", "oddostrap300", "eschertiletrap300" ], 358 'aashapes' => [ "aa4trap300", "aa1trap10", "aatrap2x300", "addaatrapezoid300" ], 359 'polys' => [ "complex10", "64poly100convex", "64poly10complex", "64poly100complex" ], 360 'text' => [ "polytext16", "rgb24text", "caa10text", "ca24text" ], 361 'blit' => [ "scroll100", "copypixwin10", "deepcopyplane10", "putimagexy500" ], 362 'window' => [ "popup", "move", "movetree", "resize" ], 363}; 364 365 366############################################################################ 367# CODE 368############################################################################ 369 370# Exec the given command, and catch its standard output. 371# We return an array containing the PID and the filehandle on the 372# process' standard output. It's up to the caller to wait for the command 373# to terminate. 374sub command { 375 my ( $cmd ) = @_; 376 377 my $pid = open(my $childFd, "-|"); 378 if (!defined($pid)) { 379 die("Run: fork() failed (undef)\n"); 380 } elsif ($pid == 0) { 381 exec($cmd); 382 die("Run: exec() failed (returned)\n"); 383 } 384 385 return ( $pid, $childFd ); 386} 387 388 389# Get data from running a system command. Used for things like getting 390# the host OS from `uname -o` etc. 391# 392# Ignores initial blank lines from the command and returns the first 393# non-blank line, with white space trimmed off. 394sub runTest { 395 my ( $test, $reps, $time ) = @_; 396 397 my $tdata = $testData->{$test}; 398 if (!defined($tdata)) { 399 printf STDERR "gfx-x11: No such test: %s\n", $test; 400 exit(9); 401 } 402 403 my $cmd = sprintf "x11perf -repeat %d -subs 25 -time %d -%s", 404 $reps, $time, $test; 405 my ( $pid, $fd ) = command($cmd); 406 my $average = 0; 407 while (<$fd>) { 408 chomp; 409 410 # Display the output for logging. 411 printf "%s\n", $_; 412 413 # Save the score. 414 my ( $reps, $per, $rate ) = 415 ( m:([0-9]+)\s+trep\s+@\s+([0-9.]+)\s+msec\s+\(\s*([0-9.]+)/sec\): ); 416 $average = $rate if (defined($rate)); 417 } 418 419 # Close the command and wait for it to die. Bomb out if it failed. 420 # close($fd); 421 my $p = waitpid($pid, 0); 422 my $status = $?; 423 exit($status) if ($status != 0); 424 425 # Calculate and return the weighted result. 426 my $score = $average / $tdata->[0] * 1000.0; 427 printf "Test %s: %d --> %.1f\n", $test, $average, $score; 428 return $score; 429} 430 431 432sub runGroup { 433 my ( $group, $reps, $time ) = @_; 434 435 my $gdata = $testGroups->{$group}; 436 if (!defined($gdata)) { 437 printf STDERR "gfx-x11: No such test group: %s\n", $group; 438 exit(9); 439 } 440 441 my $count = 0; 442 my $total = 0; 443 foreach my $test (@$gdata) { 444 $total += runTest($test, $reps, $time); 445 ++$count; 446 } 447 $total /= $count; 448 449 $total; 450} 451 452 453############################################################################ 454# MAIN 455############################################################################ 456 457sub main { 458 my @args = @_; 459 460 if (scalar(@args) < 3) { 461 printf STDERR "Usage: gfx-x11 group reps time\n"; 462 exit(9); 463 } 464 465 my $reps = $args[1]; 466 my $time = $args[2]; 467 468 my $score = runGroup($args[0], $reps, $time); 469 printf STDERR "COUNT|%.1f|0|score\n", $score; 470 471 return 0; 472} 473 474 475exit(main(@ARGV)); 476 477