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