diff options
Diffstat (limited to 'x11perf.c')
-rw-r--r-- | x11perf.c | 106 |
1 files changed, 53 insertions, 53 deletions
@@ -3,13 +3,13 @@ Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -161,7 +161,7 @@ static int ssTimeout, ssInterval, ssPreferBlanking, ssAllowExposures; /* Static functions */ static int GetWords(int argi, int argc, char **argv, char **wordsp, int *nump); -static int GetNumbers(int argi, int argc, char **argv, unsigned long *intsp, +static int GetNumbers(int argi, int argc, char **argv, unsigned long *intsp, int *nump); static int GetRops(int argi, int argc, char **argv, int *ropsp, int *nump); static int GetPops(int argi, int argc, char **argv, int *popsp, int *nump); @@ -221,7 +221,7 @@ int gettimeofday(tp) static struct timeval start; -static void +static void PrintTime(void) { Time_t t; @@ -230,13 +230,13 @@ PrintTime(void) printf("%s\n", ctime(&t)); } -static void +static void InitTimes(void) { X_GETTIMEOFDAY(&start); } -static double +static double ElapsedTime(double correction) { struct timeval stop; @@ -250,7 +250,7 @@ ElapsedTime(double correction) (1000000.0 * (double)(stop.tv_sec - start.tv_sec)) - correction; } -static double +static double RoundTo3Digits(double d) { /* It's kind of silly to print out things like ``193658.4/sec'' so just @@ -286,7 +286,7 @@ RoundTo3Digits(double d) } -static void +static void ReportTimes(double usecs, int64_t n, char *str, int average) { if(usecs != 0.0) @@ -299,10 +299,10 @@ ReportTimes(double usecs, int64_t n, char *str, int average) objspersec = RoundTo3Digits(objspersec); if (average) { - printf("%11lld trep @ %8.4f msec (%8.1f/sec): %s\n", + printf("%11lld trep @ %8.4f msec (%8.1f/sec): %s\n", (long long) n, msecsperobj, objspersec, str); } else { - printf("%11lld reps @ %8.4f msec (%8.1f/sec): %s\n", + printf("%11lld reps @ %8.4f msec (%8.1f/sec): %s\n", (long long) n, msecsperobj, objspersec, str); } } else { @@ -360,7 +360,7 @@ Get_Display_Name(int *pargc, /* MODIFIED */ * If found remove it from command line. Don't go past a lone -. */ -static Version +static Version GetVersion(int *pargc, /* MODIFIED */ char **argv) /* MODIFIED */ { @@ -449,7 +449,7 @@ void AbortTest(void) { fflush(stdout); - + XSetScreenSaver(xparms.d, ssTimeout, ssInterval, ssPreferBlanking, ssAllowExposures); XFlush(xparms.d); @@ -461,7 +461,7 @@ AbortTest(void) ************************************************/ -static void +static void usage(void) { int i = 0; @@ -506,7 +506,7 @@ usage(void) i++; } fprintf(stderr, "\n"); - + /* Print out original command line as the above usage message is so long */ for (i = 0; i != saveargc; i++) { fprintf(stderr, "%s ", saveargv[i]); @@ -515,18 +515,18 @@ usage(void) exit (1); } -void +void NullProc(XParms xp, Parms p) { } -int +int NullInitProc(XParms xp, Parms p, int64_t reps) { return reps; } -static void +static void HardwareSync(XParms xp) { /* @@ -537,13 +537,13 @@ HardwareSync(XParms xp) */ XImage *image; - image = XGetImage(xp->d, xp->p ? xp->p : xp->w, HSx, HSy, + image = XGetImage(xp->d, xp->p ? xp->p : xp->w, HSx, HSy, 1, 1, ~0, ZPixmap); if (image) XDestroyImage(image); } -static void -DoHardwareSync(XParms xp, Parms p, int64_t reps) +static void +DoHardwareSync(XParms xp, Parms p, int64_t reps) { for (int i = 0; i != reps; i++) { HardwareSync(xp); @@ -553,13 +553,13 @@ DoHardwareSync(XParms xp, Parms p, int64_t reps) static Test syncTest = { "syncTime", "Internal test for finding how long HardwareSync takes", NULL, - NullInitProc, DoHardwareSync, NullProc, NullProc, + NullInitProc, DoHardwareSync, NullProc, NullProc, V1_2FEATURE, NONROP, 0, {1} }; -static Window +static Window CreatePerfWindow(XParms xp, int x, int y, int width, int height) { XSetWindowAttributes xswa; @@ -584,14 +584,14 @@ CreatePerfWindow(XParms xp, int x, int y, int width, int height) xswa.save_under = xp->save_under; w = XCreateWindow(xp->d, DefaultRootWindow(xp->d), x, y, width, height, 1, xp->vinfo.depth, CopyFromParent, xp->vinfo.visual, - CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect + CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect | CWBackingStore | CWSaveUnder, &xswa); XMapWindow (xp->d, w); return w; } -static void +static void CreateClipWindows(XParms xp, int clips) { XWindowAttributes xwa; @@ -605,7 +605,7 @@ CreateClipWindows(XParms xp, int clips) } /* CreateClipWindows */ -static void +static void DestroyClipWindows(XParms xp, int clips) { if (clips > MAXCLIP) clips = MAXCLIP; @@ -615,7 +615,7 @@ DestroyClipWindows(XParms xp, int clips) } /* DestroyClipWindows */ -static double +static double DoTest(XParms xp, Test *test, int64_t reps) { double time; @@ -624,7 +624,7 @@ DoTest(XParms xp, Test *test, int64_t reps) /* Tell screen-saver to restart counting again. See comments below for the XSetScreenSaver call. */ XForceScreenSaver(xp->d, ScreenSaverReset); - HardwareSync (xp); + HardwareSync (xp); InitTimes (); (*test->proc) (xp, &test->parms, reps); HardwareSync(xp); @@ -685,9 +685,9 @@ CalibrateTest(XParms xp, Test *test, int seconds, double *usecperobj) CheckAbort (); if (didreps != reps) { - /* The test can't do the number of reps as we asked for. + /* The test can't do the number of reps as we asked for. Give up */ - *usecperobj = + *usecperobj = usecs / (double)(didreps * test->parms.objects); return didreps; } @@ -717,7 +717,7 @@ CalibrateTest(XParms xp, Test *test, int seconds, double *usecperobj) return reps; } /* CalibrateTest */ -static void +static void CreatePerfGCs(XParms xp, int func, unsigned long pm) { XGCValues gcvfg, gcvbg, gcvddbg,gcvddfg; @@ -738,7 +738,7 @@ CreatePerfGCs(XParms xp, int func, unsigned long pm) gcvbg.function = func; gcvddfg.function = func; gcvddbg.function = func; - + if (func == GXxor) { /* Make test look good visually if possible */ gcvbg.foreground = gcvfg.foreground = bg ^ fg; @@ -759,19 +759,19 @@ CreatePerfGCs(XParms xp, int func, unsigned long pm) xp->fggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvfg); - xp->bggc = XCreateGC(xp->d, xp->w, + xp->bggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvbg); xp->ddfggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvddfg); - xp->ddbggc = XCreateGC(xp->d, xp->w, + xp->ddbggc = XCreateGC(xp->d, xp->w, GCForeground | GCBackground | GCGraphicsExposures | GCFunction | GCPlaneMask, &gcvddbg); } -static void +static void DestroyPerfGCs(XParms xp) { XFreeGC(xp->d, xp->fggc); @@ -780,7 +780,7 @@ DestroyPerfGCs(XParms xp) XFreeGC(xp->d, xp->ddbggc); } -static unsigned long +static unsigned long AllocateColor(Display *display, const char *name, unsigned long pixel) { XColor color; @@ -805,7 +805,7 @@ AllocateColor(Display *display, const char *name, unsigned long pixel) } /* AllocateColor */ -static void +static void DisplayStatus(Display *d, const char *message, const char *test, int try) { char s[500]; @@ -818,7 +818,7 @@ DisplayStatus(Display *d, const char *message, const char *test, int try) } -static void +static void ProcessTest(XParms xp, Test *test, int func, unsigned long pm, char *label) { double time, totalTime; @@ -928,7 +928,7 @@ main(int argc, char *argv[]) } else if (strcmp(argv[i], "-range") == 0) { char *cp1; char *cp2; - + if (argc <= ++i) usage(); cp1 = argv[i]; @@ -1100,7 +1100,7 @@ main(int argc, char *argv[]) } if(!found) usage (); - LegalOption: + LegalOption: foundOne = True; } } @@ -1114,7 +1114,7 @@ main(int argc, char *argv[]) case NONROP: printf ("%s\n", LABELP(i)); break; - + case ROP: /* Run it through all specified rops and planemasks */ for (rop = 0; rop < numRops; rop++) { @@ -1136,7 +1136,7 @@ main(int argc, char *argv[]) } /* for pm */ } /* for rop */ break; - + case PLANEMASK: /* Run it through all specified planemasks */ for (pm = 0; pm < numPlanemasks; pm++) { @@ -1149,7 +1149,7 @@ main(int argc, char *argv[]) } } /* for pm */ break; - + case WINDOW: for (int child = 0; child != numSubWindows; child++) { printf ("%s (%ld kids)\n", @@ -1233,7 +1233,7 @@ main(int argc, char *argv[]) } } xparms.cmap = cmap; - + printf("x11perf - X11 performance program, version %s\n", xparms.version & VERSION1_5 ? "1.5" : xparms.version & VERSION1_4 ? "1.4" : @@ -1251,7 +1251,7 @@ main(int argc, char *argv[]) saver off, but this causes problems on some servers. We also reset the screen-saver timer each test, as 8 hours is about the maximum time we can use, and that isn't long enough for some X terminals using a - serial protocol to finish all the tests. As long as the tests run to + serial protocol to finish all the tests. As long as the tests run to completion, the old screen-saver values are restored. */ XForceScreenSaver(xparms.d, ScreenSaverReset); XGetScreenSaver(xparms.d, &ssTimeout, &ssInterval, &ssPreferBlanking, @@ -1264,7 +1264,7 @@ main(int argc, char *argv[]) #ifdef SIGHUP (void) signal(SIGHUP, Cleanup); #endif - XSetScreenSaver(xparms.d, 8 * 3600, ssInterval, ssPreferBlanking, + XSetScreenSaver(xparms.d, 8 * 3600, ssInterval, ssPreferBlanking, ssAllowExposures); if (drawToFakeServer) { @@ -1293,12 +1293,12 @@ main(int argc, char *argv[]) if (window_y + 1 + HEIGHT > DisplayHeight(xparms.d, screen)) HSy = DisplayHeight(xparms.d, screen) - (1 + window_y + 1); status = CreatePerfWindow(&xparms, window_x, HEIGHT+5, WIDTH, 20); - tgcv.foreground = + tgcv.foreground = AllocateColor(xparms.d, "black", BlackPixel(xparms.d, screen)); - tgcv.background = + tgcv.background = AllocateColor(xparms.d, "white", WhitePixel(xparms.d, screen)); tgc = XCreateGC(xparms.d, status, GCForeground | GCBackground, &tgcv); - + xparms.p = (Pixmap)0; if (synchronous) @@ -1306,7 +1306,7 @@ main(int argc, char *argv[]) /* Get mouse pointer out of the way of the performance window. On software cursor machines it will slow graphics performance. On - all current MIT-derived servers it will slow window + all current MIT-derived servers it will slow window creation/configuration performance. */ XWarpPointer(xparms.d, None, status, 0, 0, 0, 0, WIDTH+32, 20+32); @@ -1349,7 +1349,7 @@ main(int argc, char *argv[]) } /* for pm */ } /* for rop */ break; - + case PLANEMASK: /* Run it through all specified planemasks */ for (pm = 0; pm < numPlanemasks; pm++) { @@ -1364,7 +1364,7 @@ main(int argc, char *argv[]) planemasks[pm], label); } /* for pm */ break; - + case WINDOW: /* Loop through number of children array */ for (int child = 0; child != numSubWindows; child++) { |