x11perf.h revision 533545b5
1/*****************************************************************************
2Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
3
4                        All Rights Reserved
5
6Permission to use, copy, modify, and distribute this software and its
7documentation for any purpose and without fee is hereby granted,
8provided that the above copyright notice appear in all copies and that
9both that copyright notice and this permission notice appear in
10supporting documentation, and that the name of Digital not be
11used in advertising or publicity pertaining to distribution of the
12software without specific, written prior permission.
13
14DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20SOFTWARE.
21
22******************************************************************************/
23
24#if HAVE_CONFIG_H
25#include "config.h"
26#endif
27
28#ifndef VMS
29#include <X11/Xlib.h>
30#include <stdlib.h>
31#include <X11/Xutil.h>
32#else
33#include <decw$include/Xlib.h>
34#include <decw$include/Xutil.h>
35#endif
36#if defined(XlibSpecificationRelease) && XlibSpecificationRelease >= 5
37#include <X11/Xfuncs.h>
38#endif
39#include <stddef.h>
40#include <X11/extensions/Xrender.h>
41
42#define POLY	     1000       /* # (small) items in poly calls	*/
43#define MAXROWS	       40       /* Max rows of items in poly calls      */
44#define MAXCOLS	       25       /* Max columns of items			*/
45
46#define WIDTH         600	/* Size of large window to work within  */
47#define HEIGHT        600
48
49#define CHILDSIZE       8       /* Size of children on windowing tests  */
50#define CHILDSPACE      4       /* Space between children		*/
51
52#define BigTile	((char *)2)		/* Big tile/stipple */
53#define OddTile	((char *)1)		/* Odd sized tile/stipple */
54
55#define PictStandardNative    5
56
57typedef unsigned char Version;
58
59#define VERSION1_2  ((Version)(1 << 0))
60#define VERSION1_3  ((Version)(1 << 1))
61#define VERSION1_4  ((Version)(1 << 2))
62#define VERSION1_5  ((Version)(1 << 3))
63#define VERSION1_6  ((Version)(1 << 4))
64#define V1_2ONLY VERSION1_2
65#define V1_2FEATURE	(VERSION1_2 | VERSION1_3 | VERSION1_4 | VERSION1_5 | VERSION1_6)
66#define V1_3FEATURE	(VERSION1_3 | VERSION1_4 | VERSION1_5 | VERSION1_6)
67#define V1_4FEATURE	(VERSION1_4 | VERSION1_5 | VERSION1_6)
68#define V1_5FEATURE     (VERSION1_5 | VERSION1_6)
69#define V1_6FEATURE     (VERSION1_6)
70
71typedef struct _Parms {
72    /* Required fields */
73    int  objects;       /* Number of objects to process in one X call	    */
74
75    /* Optional fields.  (Wouldn't object-oriented programming be nice ?)   */
76    int  special;       /* Usually size of objects to paint		    */
77    const char *font, *bfont;
78    int  fillStyle;     /* Solid, transparent stipple, opaque stipple, tile */
79} ParmRec, *Parms;
80
81typedef struct _XParms {
82    Display	    *d;
83    Window	    w;
84    Pixmap          p;
85    GC		    fggc;
86    GC		    bggc;
87    GC		    ddfggc;
88    GC		    ddbggc;
89    Picture	    w_picture;
90    Picture	    p_picture;
91    unsigned long   foreground;
92    unsigned long   background;
93    unsigned long   ddbackground;
94    XVisualInfo     vinfo;
95    Bool	    pack;
96    Version	    version;
97    Bool	    save_under;
98    int		    backing_store;
99    unsigned long   planemask;
100    int		    func;
101    int		    format;
102    Colormap	    cmap;
103} XParmRec, *XParms;
104
105typedef int (*InitProc)(XParms xp, Parms p, int64_t reps);
106typedef void (*Proc)(XParms xp, Parms p, int64_t reps);
107typedef void (*CleanupProc)(XParms xp, Parms p);
108
109typedef enum {
110    WINDOW,     /* Windowing test, rop, planemask have no affect	*/
111    ROP,	/* Graphics test, rop, planemask has some affect	*/
112    PLANEMASK,  /* Graphics test, rop no affect, planemask some affect  */
113    NONROP,     /* Graphics or overhead test, rop has no affect		*/
114    COMP        /* Graphics test, render op                             */
115} TestType;
116
117typedef struct _Test {
118    const char	*option;    /* Name to use in prompt line		    */
119    const char	*label;     /* Fuller description of test		    */
120    const char	*label14;   /* Labels that are different in Version 1.4     */
121    InitProc    init;       /* Initialization procedure			    */
122    Proc	proc;       /* Timed benchmark procedure		    */
123    CleanupProc	passCleanup;/* Cleanup between repetitions of same test     */
124    CleanupProc	cleanup;    /* Cleanup after test			    */
125    Version     versions;   /* Test in 1.2 only, 1.3 only, or both	    */
126    TestType    testType;   /* Windowing, graphics rop, graphics non-rop    */
127    int		clips;      /* Number of obscuring windows to force clipping*/
128    ParmRec     parms;      /* Parameters passed to test procedures	    */
129} Test;
130
131extern void NullProc(XParms xp, Parms p);
132extern int NullInitProc(XParms xp, Parms p, int64_t reps);
133
134extern Test test[];
135
136extern int abortTest;
137
138extern void AbortTest (void) _X_NORETURN;
139
140#define CheckAbort()  if (abortTest) AbortTest ()
141#define ForEachTest(x) for (x = 0; test[x].option != NULL; x++)
142
143
144/* do_arcs.c */
145extern int InitCircles ( XParms xp, Parms p, int64_t reps );
146extern int InitPartCircles ( XParms xp, Parms p, int64_t reps );
147extern int InitChordPartCircles ( XParms xp, Parms p, int64_t reps );
148extern int InitSlicePartCircles ( XParms xp, Parms p, int64_t reps );
149extern int InitWideCircles ( XParms xp, Parms p, int64_t reps );
150extern int InitPartWideCircles ( XParms xp, Parms p, int64_t reps );
151extern int InitDashedCircles ( XParms xp, Parms p, int64_t reps );
152extern int InitWideDashedCircles ( XParms xp, Parms p, int64_t reps );
153extern int InitDoubleDashedCircles ( XParms xp, Parms p, int64_t reps );
154extern int InitWideDoubleDashedCircles ( XParms xp, Parms p, int64_t reps );
155extern int InitEllipses ( XParms xp, Parms p, int64_t reps );
156extern int InitPartEllipses ( XParms xp, Parms p, int64_t reps );
157extern int InitChordPartEllipses ( XParms xp, Parms p, int64_t reps );
158extern int InitSlicePartEllipses ( XParms xp, Parms p, int64_t reps );
159extern int InitWideEllipses ( XParms xp, Parms p, int64_t reps );
160extern int InitPartWideEllipses ( XParms xp, Parms p, int64_t reps );
161extern int InitDashedEllipses ( XParms xp, Parms p, int64_t reps );
162extern int InitWideDashedEllipses ( XParms xp, Parms p, int64_t reps );
163extern int InitDoubleDashedEllipses ( XParms xp, Parms p, int64_t reps );
164extern int InitWideDoubleDashedEllipses ( XParms xp, Parms p, int64_t reps );
165extern void DoArcs ( XParms xp, Parms p, int64_t reps );
166extern void DoFilledArcs ( XParms xp, Parms p, int64_t reps );
167extern void EndArcs ( XParms xp, Parms p );
168
169/* do_blt.c */
170extern int InitScroll ( XParms xp, Parms p, int64_t reps );
171extern void DoScroll ( XParms xp, Parms p, int64_t reps );
172extern void MidScroll ( XParms xp, Parms p );
173extern void EndScroll ( XParms xp, Parms p );
174extern int InitCopyWin ( XParms xp, Parms p, int64_t reps );
175extern int InitCopyPix ( XParms xp, Parms p, int64_t reps );
176extern int InitGetImage ( XParms xp, Parms p, int64_t reps );
177extern int InitPutImage ( XParms xp, Parms p, int64_t reps );
178extern void DoCopyWinWin ( XParms xp, Parms p, int64_t reps );
179extern void DoCopyPixWin ( XParms xp, Parms p, int64_t reps );
180extern void DoCopyWinPix ( XParms xp, Parms p, int64_t reps );
181extern void DoCopyPixPix ( XParms xp, Parms p, int64_t reps );
182extern void DoGetImage ( XParms xp, Parms p, int64_t reps );
183extern void DoPutImage ( XParms xp, Parms p, int64_t reps );
184#ifdef MITSHM
185extern int InitShmPutImage ( XParms xp, Parms p, int64_t reps );
186extern int InitShmGetImage ( XParms xp, Parms p, int64_t reps );
187extern void DoShmPutImage ( XParms xp, Parms p, int64_t reps );
188extern void DoShmGetImage ( XParms xp, Parms p, int64_t reps );
189extern void EndShmPutImage ( XParms xp, Parms p );
190extern void EndShmGetImage ( XParms xp, Parms p );
191#endif
192extern void MidCopyPix ( XParms xp, Parms p );
193extern void EndCopyWin ( XParms xp, Parms p );
194extern void EndCopyPix ( XParms xp, Parms p );
195extern void EndGetImage ( XParms xp, Parms p );
196extern int InitCopyPlane ( XParms xp, Parms p, int64_t reps );
197extern void DoCopyPlane ( XParms xp, Parms p, int64_t reps );
198
199int
200InitCompositeWin(XParms xp, Parms p, int64_t reps);
201
202void
203EndCompositeWin (XParms xp, Parms p);
204
205void
206DoCompositeWinWin (XParms xp, Parms p, int64_t reps);
207
208int
209InitCompositePix(XParms xp, Parms p, int64_t reps);
210
211void
212EndCompositePix (XParms xp, Parms p);
213
214void
215DoCompositePixWin (XParms xp, Parms p, int64_t reps);
216
217/* do_complex.c */
218extern int InitComplexPoly ( XParms xp, Parms p, int64_t reps );
219extern void DoComplexPoly ( XParms xp, Parms p, int64_t reps );
220extern void EndComplexPoly ( XParms xp, Parms p );
221extern int InitGeneralPoly ( XParms xp, Parms p, int64_t reps );
222extern void DoGeneralPoly ( XParms xp, Parms p, int64_t reps );
223
224/* do_dots.c */
225extern int InitDots ( XParms xp, Parms p, int64_t reps );
226extern void DoDots ( XParms xp, Parms p, int64_t reps );
227extern void EndDots ( XParms xp, Parms p );
228
229/* do_lines.c */
230extern int InitLines ( XParms xp, Parms p, int64_t reps );
231extern int InitWideLines ( XParms xp, Parms p, int64_t reps );
232extern int InitDashedLines ( XParms xp, Parms p, int64_t reps );
233extern int InitWideDashedLines ( XParms xp, Parms p, int64_t reps );
234extern int InitDoubleDashedLines ( XParms xp, Parms p, int64_t reps );
235extern int InitWideDoubleDashedLines ( XParms xp, Parms p, int64_t reps );
236extern void DoLines ( XParms xp, Parms p, int64_t reps );
237extern void EndLines ( XParms xp, Parms p );
238
239/* do_movewin.c */
240extern int InitMoveWindows ( XParms xp, Parms p, int64_t reps );
241extern void DoMoveWindows ( XParms xp, Parms p, int64_t reps );
242extern void EndMoveWindows ( XParms xp, Parms p );
243extern void DoResizeWindows ( XParms xp, Parms p, int64_t reps );
244extern int InitCircWindows ( XParms xp, Parms p, int64_t reps );
245extern void DoCircWindows ( XParms xp, Parms p, int64_t reps );
246extern void EndCircWindows ( XParms xp, Parms p );
247extern int InitMoveTree ( XParms xp, Parms p, int64_t reps );
248extern void DoMoveTree ( XParms xp, Parms p, int64_t reps );
249extern void EndMoveTree ( XParms xp, Parms p );
250
251/* do_rects.c */
252extern int InitRectangles ( XParms xp, Parms p, int64_t reps );
253extern void DoRectangles ( XParms xp, Parms p, int64_t reps );
254extern void DoOutlineRectangles ( XParms xp, Parms p, int64_t reps );
255extern void EndRectangles ( XParms xp, Parms p );
256
257/* do_segs.c */
258extern int InitSegments ( XParms xp, Parms p, int64_t reps );
259extern int InitDashedSegments ( XParms xp, Parms p, int64_t reps );
260extern int InitDoubleDashedSegments ( XParms xp, Parms p, int64_t reps );
261extern int InitHorizSegments ( XParms xp, Parms p, int64_t reps );
262extern int InitWideHorizSegments ( XParms xp, Parms p, int64_t reps );
263extern int InitVertSegments ( XParms xp, Parms p, int64_t reps );
264extern int InitWideVertSegments ( XParms xp, Parms p, int64_t reps );
265extern void DoSegments ( XParms xp, Parms p, int64_t reps );
266extern void EndSegments ( XParms xp, Parms p );
267
268/* do_simple.c */
269extern void DoNoOp ( XParms xp, Parms p, int64_t reps );
270extern void DoGetAtom ( XParms xp, Parms p, int64_t reps );
271extern void DoQueryPointer ( XParms xp, Parms p, int64_t reps );
272extern int InitGetProperty ( XParms xp, Parms p, int64_t reps );
273extern void DoGetProperty ( XParms xp, Parms p, int64_t reps );
274
275/* do_text.c */
276extern int InitText ( XParms xp, Parms p, int64_t reps );
277extern int InitText16 ( XParms xp, Parms p, int64_t reps );
278extern void DoText ( XParms xp, Parms p, int64_t reps );
279extern void DoText16 ( XParms xp, Parms p, int64_t reps );
280extern void DoPolyText ( XParms xp, Parms p, int64_t reps );
281extern void DoPolyText16 ( XParms xp, Parms p, int64_t reps );
282extern void DoImageText ( XParms xp, Parms p, int64_t reps );
283extern void DoImageText16 ( XParms xp, Parms p, int64_t reps );
284extern void ClearTextWin ( XParms xp, Parms p );
285extern void EndText ( XParms xp, Parms p );
286extern void EndText16 ( XParms xp, Parms p );
287#ifdef XFT
288extern int InitAAText (XParms xp, Parms p, int64_t reps );
289extern void DoAAText (XParms xp, Parms p, int64_t reps );
290extern void EndAAText ( XParms xp, Parms p );
291#endif
292
293/* do_traps.c */
294extern int InitTrapezoids ( XParms xp, Parms p, int64_t reps );
295extern void DoTrapezoids ( XParms xp, Parms p, int64_t reps );
296extern void EndTrapezoids ( XParms xp, Parms p );
297#if defined(XRENDER) && defined(XFT)
298extern int InitFixedTraps ( XParms xp, Parms p, int64_t reps );
299extern void DoFixedTraps ( XParms xp, Parms p, int64_t reps );
300extern void EndFixedTraps ( XParms xp, Parms p );
301extern int InitFixedTrapezoids ( XParms xp, Parms p, int64_t reps );
302extern void DoFixedTrapezoids ( XParms xp, Parms p, int64_t reps );
303extern void EndFixedTrapezoids ( XParms xp, Parms p );
304#endif
305
306/* do_tris.c */
307extern int InitTriangles ( XParms xp, Parms p, int64_t reps );
308extern void DoTriangles ( XParms xp, Parms p, int64_t reps );
309extern void EndTriangles ( XParms xp, Parms p );
310
311/* do_valgc.c */
312extern int InitGC ( XParms xp, Parms p, int64_t reps );
313extern void DoChangeGC ( XParms xp, Parms p, int64_t reps );
314extern void EndGC ( XParms xp, Parms p );
315
316/* do_windows.c */
317extern int CreateParents ( XParms xp, Parms p, int64_t reps );
318extern void MapParents ( XParms xp, Parms p, int64_t reps );
319extern void MapParentsCleanup ( XParms xp, Parms p );
320extern int InitCreate ( XParms xp, Parms p, int64_t reps );
321extern void CreateChildren ( XParms xp, Parms p, int64_t reps );
322extern void DestroyChildren ( XParms xp, Parms p );
323extern void EndCreate ( XParms xp, Parms p );
324extern int InitMap ( XParms xp, Parms p, int64_t reps );
325extern void UnmapParents ( XParms xp, Parms p, int64_t reps );
326extern void UnmapParentsCleanup ( XParms xp, Parms p);
327extern int InitDestroy ( XParms xp, Parms p, int64_t reps );
328extern void DestroyParents ( XParms xp, Parms p, int64_t reps );
329extern void RenewParents ( XParms xp, Parms p );
330extern int InitPopups ( XParms xp, Parms p, int64_t reps );
331extern void DoPopUps ( XParms xp, Parms p, int64_t reps );
332extern void EndPopups ( XParms xp, Parms p );
333
334
335/*****************************************************************************
336
337About x11perf:
338
339Many graphics benchmarks assume that the graphics device is used to display the
340output of a single fancy graphics application, and that the user gets his work
341done on some other device, like a terminal.  Such benchmarks usually measure
342drawing speed for lines, polygons, text, etc.
343
344Since workstations are not used as standalone graphics engines, but as
345super-terminals, x11perf measures window management performance as well as
346traditional graphics performace.  x11perf includes benchmarks for the time it
347takes to create and map windows (as when you start up an application); to map a
348pre-existing set of windows onto the screen (as when you deiconify an
349application or pop up a menu); and to rearrange windows (as when you slosh
350windows to and fro trying to find the one you want).
351
352x11perf also measures graphics performance for operations not normally used in
353standalone graphics displays, but are nonetheless used frequently by X
354applications.  Such operations include CopyPlane (used by the PostScript
355previewer), scrolling (used in text windows), and various stipples and tiles
356(used for CAD and half-toning, respectively).
357
358x11perf DOES NOT attempt to whittle down measurements to a single ``HeXStones''
359number.  We consider such numbers to be uninformative at best and misleading at
360worst.  x11perf should be used to analyze particular strengths and weaknesses
361of servers, and is most useful when used by a server writer who wants to
362analyze and improve a server.
363
364For repeatable results, x11perf should be run using a local connection on a
365freshly-started server.  The default configuration runs each test 5 times, in
366order to see if each trial takes approximately the same amount of time.
367Strange glitches should be examined; if non-repeatable I chalk them up to
368daemons and network traffic.  Each trial is run for 5 seconds, in order to
369reduce random time differences.  The number of objects processed per second is
370displayed to 3 significant digits, but you'll be lucky on most UNIX system if
371the numbers are actually consistent to 2 digits.
372
373The current program is mostly the responsibility of Joel McCormack.  It is
374based upon the x11perf developed by Phil Karlton, Susan Angebranndt, and Chris
375Kent, who wanted to assess performance differences between various servers.
376Mary Walker, Todd Newman, and I added several tests in order to write and tune
377the pmax (DECStation 3100) servers.  For a general release to the world, I've
378basically rewritten x11perf to ease making comparisons between widely varying
379machines, to cover most important X functionality (the notable exception being
380wide lines), and to exercise graphics operations in as many different
381orientations and alignments as possible.
382
383******************************************************************************/
384