v03i059: xbench -- benchmark X servers, Part02/04

Dan Heller argv at island.uu.net
Wed Mar 29 04:06:57 AEST 1989


Submitted-by: Claus Gittinger <unido!sinix!claus>
Posting-number: Volume 3, Issue 59
Archive-name: xbench/part02

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 4)."
# Contents:  Imakefile bitmapcpy.c dline.c dobenches.c line.c mkfile
#   pixmapcpy.c results/9733.R2.out results/gpx.R2.out stiprects.c
#   tiledrects.c wline.c xbench.man
# Wrapped by x11 at babel on Thu Mar 23 14:07:57 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Imakefile'\"
else
echo shar: Extracting \"'Imakefile'\" \(3191 characters\)
sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
X/* @(#)Imakefile	1.9 89/03/23 */
X/*
X * change for your printer
X * TROFF should be defined to [nt]roff an ms document and print it
X *
X * the line below is for our local machine
X */
TROFF=troff -Tpsc -ms | psdit | psprint
X/*
X * to use nroff uncomment next line and comment prev. line
X */
X/* TROFF=nroff -ms | lpr */
X
X/*
X * rest is portable
X */
SRCS=hline.c vline.c sline.c rects.c fillrects.c invrects.c \
X	 dline.c wline.c imagestr.c screencpy.c pixmapcpy.c  \
X	 scroll.c bitmapcpy.c tiledrects.c stiprects.c      \
X	 arcs.c filledarcs.c filledpoly.c complex1.c line.c \
X	 main.c dobenches.c
X
OBJS=hline.o vline.o sline.o rects.o fillrects.o invrects.o \
X	 dline.o wline.o imagestr.o screencpy.o pixmapcpy.o  \
X	 scroll.o bitmapcpy.o tiledrects.o stiprects.o      \
X	 arcs.o filledarcs.o filledpoly.o complex1.o line.o \
X	 main.o dobenches.o
X
HDR=\
X       externals.h \
X       benches.h \
X       patchlevel.h \
X       stipple1.bit \
X       stipple2.bit \
X       tile1.bit \
X       tile2.bit \
X       bitmap1.bit
DOC=\
X       README \
X       AUTHOR \
X       xbench.man \
X       xbench.doc
STUFF=\
X       Imakefile \
X       mkfile \
X       script.run
SCRIPTS=\
X       scripts \
X       results \
X       results/sun3-50.R3.out  \
X       results/sun3-160.R2.out \
X       results/gpx.R2.out      \
X       results/9733.R2.out     \
X       scripts/Make.proto      \
X       scripts/detail.awk       \
X       scripts/summary.awk       \
X       scripts/xstones.awk       \
X       scripts/insSep.sh         \
X       scripts/postfix.ms        \
X       scripts/prefix.ms
X
LOCAL_LIBRARIES = $(XLIB)
X
ComplexProgramTarget(xbench)
X
dobenches.o:    benches.h
X
kit:
X	-makekit $(DOC) $(SRCS) $(HDR) $(STUFF) $(SCRIPTS) > /dev/null
X
printdoc:   xbench.doc
X	    tbl xbench.doc | $(TROFF)
X
print:      summary detail
X	    tbl summary.ms detail.ms | $(TROFF)
X
X/*
X * summary:
X *  create a makefile to collect all .out-file data into summary.raw
X *  make summary.raw using this makefile
X *  sort it and make an ms format document
X */
summary:            results tmp summary.ms
X
printsummary:       summary
X		    tbl summary.ms | $(TROFF)
X
detail:             results tmp detail.ms
X
printdetail:        detail
X		    tbl detail.ms | $(TROFF)
X
results:
X		    @echo You must put all .out files into
X		    @echo a subdirectory named: results
X		    exit 1
X
tmp:
X		    mkdir tmp
X
summary.ms:         tmp/makefile
X		    (cd tmp; make summary.ms)
X		    mv tmp/summary.ms .
X
detail.ms:          tmp/makefile
X		    (cd tmp; make detail.ms)
X		    mv tmp/detail.ms .
X
X/*
X * whenever a file is added to the results directory,
X * recreate the makefile in the tmp directory
X */
tmp/makefile:       results
X		    -(files=""; \
X		      sfiles=""; \
X		      cd results; \
X		      for i in *.out; do     \
X			sfiles="$$sfiles $$i""__" ; \
X			files="$$files $$i"; \
X		      done; \
X		      cd ..; \
X		      echo "SFILES=$$sfiles" > tmp/makefile; \
X		      echo >> tmp/makefile; \
X		      for i in $$files; do     \
X			echo $$i"__: " $$i"_" >> tmp/makefile; \
X			echo >> tmp/makefile; \
X			echo $$i"_: " $$i >> tmp/makefile; \
X			echo >> tmp/makefile; \
X		      done)
X		    echo >> tmp/makefile
X		    cat scripts/Make.proto >> tmp/makefile
END_OF_FILE
if test 3191 -ne `wc -c <'Imakefile'`; then
    echo shar: \"'Imakefile'\" unpacked with wrong size!
fi
# end of 'Imakefile'
fi
if test -f 'bitmapcpy.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'bitmapcpy.c'\"
else
echo shar: Extracting \"'bitmapcpy.c'\" \(2760 characters\)
sed "s/^X//" >'bitmapcpy.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)bitmapcpy.c	1.1 89/02/08";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X#include "bitmap1.bit"
X
static GC myGC;
static Pixmap thePixmap;
X
X/*
X * bitmap->screen copy plane
X *
X * used for drawing pictures, icons and in some textsystems which
X * use their own fonts in bitmaps.
X */
X
bitmapcopy_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int depth;
X	Pixmap      pattern;
X	GC tmpGC;
X
X	depth = DefaultDepth(dpy, screen);
X	myGC = XCreateGC(dpy, win, 0L, NULL);
X	if (! myGC) return 1;
X	XSetForeground(dpy, myGC, WhitePixel(dpy, screen));
X	XSetBackground(dpy, myGC, BlackPixel(dpy, screen));
X
X	pattern = XCreateBitmapFromData(dpy, win, bitmap1_bits,
X						  bitmap1_width,
X						  bitmap1_height);
X	if (!pattern) return 1;
X
X	/*
X	 * create a bitmap and fill it with the pattern
X	 */
X	tmpGC = XCreateGC(dpy, pattern, 0L, NULL);
X	if (! tmpGC) return 1;
X	XSetForeground(dpy, tmpGC, 1);
X	XSetBackground(dpy, tmpGC, 0);
X
X	thePixmap = XCreatePixmap(dpy, win, len, len, 1);
X	if (! thePixmap) return 1;
X
X	XSetStipple(dpy, tmpGC, pattern);
X	XSetFillStyle(dpy, tmpGC, FillOpaqueStippled);
X	XFillRectangle(dpy, thePixmap, tmpGC, 0, 0, len, len);
X
X	XFreeGC(dpy, tmpGC);
X	XFreePixmap(dpy, pattern);
X	return 0;
X}
X
bitmapcopy_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, myGC);
X	XFreePixmap(dpy, thePixmap);
X}
X
bitmapcopy_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int ncopy;
X	int x = 0, y = 0;
X
X	ncopy= 0;
X	while (benchRunning) {
X	    XCopyPlane(dpy, thePixmap, win, myGC, 0, 0, len, len, x, y, 1);
X	    x = (x + 1) & 0x0F;
X	    y = (y + 1) & 0x0F;
X	    if (sync) XSync(dpy, 0);
X	    ncopy += 1;
X	}
X	return ncopy;
X}
X
bitmapcopy_msg(deltaT, ncopy, len, rate)
double rate;
X{
X	printf("COPYPLANE (BITMAP->SCREEN)\n");
X	printf("\n");
X	printf("%d copies with %d pixel sides in %d secs\n",
X				ncopy, len, deltaT);
X	printf("rate = %8.2f copies/sec (%d Pixels/sec)\n",
X				rate, (ncopy*len*len)/deltaT);
X}
END_OF_FILE
if test 2760 -ne `wc -c <'bitmapcpy.c'`; then
    echo shar: \"'bitmapcpy.c'\" unpacked with wrong size!
fi
# end of 'bitmapcpy.c'
fi
if test -f 'dline.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dline.c'\"
else
echo shar: Extracting \"'dline.c'\" \(3026 characters\)
sed "s/^X//" >'dline.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)dline.c	1.2 89/02/22";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X
static GC drawWhite, drawBlack;
static XSegment *segments;
X#define NSEG    64
X
X/*
X * dashed lines
X *
X * currently used in bitmap - as cad applications will
X * appear, this (and fat lines) may be used more often
X */
dline_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int i;
X	XSegment *sp;
X
X	drawWhite = XCreateGC(dpy, win, 0L, NULL);
X	if (! drawWhite) return 1;
X	XSetForeground(dpy, drawWhite, WhitePixel(dpy, screen));
X	XSetBackground(dpy, drawWhite, BlackPixel(dpy, screen));
X	XSetLineAttributes(dpy, drawWhite, 0, LineOnOffDash, CapButt, JoinMiter);
X
X	drawBlack = XCreateGC(dpy, win, 0L, NULL);
X	if (!drawBlack) return 1;
X	XSetForeground(dpy, drawBlack, BlackPixel(dpy, screen));
X	XSetBackground(dpy, drawBlack, WhitePixel(dpy, screen));
X	XSetLineAttributes(dpy, drawBlack, 0, LineOnOffDash, CapButt, JoinMiter);
X
X	segments = (XSegment *)malloc(sizeof(XSegment) * 6 * NSEG);
X	if (segments == (XSegment *)0)
X	    return 1;
X
X	sp = segments;
X	for (i=0; i<NSEG; i++) {
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i+len; sp->y1 = i;
X	    sp->x2 = i; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i+len; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i+len;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X	}
X	return 0;
X}
X
dline_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, drawWhite);
X	XFreeGC(dpy, drawBlack);
X	free(segments);
X}
X
dline_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int nline;
X
X	nline = 0;
X	while (benchRunning) {
X	    XDrawSegments(dpy, win, drawWhite, segments, 6*NSEG);
X	    XDrawSegments(dpy, win, drawBlack, segments, 6*NSEG);
X	    nline += NSEG * 6 * 2;
X	    if (sync) XSync(dpy, 0);
X	}
X	return nline;
X}
X
dline_msg(deltaT, nline, len, rate)
double rate;
X{
X	printf("DASHED LINES\n");
X	printf("\n");
X	printf("%d dashed vectors of len. %d in %d secs\n",
X				nline, len, deltaT);
X	printf("rate = %8.2f vectors/sec\n", rate);
X}
END_OF_FILE
if test 3026 -ne `wc -c <'dline.c'`; then
    echo shar: \"'dline.c'\" unpacked with wrong size!
fi
# end of 'dline.c'
fi
if test -f 'dobenches.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'dobenches.c'\"
else
echo shar: Extracting \"'dobenches.c'\" \(5115 characters\)
sed "s/^X//" >'dobenches.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)dobenches.c	1.6 89/02/22";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <signal.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "benches.h"
X#include "externals.h"
X
int benchRunning;
X
static stopBench() {
X	benchRunning = 0;
X}
X
doBenches(dpy, win, ask, nruns, timeGoal, level, onlyList, exclList)
Display *dpy;
Window win;
char *onlyList[], *exclList[];
X{
X	int     index;
X	long    startTime;
X	long    endTime;
X	long    deltaT;
X	FUNCPTR setupFunc, benchFunc, cleanupFunc, messageFunc;
X	int     benchArg;
X	int     benchCount, maxBenchCount, maxDeltaT;
X	int     error, run;
X	int     exclude;
X	XImage  img;
X	unsigned allplanes = 0xFFFFFFFF;
X	double   perf;
X	char     buffer[80];
X	int	 savSync;
X
X	index = 0;
X
X	savSync = sync;
X	for ( ;benchList[index].benchFunc != NOFUNC; index++) {
X	    sync = savSync;
X	    exclude = 0;
X	    if (onlyList[0] != NULL) {
X		if (! isInList(benchList[index].name, onlyList))
X		    exclude = 1;
X	    }
X	    if (exclList[0] != NULL) {
X		if (isInList(benchList[index].name, exclList))
X		    exclude = 1;
X	    }
X
X	    if (benchList[index].level <= level) {
X		if (! exclude) {
X		    if (ask) {
X			int c;
X
X			XSync(dpy, 0);
X			fprintf(stderr, "next bench: %s wanted? (y/s/n) ",
X						benchList[index].name);
X			do {
X			    c = getchar();
X			    if (c == '!') {
X			        while (c != '\n') c = getchar();
X			    }
X			} while ((c != 'y') && (c != 'n') && (c != 's'));
X
X			if (c == 'n')
X			    exclude = 1;
X			if (c == 's')
X			    sync = 1;
X			XSync(dpy, 0);
X		    }
X
X		    if (! exclude) {
X			setupFunc = benchList[index].setupFunc;
X			benchFunc = benchList[index].benchFunc;
X			cleanupFunc = benchList[index].cleanupFunc;
X			messageFunc = benchList[index].messageFunc;
X			benchArg = benchList[index].benchArg;
X
X			XMapWindow(dpy, win);
X			XClearWindow(dpy, win);
X
X			if (setupFunc != NOFUNC)
X			    error = (*setupFunc)(dpy, win, benchArg);
X
X			if (! error) {
X			    maxBenchCount = 0;
X			    for (run=1; run <= nruns; run++) {
X			        sprintf(buffer, "%s run %d", 
X						benchList[index].name, run);
X			        XDrawImageString(dpy, win, 
X						 DefaultGC(dpy, 
X							   DefaultScreen(dpy)),
X						 0, screenHeight-10,
X						 buffer, strlen(buffer));
X
X				XSync(dpy, 1);
X				sleep(1);
X				benchRunning = 1;
X				signal(SIGALRM, stopBench);
X				alarm(timeGoal, stopBench);
X				startTime = time(0);
X				benchCount = (*benchFunc)(dpy, win, benchArg);
X
X				XSync(dpy, 0);
X				/*
X				 * sorry about this ...
X				 * since there are servers with (big)
X				 * command queues to the display hardware
X				 * and I want to know, when the picture is on
X				 * the screen - (not in the server)
X				 * Im doing a small get image to really sync
X				 * I hope, the getimage on the tested
X				 * server is not too slow to make the whole
X				 * benchmark data unusable.
X				 */
X				XGetImage(dpy, win, 0, 0, 1, 1,
X						    XAllPlanes(), ZPixmap);
X
X				endTime = time(0);
X				deltaT = endTime - startTime;
X				if (benchCount > maxBenchCount) {
X				    maxBenchCount = benchCount;
X				    maxDeltaT = deltaT;
X				}
X			    }
X
X			    if (cleanupFunc != NOFUNC)
X				(*cleanupFunc)(dpy, win, benchArg);
X			    XSync(dpy, 1);
X			}
X			XUnmapWindow(dpy, win);
X		    }
X		}
X
X		printf("========= %s ========= %s\n",
X			benchList[index].name,
X			sync ? "sync" : "");
X
X		if (exclude || error) {
X		    printf("TEST NOT RUN\n");
X		} else {
X		    perf = (double)(maxBenchCount)/(double)(maxDeltaT);
X		    (*messageFunc)(maxDeltaT, maxBenchCount, benchArg, perf);
X		}
X		fflush(stdout);
X	    }
X	}
X	printf("==================================================\n");
X	printf("\n");
X}
X
X#define LINELEN 79
listBenches()
X{
X	int     col, index;
X	char lineBuffer[LINELEN+1];
X
X	printf("available benches:\n");
X	printf("\n");
X	col = 0;
X	strblank(lineBuffer, LINELEN);
X	for (index=0; benchList[index].benchFunc != NOFUNC; index++) {
X	    strinsert(lineBuffer, benchList[index].name, col*19);
X	    col++;
X	    if (col == 4) {
X		printf("%s\n", lineBuffer);
X		col = 0;
X		strblank(lineBuffer, LINELEN);
X	    }
X	}
X	printf("%s\n", lineBuffer);
X}
X
static strblank(s, n)
char *s;
X{
X	while (n--) *s++ = ' ';
X	*s++ = '\0';
X}
X
static strinsert(s1, s2, pos)
char *s1, *s2;
X{
X	s1 += pos;
X	while (*s2) {
X	    *s1++ = *s2++;
X	}
X}
X
static isInList(s, l)
char *s;
char *l[];
X{
X	int index;
X
X	for (index=0; l[index] != NULL; index++) {
X	    if (strcmp(s, l[index])==0) return 1;
X	}
X	return 0;
X}
END_OF_FILE
if test 5115 -ne `wc -c <'dobenches.c'`; then
    echo shar: \"'dobenches.c'\" unpacked with wrong size!
fi
# end of 'dobenches.c'
fi
if test -f 'line.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'line.c'\"
else
echo shar: Extracting \"'line.c'\" \(2735 characters\)
sed "s/^X//" >'line.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)line.c	1.2 89/02/22";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X
static GC drawWhite, drawBlack;
static XSegment *segments;
X#define NSEG    64
X
X/*
X * solid lines
X *
X * used very often
X */
line_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int i;
X	XSegment *sp;
X
X	drawWhite = XCreateGC(dpy, win, 0L, NULL);
X	if (! drawWhite) return 1;
X	XSetForeground(dpy, drawWhite, WhitePixel(dpy, screen));
X	XSetBackground(dpy, drawWhite, BlackPixel(dpy, screen));
X
X	drawBlack = XCreateGC(dpy, win, 0L, NULL);
X	if (!drawBlack) return 1;
X	XSetForeground(dpy, drawBlack, BlackPixel(dpy, screen));
X	XSetBackground(dpy, drawBlack, WhitePixel(dpy, screen));
X
X	segments = (XSegment *)malloc(sizeof(XSegment) * 6 * NSEG);
X	if (segments == (XSegment *)0)
X	    return 1;
X
X	sp = segments;
X	for (i=0; i<NSEG; i++) {
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i+len; sp->y1 = i;
X	    sp->x2 = i; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i+len; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i+len;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X	}
X	return 0;
X}
X
line_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, drawWhite);
X	XFreeGC(dpy, drawBlack);
X	free(segments);
X}
X
line_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int nline;
X
X	nline = 0;
X	while (benchRunning) {
X	    XDrawSegments(dpy, win, drawWhite, segments, 6*NSEG);
X	    XDrawSegments(dpy, win, drawBlack, segments, 6*NSEG);
X	    nline += NSEG * 6 * 2;
X	}
X	return nline;
X}
X
line_msg(deltaT, nline, len, rate)
double rate;
X{
X	printf("LINES\n");
X	printf("\n");
X	printf("%d vectors of len. %d in %d secs\n",
X				nline, len, deltaT);
X	printf("rate = %8.2f vectors/sec\n", rate);
X}
END_OF_FILE
if test 2735 -ne `wc -c <'line.c'`; then
    echo shar: \"'line.c'\" unpacked with wrong size!
fi
# end of 'line.c'
fi
if test -f 'mkfile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mkfile'\"
else
echo shar: Extracting \"'mkfile'\" \(2838 characters\)
sed "s/^X//" >'mkfile' <<'END_OF_FILE'
SHELL=/bin/sh
CFLAGS= -O
LIBS=-lX11
X#
X# change for your printer
X# TROFF should be defined to [nt]roff an ms document and print it
X#
X# the line below is for our local machine
TROFF=troff -Tpsc -ms | psdit | psprint
X#TROFF=nroff -ms | lpr
X#
SRCS=hline.c vline.c sline.c rects.c fillrects.c invrects.c \
X	 dline.c wline.o imagestr.c screencpy.c pixmapcpy.c  \
X	 scroll.c bitmapcpy.c tiledrects.c stiprects.c      \
X	 arcs.c filledarcs.c filledpoly.c complex1.c line.c \
X	 main.c dobenches.c
X
OBJS=hline.o vline.o sline.o rects.o fillrects.o invrects.o \
X	 dline.o wline.o imagestr.o screencpy.o pixmapcpy.o  \
X	 scroll.o bitmapcpy.o tiledrects.o stiprects.o      \
X	 arcs.o filledarcs.o filledpoly.o complex1.o line.o \
X	 main.o dobenches.o
X
HDR=\
X       externals.h \
X       benches.h \
X       patchlevel.h \
X       stipple1.bit \
X       stipple2.bit \
X       tile1.bit \
X       tile2.bit \
X       bitmap1.bit
DOC=\
X       README \
X       AUTHOR \
X       xbench.man \
X       xbench.doc
STUFF=\
X       Imakefile \
X       mkfile \
X       script.run
SCRIPTS=\
X       scripts \
X       results \
X       results/sun3-50.R3.out  \
X       results/sun3-160.R2.out \
X       results/gpx.R2.out      \
X       results/9733.R2.out     \
X       scripts/Make.proto     \
X       scripts/summary.awk       \
X       scripts/detail.awk       \
X       scripts/detail.awk       \
X       scripts/xstones.awk       \
X       scripts/insSep.sh         \
X       scripts/postfix.ms        \
X       scripts/prefix.ms
X
X
xbench: $(OBJS)
X	  $(CC) -o xbench $(OBJS) $(LIBS)
X
dobenches.o:    benches.h
X
kit:
X	-makekit $(DOC) $(SRCS) $(HDR) $(STUFF) $(SCRIPTS) > /dev/null
X
printdoc:   xbench.doc
X	    tbl xbench.doc | $(TROFF)
X
print:      summary detail
X	    tbl summary.ms detail.ms | $(TROFF)
X
summary:            results tmp summary.ms
X
printsummary:       summary
X		    tbl summary.ms | $(TROFF)
X
detail:             results tmp detail.ms
X
printdetail:        detail
X		    tbl detail.ms | $(TROFF)
X
results:
X		    @echo You must put all .out files into
X		    @echo a subdirectory named: results
X		    exit 1
X
tmp:
X		    mkdir tmp
X
summary.ms:         tmp/makefile
X		    (cd tmp; make summary.ms)
X		    mv tmp/summary.ms .
X
detail.ms:          tmp/makefile
X		    (cd tmp; make detail.ms)
X		    mv tmp/detail.ms .
X
tmp/makefile:       results
X		    -(files=""; \
X		      sfiles=""; \
X		      cd results; \
X		      for i in *.out; do     \
X			sfiles="$$sfiles $$i""__" ; \
X			files="$$files $$i"; \
X		      done; \
X		      cd ..; \
X		      echo "SFILES=$$sfiles" > tmp/makefile; \
X		      echo >> tmp/makefile; \
X		      for i in $$files; do     \
X			echo $$i"__: " $$i"_" >> tmp/makefile; \
X			echo >> tmp/makefile; \
X			echo $$i"_: " $$i >> tmp/makefile; \
X			echo >> tmp/makefile; \
X		      done)
X		    echo >> tmp/makefile
X		    cat scripts/Make.proto >> tmp/makefile
END_OF_FILE
if test 2838 -ne `wc -c <'mkfile'`; then
    echo shar: \"'mkfile'\" unpacked with wrong size!
fi
# end of 'mkfile'
fi
if test -f 'pixmapcpy.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pixmapcpy.c'\"
else
echo shar: Extracting \"'pixmapcpy.c'\" \(2720 characters\)
sed "s/^X//" >'pixmapcpy.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)pixmapcpy.c	1.1 89/02/08";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X#include "bitmap1.bit"
X
static GC myGC;
static Pixmap thePixmap;
X
X/*
X * pixmap->screen copy area
X *
X * questionable, whether this benchmark tells us much
X * (since most applications draw pictures using XCopyPlane)
X * its valid for colour pictures and for backing store / save under
X * performance.
X */
pixmapcopy_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int depth;
X	Pixmap      pattern;
X
X	depth = DefaultDepth(dpy, screen);
X	myGC = XCreateGC(dpy, win, 0L, NULL);
X	if (! myGC) return 1;
X	XSetForeground(dpy, myGC, WhitePixel(dpy, screen));
X	XSetBackground(dpy, myGC, BlackPixel(dpy, screen));
X
X	pattern = XCreateBitmapFromData(dpy, win, bitmap1_bits,
X						  bitmap1_width,
X						  bitmap1_height);
X	if (!pattern) return 1;
X
X	/*
X	 * create a pixmap and fill it with the pattern
X	 */
X	thePixmap = XCreatePixmap(dpy, win, len, len, depth);
X	if (! thePixmap) return 1;
X
X	XSetStipple(dpy, myGC, pattern);
X	XSetFillStyle(dpy, myGC, FillOpaqueStippled);
X	XFillRectangle(dpy, thePixmap, myGC, 0, 0, len, len);
X
X	XSetFillStyle(dpy, myGC, FillSolid);
X	XFreePixmap(dpy, pattern);
X	return 0;
X}
X
pixmapcopy_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, myGC);
X	XFreePixmap(dpy, thePixmap);
X}
X
pixmapcopy_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int ncopy;
X	int x = 0, y = 0;
X
X	ncopy= 0;
X	while (benchRunning) {
X	    XCopyArea(dpy, thePixmap, win, myGC, 0, 0, len, len, x, y);
X	    x = (x + 1) & 0x0F;
X	    y = (y + 1) & 0x0F;
X	    if (sync) XSync(dpy, 0);
X	    ncopy++;
X	}
X	return ncopy;
X}
X
pixmapcopy_msg(deltaT, ncopy, len, rate)
double rate;
X{
X	printf("COPYAREA (PIXMAP->SCREEN)\n");
X	printf("\n");
X	printf("%d copies with %d pixel sides in %d secs\n",
X				ncopy, len, deltaT);
X	printf("rate = %8.2f copies/sec (%d Pixels/sec)\n",
X				rate, (ncopy*len*len)/deltaT);
X}
END_OF_FILE
if test 2720 -ne `wc -c <'pixmapcpy.c'`; then
    echo shar: \"'pixmapcpy.c'\" unpacked with wrong size!
fi
# end of 'pixmapcpy.c'
fi
if test -f 'results/9733.R2.out' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'results/9733.R2.out'\"
else
echo shar: Extracting \"'results/9733.R2.out'\" \(3850 characters\)
sed "s/^X//" >'results/9733.R2.out' <<'END_OF_FILE'
X==================================================
GENERAL INFORMATION
X
server: 9733-203 (R2)
client: same
communication: unix socket
notes: 32532 CPU; server is preliminary version
X
X==================================================
SERVER INFORMATION
X
Servervendor            : Siemens Munich by SP-4's Hacker-clan
XXSERVER version         : 11.2
Revision                : 0
Defaultdepth rootwindow : 8
Server Byte-Order       : LSBFirst
Server BitmapBitOrder   : LSBFirst
DisplayWidth            : 1280
DisplayHeight           : 1024
X
X==================================================
XXBENCH INFORMATION
VERSION: 1 TIMEGOAL = 10 sec; NRUNS = 3
X
X========= line10 ========= 
LINES
X
rate =  14131.20 vectors/sec
X========= line100 ========= 
LINES
X
rate =  13670.40 vectors/sec
X========= line400 ========= 
LINES
X
rate =  6451.20 vectors/sec
X========= dline10 ========= 
DASHED LINES
X
rate =  8140.80 vectors/sec
X========= dline100 ========= 
DASHED LINES
X
rate =  5068.80 vectors/sec
X========= dline400 ========= 
DASHED LINES
X
rate =  2164.36 vectors/sec
X========= wline10 ========= 
WIDE LINES
X
rate =   649.85 vectors/sec
X========= wline100 ========= 
WIDE LINES
X
rate =   115.20 vectors/sec
X========= wline400 ========= 
WIDE LINES
X
rate =    27.43 vectors/sec
X========= rects10 ========= 
RECTANGLES
X
rate =  6579.20 rectangles/sec
X========= rects100 ========= 
RECTANGLES
X
rate =  4328.73 rectangles/sec
X========= rects400 ========= 
RECTANGLES
X
rate =  2257.45 rectangles/sec
X========= fillrects10 ========= 
XFILLED RECTANGLES
X
rate =  7577.60 rectangles/sec
X========= fillrects100 ========= 
XFILLED RECTANGLES
X
rate =  2483.20 rectangles/sec
X========= fillrects400 ========= 
XFILLED RECTANGLES
X
rate =   307.20 rectangles/sec
X========= tiledrects10 ========= 
TILE-FILLED RECTANGLES
X
rate =  3532.80 rectangles/sec
X========= tiledrects100 ========= 
TILE-FILLED RECTANGLES
X
rate =   452.92 rectangles/sec
X========= tiledrects400 ========= 
TILE-FILLED RECTANGLES
X
rate =    82.29 rectangles/sec
X========= stippledrects10 ========= 
STIPPLE-FILLED RECTANGLES
X
rate =   271.06 rectangles/sec
X========= stippledrects100 ========= 
STIPPLE-FILLED RECTANGLES
X
rate =   175.16 rectangles/sec
X========= stippledrects400 ========= 
STIPPLE-FILLED RECTANGLES
X
rate =    59.08 rectangles/sec
X========= invrects10 ========= 
INVERTED RECTANGLES
X
rate =  3850.55 rectangles/sec
X========= invrects100 ========= 
INVERTED RECTANGLES
X
rate =  3029.45 rectangles/sec
X========= invrects400 ========= 
INVERTED RECTANGLES
X
rate =  1602.82 rectangles/sec
X========= arcs10 ========= 
ARCS
X
rate =  1088.20 arcs/sec
X========= arcs100 ========= 
ARCS
X
rate =   618.36 arcs/sec
X========= arcs400 ========= 
ARCS
X
rate =   326.00 arcs/sec
X========= filledarcs10 ========= 
XFILLED ARCS
X
rate =   664.73 filled arcs/sec
X========= filledarcs100 ========= 
XFILLED ARCS
X
rate =   226.83 filled arcs/sec
X========= filledarcs400 ========= 
XFILLED ARCS
X
rate =    43.60 filled arcs/sec
X========= filledpoly100 ========= 
XFILLED POLYGONS
X
rate =   109.33 filled polygons/sec
X========= screencopy10 ========= 
COPYAREA (SCREEN->SCREEN)
X
rate =   292.50 copies/sec
X========= screencopy100 ========= 
COPYAREA (SCREEN->SCREEN)
X
rate =   319.09 copies/sec
X========= screencopy400 ========= 
COPYAREA (SCREEN->SCREEN)
X
rate =    29.40 copies/sec
X========= scroll ========= 
SCROLL
X
rate =    53.14 scrolls/sec
X========= bitmapcopy10 ========= 
COPYPLANE (BITMAP->SCREEN)
X
rate =   279.36 copies/sec
X========= bitmapcopy100 ========= 
COPYPLANE (BITMAP->SCREEN)
X
rate =    60.29 copies/sec
X========= bitmapcopy400 ========= 
COPYPLANE (BITMAP->SCREEN)
X
rate =     5.00 copies/sec
X========= imagestring:fixed ========= 
X
rate = 12341.00 chars/sec
X========= complex1 ========= 
WINDOW CREATE/DRAW/DESTROY
X
rate =    28.82 runs/sec
X==================================================
X
END_OF_FILE
if test 3850 -ne `wc -c <'results/9733.R2.out'`; then
    echo shar: \"'results/9733.R2.out'\" unpacked with wrong size!
fi
# end of 'results/9733.R2.out'
fi
if test -f 'results/gpx.R2.out' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'results/gpx.R2.out'\"
else
echo shar: Extracting \"'results/gpx.R2.out'\" \(6106 characters\)
sed "s/^X//" >'results/gpx.R2.out' <<'END_OF_FILE'
X==================================================
GENERAL INFORMATION
X
server: DEC gpx (R2)
client: same
communication: unix socket
notes: original MIT server
X
X==================================================
SERVER INFORMATION
X
Servervendor            : MIT X Consortium
XXSERVER version         : 11.2
Revision                : 0
Defaultdepth rootwindow : 8
Server Byte-Order       : LSBFirst
Server BitmapBitOrder   : LSBFirst
DisplayWidth            : 1024
DisplayHeight           : 864
X
X==================================================
XXBENCH INFORMATION
VERSION: 1 TIMEGOAL = 10 sec; NRUNS = 3
X
X========= line10 ========= 
LINES
X
X13056 vectors of len. 10 in 11 secs
rate =  1186.91 vectors/sec
X========= line100 ========= 
LINES
X
X13056 vectors of len. 100 in 11 secs
rate =  1186.91 vectors/sec
X========= line400 ========= 
LINES
X
X13056 vectors of len. 400 in 11 secs
rate =  1186.91 vectors/sec
X========= dline10 ========= 
DASHED LINES
X
X2304 dashed vectors of len. 10 in 16 secs
rate =   144.00 vectors/sec
X========= dline100 ========= 
DASHED LINES
X
X1536 dashed vectors of len. 100 in 62 secs
rate =    24.77 vectors/sec
X========= dline400 ========= 
DASHED LINES
X
X1536 dashed vectors of len. 400 in 240 secs
rate =     6.40 vectors/sec
X========= wline10 ========= 
WIDE LINES
X
X3840 wide vectors (linewidth=5) of len. 10 in 16 secs
rate =   240.00 vectors/sec
X========= wline100 ========= 
WIDE LINES
X
X1536 wide vectors (linewidth=5) of len. 100 in 21 secs
rate =    73.14 vectors/sec
X========= wline400 ========= 
WIDE LINES
X
X1536 wide vectors (linewidth=5) of len. 400 in 70 secs
rate =    21.94 vectors/sec
X========= rects10 ========= 
RECTANGLES
X
X13568 rectangles with 10 pixel sides in 10 secs
rate =  1356.80 rectangles/sec (54272 Pixels/sec)
X========= rects100 ========= 
RECTANGLES
X
X13568 rectangles with 100 pixel sides in 10 secs
rate =  1356.80 rectangles/sec (542720 Pixels/sec)
X========= rects400 ========= 
RECTANGLES
X
X5888 rectangles with 400 pixel sides in 11 secs
rate =   535.27 rectangles/sec (856436 Pixels/sec)
X========= fillrects10 ========= 
XFILLED RECTANGLES
X
X78592 rectangles with 10 pixel sides in 10 secs
rate =  7859.20 rectangles/sec (785920 Pixels/sec)
X========= fillrects100 ========= 
XFILLED RECTANGLES
X
X8448 rectangles with 100 pixel sides in 12 secs
rate =   704.00 rectangles/sec (7040000 Pixels/sec)
X========= fillrects400 ========= 
XFILLED RECTANGLES
X
X1792 rectangles with 400 pixel sides in 35 secs
rate =    51.20 rectangles/sec (8192000 Pixels/sec)
X========= tiledrects10 ========= 
TILE-FILLED RECTANGLES
X
X69376 rectangles with 10 pixel sides in 10 secs
rate =  6937.60 rectangles/sec (693760 Pixels/sec)
X========= tiledrects100 ========= 
TILE-FILLED RECTANGLES
X
X7680 rectangles with 100 pixel sides in 12 secs
rate =   640.00 rectangles/sec (6400000 Pixels/sec)
X========= tiledrects400 ========= 
TILE-FILLED RECTANGLES
X
X1792 rectangles with 400 pixel sides in 35 secs
rate =    51.20 rectangles/sec (8192000 Pixels/sec)
X========= stippledrects10 ========= 
STIPPLE-FILLED RECTANGLES
X
X76288 rectangles with 10 pixel sides in 10 secs
rate =  7628.80 rectangles/sec (762880 Pixels/sec)
X========= stippledrects100 ========= 
STIPPLE-FILLED RECTANGLES
X
X7680 rectangles with 100 pixel sides in 12 secs
rate =   640.00 rectangles/sec (6400000 Pixels/sec)
X========= stippledrects400 ========= 
STIPPLE-FILLED RECTANGLES
X
X1792 rectangles with 400 pixel sides in 35 secs
rate =    51.20 rectangles/sec (8192000 Pixels/sec)
X========= invrects10 ========= 
INVERTED RECTANGLES
X
X35476 rectangles with 10 pixel sides in 11 secs
rate =  3225.09 rectangles/sec (322509 Pixels/sec)
X========= invrects100 ========= 
INVERTED RECTANGLES
X
X8386 rectangles with 100 pixel sides in 12 secs
rate =   698.83 rectangles/sec (6988333 Pixels/sec)
X========= invrects400 ========= 
INVERTED RECTANGLES
X
X1721 rectangles with 400 pixel sides in 33 secs
rate =    52.15 rectangles/sec (8344242 Pixels/sec)
X========= arcs10 ========= 
ARCS
X
X2552 arcs with 10 pixel diameter in 11 secs
rate =   232.00 arcs/sec
X========= arcs100 ========= 
ARCS
X
X2042 arcs with 100 pixel diameter in 11 secs
rate =   185.64 arcs/sec
X========= arcs400 ========= 
ARCS
X
X1702 arcs with 400 pixel diameter in 13 secs
rate =   130.92 arcs/sec
X========= filledarcs10 ========= 
XFILLED ARCS
X
X2382 filled arcs with 10 pixel diameter in 11 secs
rate =   216.55 filled arcs/sec
X========= filledarcs100 ========= 
XFILLED ARCS
X
X1872 filled arcs with 100 pixel diameter in 12 secs
rate =   156.00 filled arcs/sec
X========= filledarcs400 ========= 
XFILLED ARCS
X
X1362 filled arcs with 400 pixel diameter in 13 secs
rate =   104.77 filled arcs/sec
X========= filledpoly100 ========= 
XFILLED POLYGONS
X
X4996 filled polygons with 5 points (size 100) in 11 secs
rate =   454.18 filled polygons/sec
X========= screencopy10 ========= 
COPYAREA (SCREEN->SCREEN)
X
X1026 copies with 10 pixel sides in 14 secs
rate =    73.29 copies/sec (7328 Pixels/sec)
X========= screencopy100 ========= 
COPYAREA (SCREEN->SCREEN)
X
X1026 copies with 100 pixel sides in 13 secs
rate =    78.92 copies/sec (789230 Pixels/sec)
X========= screencopy400 ========= 
COPYAREA (SCREEN->SCREEN)
X
X732 copies with 400 pixel sides in 16 secs
rate =    45.75 copies/sec (7320000 Pixels/sec)
X========= scroll ========= 
SCROLL
X
X585 scrolls (area: 640 x 400) in 16 secs
rate =    29.25 scrolls/sec (7488000 Pixels/sec)
X========= bitmapcopy10 ========= 
COPYPLANE (BITMAP->SCREEN)
X
X513 copies with 10 pixel sides in 20 secs
rate =    25.65 copies/sec (2565 Pixels/sec)
X========= bitmapcopy100 ========= 
COPYPLANE (BITMAP->SCREEN)
X
X385 copies with 100 pixel sides in 55 secs
rate =     7.00 copies/sec (70000 Pixels/sec)
X========= bitmapcopy400 ========= 
COPYPLANE (BITMAP->SCREEN)
X
X257 copies with 400 pixel sides in 195 secs
rate =     1.32 copies/sec (210871 Pixels/sec)
X========= imagestring:fixed ========= 
DRAW IMAGE STRING - font="fixed" (height = 13)
X
X170478 chars in 11 secs
rate = 15498.00 chars/sec
X========= complex1 ========= 
WINDOW CREATE/DRAW/DESTROY
X
X84 runs 10 secs
rate =     8.40 runs/sec
X==================================================
X
END_OF_FILE
if test 6106 -ne `wc -c <'results/gpx.R2.out'`; then
    echo shar: \"'results/gpx.R2.out'\" unpacked with wrong size!
fi
# end of 'results/gpx.R2.out'
fi
if test -f 'stiprects.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stiprects.c'\"
else
echo shar: Extracting \"'stiprects.c'\" \(3088 characters\)
sed "s/^X//" >'stiprects.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)stiprects.c	1.2 89/02/22";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X#include "stipple1.bit"
X#include "stipple2.bit"
X
static GC myGC1, myGC2;
static Pixmap stipple1, stipple2;
static XRectangle *rectangles;
X#define NRECT   64
X
X/*
X * stippled rectangles
X *
X */
stippledrects_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int depth;
X	int i;
X	XRectangle *rp;
X
X	depth = DefaultDepth(dpy, screen);
X	myGC1 = XCreateGC(dpy, win, 0L, NULL);
X	if (! myGC1) return 1;
X	myGC2 = XCreateGC(dpy, win, 0L, NULL);
X	if (! myGC2) return 1;
X	XSetForeground(dpy, myGC1, BlackPixel(dpy, screen));
X	XSetBackground(dpy, myGC1, WhitePixel(dpy, screen));
X	XSetForeground(dpy, myGC2, BlackPixel(dpy, screen));
X	XSetBackground(dpy, myGC2, WhitePixel(dpy, screen));
X
X	stipple1 = XCreateBitmapFromData(dpy, win,
X						stipple1_bits,
X						stipple1_width,
X						stipple1_height);
X	if (!stipple1) return 1;
X
X	stipple2 = XCreateBitmapFromData(dpy, win,
X						stipple2_bits,
X						stipple2_width,
X						stipple2_height);
X	if (!stipple2) return 1;
X
X	XSetStipple(dpy, myGC1, stipple1);
X	XSetFillStyle(dpy, myGC1, FillOpaqueStippled);
X	XSetStipple(dpy, myGC2, stipple2);
X	XSetFillStyle(dpy, myGC2, FillOpaqueStippled);
X
X	rectangles = (XRectangle *)malloc(sizeof(XRectangle) * NRECT);
X	if (rectangles == (XRectangle *)0)
X	    return 1;
X
X	rp = rectangles;
X	for (i=0; i<NRECT; i++) {
X	    rp->x = i; rp->y = i;
X	    rp->width = len; rp->height = len;
X	    rp++;
X	}
X	return 0;
X}
X
stippledrects_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, myGC1);
X	XFreePixmap(dpy, stipple1);
X	XFreeGC(dpy, myGC2);
X	XFreePixmap(dpy, stipple2);
X	free(rectangles);
X}
X
stippledrects_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int nrects;
X
X	nrects = 0;
X	while (benchRunning) {
X	    XFillRectangles(dpy, win, myGC1, rectangles, NRECT);
X	    XFillRectangles(dpy, win, myGC2, rectangles, NRECT);
X	    if (sync) XSync(dpy, 0);
X	    nrects += NRECT*2;
X	}
X	return nrects;
X}
X
stippledrects_msg(deltaT, nrects, len, rate)
double rate;
X{
X	printf("STIPPLE-FILLED RECTANGLES\n");
X	printf("\n");
X	printf("%d rectangles with %d pixel sides in %d secs\n",
X				nrects, len, deltaT);
X	printf("rate = %8.2f rectangles/sec (%d Pixels/sec)\n",
X				rate, (nrects*len*len)/deltaT);
X}
END_OF_FILE
if test 3088 -ne `wc -c <'stiprects.c'`; then
    echo shar: \"'stiprects.c'\" unpacked with wrong size!
fi
# end of 'stiprects.c'
fi
if test -f 'tiledrects.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tiledrects.c'\"
else
echo shar: Extracting \"'tiledrects.c'\" \(3186 characters\)
sed "s/^X//" >'tiledrects.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)tiledrects.c	1.2 89/02/22";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X#include "tile1.bit"
X#include "tile2.bit"
X
static GC myGC1, myGC2;
static Pixmap tile1, tile2;
static XRectangle *rectangles;
X#define NRECT   64
X
X/*
X * tiled rectangles
X *
X * backgrounds, draw programs
X */
tiledrects_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int depth;
X	int i;
X	XRectangle *rp;
X
X	depth = DefaultDepth(dpy, screen);
X	myGC1 = XCreateGC(dpy, win, 0L, NULL);
X	if (! myGC1) return 1;
X	myGC2 = XCreateGC(dpy, win, 0L, NULL);
X	if (! myGC2) return 1;
X	XSetForeground(dpy, myGC1, WhitePixel(dpy, screen));
X	XSetBackground(dpy, myGC1, BlackPixel(dpy, screen));
X	XSetForeground(dpy, myGC2, WhitePixel(dpy, screen));
X	XSetBackground(dpy, myGC2, BlackPixel(dpy, screen));
X
X	tile1 = XCreatePixmapFromBitmapData(dpy, win,
X						tile1_bits,
X						tile1_width,
X						tile1_height,
X						WhitePixel(dpy, screen),
X						BlackPixel(dpy, screen),
X						depth);
X	if (!tile1) return 1;
X
X	XSetTile(dpy, myGC1, tile1);
X	XSetFillStyle(dpy, myGC1, FillTiled);
X
X	tile2 = XCreatePixmapFromBitmapData(dpy, win,
X						tile2_bits,
X						tile2_width,
X						tile2_height,
X						WhitePixel(dpy, screen),
X						BlackPixel(dpy, screen),
X						depth);
X	if (!tile2) return 1;
X
X	XSetTile(dpy, myGC2, tile2);
X	XSetFillStyle(dpy, myGC2, FillTiled);
X
X	rectangles = (XRectangle *)malloc(sizeof(XRectangle) * NRECT);
X	if (rectangles == (XRectangle *)0)
X	    return 1;
X
X	rp = rectangles;
X	for (i=0; i<NRECT; i++) {
X	    rp->x = i; rp->y = i;
X	    rp->width = len; rp->height = len;
X	    rp++;
X	}
X	return 0;
X}
X
tiledrects_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, myGC1);
X	XFreePixmap(dpy, tile1);
X	XFreeGC(dpy, myGC2);
X	XFreePixmap(dpy, tile2);
X	free(rectangles);
X}
X
tiledrects_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int nrects;
X
X	nrects = 0;
X	while (benchRunning) {
X	    XFillRectangles(dpy, win, myGC1, rectangles, NRECT);
X	    XFillRectangles(dpy, win, myGC2, rectangles, NRECT);
X	    if (sync) XSync(dpy, 0);
X	    nrects += NRECT*2;
X	}
X	return nrects;
X}
X
tiledrects_msg(deltaT, nrects, len, rate)
double rate;
X{
X	printf("TILE-FILLED RECTANGLES\n");
X	printf("\n");
X	printf("%d rectangles with %d pixel sides in %d secs\n",
X				nrects, len, deltaT);
X	printf("rate = %8.2f rectangles/sec (%d Pixels/sec)\n",
X				rate, (nrects*len*len)/deltaT);
X}
END_OF_FILE
if test 3186 -ne `wc -c <'tiledrects.c'`; then
    echo shar: \"'tiledrects.c'\" unpacked with wrong size!
fi
# end of 'tiledrects.c'
fi
if test -f 'wline.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'wline.c'\"
else
echo shar: Extracting \"'wline.c'\" \(3123 characters\)
sed "s/^X//" >'wline.c' <<'END_OF_FILE'
static char SCCSID[] = "@(#)wline.c	1.2 89/02/22";
X/*
X * Copyright 1989 Siemens
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted, provided
X * that the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of Siemens not be used in advertising or
X * publicity pertaining to distribution of the software without specific,
X * written prior permission.  Siemens makes no representations about the
X * suitability of this software for any purpose.  It is provided "as is"
X * without express or implied warranty.
X *
X * Author:  Claus Gittinger, Siemens Munich, unido!sinix!claus at uunet.uu.net
X */
X
X#include <stdio.h>
X#include <X11/Xlib.h>
X#include <X11/Xutil.h>
X
X#include "externals.h"
X
static GC drawWhite, drawBlack;
static XSegment *segments;
X#define NSEG        64
X#define LINEWIDTH   5
X
X/*
X * wide lines
X *
X * currently seldom used (becaus most implementations are slow) -
X * as cad applications will appear, this (and dashed lines)
X * may be used more often.
X */
wline_setup(dpy, win, len)
Display *dpy;
Window win;
X{
X	int screen = DefaultScreen(dpy);
X	int i;
X	XSegment *sp;
X
X	drawWhite = XCreateGC(dpy, win, 0L, NULL);
X	if (! drawWhite) return 1;
X	XSetForeground(dpy, drawWhite, WhitePixel(dpy, screen));
X	XSetBackground(dpy, drawWhite, BlackPixel(dpy, screen));
X	XSetLineAttributes(dpy, drawWhite, LINEWIDTH, LineSolid, CapButt, JoinMiter);
X
X	drawBlack = XCreateGC(dpy, win, 0L, NULL);
X	if (!drawBlack) return 1;
X	XSetForeground(dpy, drawBlack, BlackPixel(dpy, screen));
X	XSetBackground(dpy, drawBlack, WhitePixel(dpy, screen));
X	XSetLineAttributes(dpy, drawBlack, LINEWIDTH, LineSolid, CapButt, JoinMiter);
X
X	segments = (XSegment *)malloc(sizeof(XSegment) * 6 * NSEG);
X	if (segments == (XSegment *)0)
X	    return 1;
X
X	sp = segments;
X	for (i=0; i<NSEG; i++) {
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i+len; sp->y1 = i;
X	    sp->x2 = i; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i+len; sp->y1 = i;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X
X	    sp->x1 = i; sp->y1 = i+len;
X	    sp->x2 = i+len; sp->y2 = i+len;
X	    sp++;
X	}
X	return 0;
X}
X
wline_cleanup(dpy, win, dummy)
Display *dpy;
Window win;
X{
X	XFreeGC(dpy, drawWhite);
X	XFreeGC(dpy, drawBlack);
X	free(segments);
X}
X
wline_bench(dpy, win, len)
Display *dpy;
Window win;
X{
X	int nline;
X
X	nline = 0;
X	while (benchRunning) {
X	    XDrawSegments(dpy, win, drawWhite, segments, 6*NSEG);
X	    XDrawSegments(dpy, win, drawBlack, segments, 6*NSEG);
X	    nline += NSEG * 6 * 2;
X	    if (sync) XSync(dpy, 0);
X	}
X	return nline;
X}
X
wline_msg(deltaT, nline, len, rate)
double rate;
X{
X	printf("WIDE LINES\n");
X	printf("\n");
X	printf("%d wide vectors (linewidth=%d) of len. %d in %d secs\n",
X				nline, LINEWIDTH, len, deltaT);
X	printf("rate = %8.2f vectors/sec\n", rate);
X}
END_OF_FILE
if test 3123 -ne `wc -c <'wline.c'`; then
    echo shar: \"'wline.c'\" unpacked with wrong size!
fi
# end of 'wline.c'
fi
if test -f 'xbench.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xbench.man'\"
else
echo shar: Extracting \"'xbench.man'\" \(4463 characters\)
sed "s/^X//" >'xbench.man' <<'END_OF_FILE'
X.. @(#)xbench.man	1.3 89/03/23
X.TH XBENCH 1
X.UC 4
X.SH NAME
xbench \- get a feeling of X server performance
X.SH SYNOPSIS
X.B xbench
X[-option ...]
X.SH DESCRIPTION
X\fIXbench\fP tries to give you a feeling of your X-server's
performance by outputting a number of graphic-commands and
measuring the time it takes to put this onto the screen.
X.br
It is a useful tool for comparing different server
implementations and for measuring server tuning effects.
X.SH "TIMING"
Care has been taken to remove the effects of queueing and/or
buffering in the server.
XEvery test outputs its commands until a given time period elapses
X(usually 10 seconds). Then
X.I xbench
waits until the server has processed the commands by doing an
X.I XSync.
Since the server may communicate with a
graphic-controller using
a command fifo/pipe/buffer in between,
X.I Xbench
finally reads back part of the screen.
This read-back makes sure that every pixel is definitely on the
screen and not in some server-controller command-queue.
X.br
X[only 1 pixel is read back so the additional (misinterpreted) delay
is minimal].
X.sp
XEvery test is run 3 times and the
X.B best
rating is taken - not the average. This is done to remove (or at least
minimize) the effects of daemons or other background processes.
X.SH TESTS
The benchmark tests the most common operations,
they include:
X.IP lines
X.br
horizontal, vertical and diagonal lines are drawn
solid, dashed and wide solid.
X.IP rectangles
X.br
unfilled, filled, tile-filled and stipple-filled.
X.IP arcs
X.br
unfilled and filled.
X.IP bit-blt's
X.br
screen to screen copy, ,
bitmap to screen (XCopyPlane) and invert.
X.IP "character output"
X.br
draws strings in a common font.
X.IP "complex test"
X.br
to test overall performance.
X.PP
XEvery test in
X.I xbench
has associated with it a level-number, currently 1 to 3.
If you start
X.I xbench
without any arguments all level 1 benches are run.
If you need more information, specify the level in the command line
to get all tests with levels less or equal the specified level.
The higher level benches are variations of the lower-level ones
with changed parameters. In general level 1 information is all you need.
X.br
Most tests are run more than once with different parameters.
Server tuners may find it useful, to compare the numbers given -
for example short vector performance is likely to be limited by the
interprocess/server overhead while long vector performance is usually
limited by the speed of the graphics-controller/ddx code.
X.PP
X.SH OPTIONS
X.I Xbench
accepts the folloing options:
X.TP 8
X\fB\-display \fIname\fP
X.br
as usual
X.TP 8
X.B \-foo
X.br
prints usage message.
X.TP 8
X.B \-help
X.br
output a list of available tests.
X.TP 8
X\fB\-level \fInumber\fP
X.br
run all tests with level number less or equal
X.I level.
Without this option all level 1 tests are run.
X.TP 8
X\fB\-timegoal \fIseconds\fP
X.br
changes runtime per test. (default = 10 seconds).
Remember, that every test is run 3 times so that a
X.I timegoal
of 20 seconds gives a total run time of 1 minute per test.
X.TP 8
X\fB\-nruns \fInumber\fP
X.br
runs each test
X.I number
times.
With a timegoal of 10 seconds this gives a total run time of 10 sec's per test.
X(default = 3)
X.TP 8
X.B \-sync
X.br
if you are testing a slow server with a big buffer, many commands
may be buffered in some internal server queues. [I have seen servers
running for half an hour processing arc commands sent during the
X10 seconds]. This option removes long delays for commands
that are known to be slow - but keep in mind, that
X.I xbench
may give you incorrect benchmark data if this option is used.
X[but if your server is really slow, it doesn't count anyway :-)]
X.TP 8
X\fB\-only \fIname-of-test\fP
X.br
run only the named test. This option may be repeated so that:
X.sp
X.nf
X      xbench -only hline100 -only vline100
X.fi
X.sp
runs only the
X.I hline100
and
X.I vline100
tests.
X.TP 8
X\fB\-not \fIname-of-test\fP
X.br
excludes the named test from the benchmark.
X[If any test crashes your server ....]
This option may also be repeated to exclude more.
X.TP 8
X.B \-ask
X.br
turns on interactive mode. For every test 
you have to enter "y" if you want the test to be run.
If you enter "s" runs this test with the "-sync" option on.
XEntering "n" skips this test.
X.PP
X.SH COPYRIGHT
Copyright 1988, Siemens Munich.
X.br
free to copy/distribute - but not for money -
provided that the above copyright notice appears
in all copies.
X.PP
X.SH AUTHOR
X.PP
Claus Gittinger (..!decvax!unido!sinix!claus) 
END_OF_FILE
if test 4463 -ne `wc -c <'xbench.man'`; then
    echo shar: \"'xbench.man'\" unpacked with wrong size!
fi
# end of 'xbench.man'
fi
echo shar: End of archive 2 \(of 4\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 4 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0



More information about the Comp.sources.x mailing list