home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / x / x11p-13.zip / x11perf.h < prev    next >
C/C++ Source or Header  |  1991-05-02  |  7KB  |  152 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. #ifndef NULL
  32. #define NULL 0
  33. #endif
  34.  
  35. #define POLY         1000       /* # (small) items in poly calls    */
  36. #define MAXROWS           40       /* Max rows of items in poly calls      */
  37. #define MAXCOLS           25       /* Max columns of items            */
  38.  
  39. #define WIDTH         600    /* Size of large window to work within  */
  40. #define HEIGHT        600
  41.  
  42. #define CHILDSIZE       8       /* Size of children on windowing tests  */
  43. #define CHILDSPACE      4       /* Space between children        */
  44.  
  45. typedef Bool (*InitProc)    (/* XParms xp; Parms p */);
  46. typedef void (*Proc)        (/* XParms xp; Parms p */);
  47.  
  48. extern void NullProc        (/* XParms xp; Parms p */);
  49. extern Bool NullInitProc    (/* XParms xp; Parms p */);
  50.  
  51. #define VERSION1_2  (1 << 0)
  52. #define VERSION1_3  (1 << 1)
  53. #define VALL        (VERSION1_2 | VERSION1_3)
  54.  
  55. typedef unsigned char Version;
  56.     
  57. typedef struct _Parms {
  58.     /* Required fields */
  59.     int  objects;       /* Number of objects to process in one X call        */
  60.  
  61.     /* Optional fields.  (Wouldn't object-oriented programming be nice ?)   */
  62.     int  special;       /* Usually size of objects to paint            */
  63.     char *font, *bfont;
  64.     int  fillStyle;     /* Solid, transparent stipple, opaque stipple, tile */
  65. } ParmRec, *Parms;
  66.  
  67. typedef struct _XParms {
  68.     Display        *d;
  69.     Window        w;
  70.     GC            fggc;
  71.     GC            bggc;
  72.     unsigned long   foreground;
  73.     unsigned long   background;
  74.     XVisualInfo     vinfo;
  75.     Bool        pack;
  76.     Version        version;
  77. } XParmRec, *XParms;
  78.  
  79. typedef enum {
  80.     WINDOW,     /* Windowing test, rop has no affect            */
  81.     ROP,    /* Graphics test, rop has some affect            */
  82.     NONROP      /* Graphics or overhead test, top has no affect     */
  83. } TestType;
  84.  
  85. typedef struct _Test {
  86.     char    *option;    /* Name to use in prompt line            */
  87.     char    *label;     /* Fuller description of test            */
  88.     InitProc    init;       /* Initialization procedure                */
  89.     Proc    proc;       /* Timed benchmark procedure            */
  90.     Proc    passCleanup;/* Cleanup between repetitions of same test     */
  91.     Proc    cleanup;    /* Cleanup after test                */
  92.     Version     versions;   /* Test in 1.2 only, 1.3 only, or both        */
  93.     TestType    testType;   /* Windowing, graphics rop, graphics non-rop    */
  94.     int        clips;      /* Number of obscuring windows to force clipping*/
  95.     ParmRec     parms;      /* Parameters passed to test procedures        */
  96. } Test;
  97.  
  98. extern Test test[];
  99.  
  100. #define ForEachTest(x) for (x = 0; test[x].option != NULL; x++)
  101.  
  102.  
  103. /*****************************************************************************
  104.  
  105. About x11perf:
  106.  
  107. Many graphics benchmarks assume that the graphics device is used to display the
  108. output of a single fancy graphics application, and that the user gets his work
  109. done on some other device, like a terminal.  Such benchmarks usually measure
  110. drawing speed for lines, polygons, text, etc.
  111.  
  112. Since workstations are not used as standalone graphics engines, but as
  113. super-terminals, x11perf measures window management performance as well as
  114. traditional graphics performace.  x11perf includes benchmarks for the time it
  115. takes to create and map windows (as when you start up an application); to map a
  116. pre-existing set of windows onto the screen (as when you deiconify an
  117. application or pop up a menu); and to rearrange windows (as when you slosh
  118. windows to and fro trying to find the one you want).
  119.  
  120. x11perf also measures graphics performance for operations not normally used in
  121. standalone graphics displays, but are nonetheless used frequently by X
  122. applications.  Such operations include CopyPlane (used by the PostScript
  123. previewer), scrolling (used in text windows), and various stipples and tiles
  124. (used for CAD and half-toning, respectively).
  125.  
  126. x11perf DOES NOT attempt to whittle down measurements to a single ``HeXStones''
  127. number.  We consider such numbers to be uninformative at best and misleading at
  128. worst.  x11perf should be used to analyze particular strengths and weaknesses
  129. of servers, and is most useful when used by a server writer who wants to
  130. analyze and improve a server.
  131.  
  132. For repeatable results, x11perf should be run using a local connection on a
  133. freshly-started server.  The default configuration runs each test 5 times, in
  134. order to see if each trial takes approximately the same amount of time.
  135. Strange glitches should be examined; if non-repeatable I chalk them up to
  136. daemons and network traffic.  Each trial is run for 5 seconds, in order to
  137. reduce random time differences.  The number of objects processed per second is
  138. displayed to 3 significant digits, but you'll be lucky on most UNIX system if
  139. the numbers are actually consistent to 2 digits.
  140.  
  141. The current program is mostly the responsibility of Joel McCormack.  It is
  142. based upon the x11perf developed by Phil Karlton, Susan Angebranndt, and Chris
  143. Kent, who wanted to assess performance differences between various servers.
  144. Mary Walker, Todd Newman, and I added several tests in order to write and tune
  145. the pmax (DECStation 3100) servers.  For a general release to the world, I've
  146. basically rewritten x11perf to ease making comparisons between widely varying
  147. machines, to cover most important X functionality (the notable exception being
  148. wide lines), and to exercise graphics operations in as many different
  149. orientations and alignments as possible.
  150.  
  151. ******************************************************************************/
  152.