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