home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / demos / x11perf / x11perf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-16  |  6.6 KB  |  153 lines

  1. /*****************************************************************************
  2. Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
  3.  
  4.                         All Rights Reserved
  5.  
  6. Permission to use, copy, modify, and distribute this software and its 
  7. documentation for any purpose and without fee is hereby granted, 
  8. provided that the above copyright notice appear in all copies and that
  9. both that copyright notice and this permission notice appear in 
  10. supporting documentation, and that the name of Digital not be
  11. used in advertising or publicity pertaining to distribution of the
  12. software without specific, written prior permission.  
  13.  
  14. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20. SOFTWARE.
  21.  
  22. ******************************************************************************/
  23.  
  24. #ifndef VMS
  25. #include <X11/Xlib.h>
  26. #include <X11/Xutil.h>
  27. #else
  28. #include <decw$include/Xlib.h>
  29. #include <decw$include/Xutil.h>
  30. #endif
  31. #include <X11/Xfuncs.h>
  32. #ifndef NULL
  33. #define NULL 0
  34. #endif
  35.  
  36. #define POLY         1000       /* # (small) items in poly calls    */
  37. #define MAXROWS           40       /* Max rows of items in poly calls      */
  38. #define MAXCOLS           25       /* Max columns of items            */
  39.  
  40. #define WIDTH         600    /* Size of large window to work within  */
  41. #define HEIGHT        600
  42.  
  43. #define CHILDSIZE       8       /* Size of children on windowing tests  */
  44. #define CHILDSPACE      4       /* Space between children        */
  45.  
  46. typedef Bool (*InitProc)    (/* XParms xp; Parms p */);
  47. typedef void (*Proc)        (/* XParms xp; Parms p */);
  48.  
  49. extern void NullProc        (/* XParms xp; Parms p */);
  50. extern Bool NullInitProc    (/* XParms xp; Parms p */);
  51.  
  52. #define VERSION1_2  (1 << 0)
  53. #define VERSION1_3  (1 << 1)
  54. #define VALL        (VERSION1_2 | VERSION1_3)
  55.  
  56. typedef unsigned char Version;
  57.     
  58. typedef struct _Parms {
  59.     /* Required fields */
  60.     int  objects;       /* Number of objects to process in one X call        */
  61.  
  62.     /* Optional fields.  (Wouldn't object-oriented programming be nice ?)   */
  63.     int  special;       /* Usually size of objects to paint            */
  64.     char *font, *bfont;
  65.     int  fillStyle;     /* Solid, transparent stipple, opaque stipple, tile */
  66. } ParmRec, *Parms;
  67.  
  68. typedef struct _XParms {
  69.     Display        *d;
  70.     Window        w;
  71.     GC            fggc;
  72.     GC            bggc;
  73.     unsigned long   foreground;
  74.     unsigned long   background;
  75.     XVisualInfo     vinfo;
  76.     Bool        pack;
  77.     Version        version;
  78. } XParmRec, *XParms;
  79.  
  80. typedef enum {
  81.     WINDOW,     /* Windowing test, rop has no affect            */
  82.     ROP,    /* Graphics test, rop has some affect            */
  83.     NONROP      /* Graphics or overhead test, top has no affect     */
  84. } TestType;
  85.  
  86. typedef struct _Test {
  87.     char    *option;    /* Name to use in prompt line            */
  88.     char    *label;     /* Fuller description of test            */
  89.     InitProc    init;       /* Initialization procedure                */
  90.     Proc    proc;       /* Timed benchmark procedure            */
  91.     Proc    passCleanup;/* Cleanup between repetitions of same test     */
  92.     Proc    cleanup;    /* Cleanup after test                */
  93.     Version     versions;   /* Test in 1.2 only, 1.3 only, or both        */
  94.     TestType    testType;   /* Windowing, graphics rop, graphics non-rop    */
  95.     int        clips;      /* Number of obscuring windows to force clipping*/
  96.     ParmRec     parms;      /* Parameters passed to test procedures        */
  97. } Test;
  98.  
  99. extern Test test[];
  100.  
  101. #define ForEachTest(x) for (x = 0; test[x].option != NULL; x++)
  102.  
  103.  
  104. /*****************************************************************************
  105.  
  106. About x11perf:
  107.  
  108. Many graphics benchmarks assume that the graphics device is used to display the
  109. output of a single fancy graphics application, and that the user gets his work
  110. done on some other device, like a terminal.  Such benchmarks usually measure
  111. drawing speed for lines, polygons, text, etc.
  112.  
  113. Since workstations are not used as standalone graphics engines, but as
  114. super-terminals, x11perf measures window management performance as well as
  115. traditional graphics performace.  x11perf includes benchmarks for the time it
  116. takes to create and map windows (as when you start up an application); to map a
  117. pre-existing set of windows onto the screen (as when you deiconify an
  118. application or pop up a menu); and to rearrange windows (as when you slosh
  119. windows to and fro trying to find the one you want).
  120.  
  121. x11perf also measures graphics performance for operations not normally used in
  122. standalone graphics displays, but are nonetheless used frequently by X
  123. applications.  Such operations include CopyPlane (used by the PostScript
  124. previewer), scrolling (used in text windows), and various stipples and tiles
  125. (used for CAD and half-toning, respectively).
  126.  
  127. x11perf DOES NOT attempt to whittle down measurements to a single ``HeXStones''
  128. number.  We consider such numbers to be uninformative at best and misleading at
  129. worst.  x11perf should be used to analyze particular strengths and weaknesses
  130. of servers, and is most useful when used by a server writer who wants to
  131. analyze and improve a server.
  132.  
  133. For repeatable results, x11perf should be run using a local connection on a
  134. freshly-started server.  The default configuration runs each test 5 times, in
  135. order to see if each trial takes approximately the same amount of time.
  136. Strange glitches should be examined; if non-repeatable I chalk them up to
  137. daemons and network traffic.  Each trial is run for 5 seconds, in order to
  138. reduce random time differences.  The number of objects processed per second is
  139. displayed to 3 significant digits, but you'll be lucky on most UNIX system if
  140. the numbers are actually consistent to 2 digits.
  141.  
  142. The current program is mostly the responsibility of Joel McCormack.  It is
  143. based upon the x11perf developed by Phil Karlton, Susan Angebranndt, and Chris
  144. Kent, who wanted to assess performance differences between various servers.
  145. Mary Walker, Todd Newman, and I added several tests in order to write and tune
  146. the pmax (DECStation 3100) servers.  For a general release to the world, I've
  147. basically rewritten x11perf to ease making comparisons between widely varying
  148. machines, to cover most important X functionality (the notable exception being
  149. wide lines), and to exercise graphics operations in as many different
  150. orientations and alignments as possible.
  151.  
  152. ******************************************************************************/
  153.