mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-31 19:12:32 +01:00
Kill BENCH
Nice idea, x86 assembly is so 1980s. tests/testgrad.c could probably have been saved, but seriously, who's going to miss it? Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
This commit is contained in:
committed by
Carlos R. Mafra
parent
4a9d561ce4
commit
b4b07c2cac
@@ -1,68 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
inline static void
|
|
||||||
cycle_bench(int start)
|
|
||||||
{
|
|
||||||
static volatile unsigned int start_cycle;
|
|
||||||
|
|
||||||
if (start) {
|
|
||||||
asm volatile
|
|
||||||
("pushl %%edx \n\t"
|
|
||||||
"rdtsc \n\t"
|
|
||||||
"movl %%eax,%0 \n\t"
|
|
||||||
"cld \n\t"
|
|
||||||
"popl %%edx \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
"nop \n\t"
|
|
||||||
: "=m" (start_cycle) : : "eax", "edx");
|
|
||||||
} else {
|
|
||||||
volatile int end;
|
|
||||||
|
|
||||||
asm volatile
|
|
||||||
("pushl %%edx \n\t"
|
|
||||||
"clc \n\t"
|
|
||||||
"rdtsc \n\t"
|
|
||||||
"movl %%eax, %0 \n\t"
|
|
||||||
"popl %%edx \n\t"
|
|
||||||
: "=m" (end) : : "eax", "edx");
|
|
||||||
|
|
||||||
printf("Cycle count = %u\n", end - start_cycle - 68);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// seems linux doesnt allow user progs to exec rdpmc
|
|
||||||
inline static void
|
|
||||||
cache_bench(int start)
|
|
||||||
{
|
|
||||||
static int start_cycle;
|
|
||||||
|
|
||||||
if (start) {
|
|
||||||
asm volatile
|
|
||||||
("movl $1,%%ecx \n\t"
|
|
||||||
"rdpmc \n\t"
|
|
||||||
"movl %%eax,%0 \n\t"
|
|
||||||
: "=m" (start_cycle));
|
|
||||||
} else {
|
|
||||||
int end;
|
|
||||||
|
|
||||||
asm volatile
|
|
||||||
("movl $1,%%ecx \n\t"
|
|
||||||
"rdpmc \n\t"
|
|
||||||
"movl %%eax,%0"
|
|
||||||
: "=m" (end));
|
|
||||||
|
|
||||||
printf("Cache reloads counted = %i\n", end - start_cycle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -595,9 +595,7 @@ RContext *RCreateContext(Display * dpy, int screen_number, RContextAttributes *
|
|||||||
|
|
||||||
/* get configuration from environment variables */
|
/* get configuration from environment variables */
|
||||||
gatherconfig(context, screen_number);
|
gatherconfig(context, screen_number);
|
||||||
#ifndef BENCH
|
|
||||||
_wraster_change_filter(context->attribs->scaling_filter);
|
_wraster_change_filter(context->attribs->scaling_filter);
|
||||||
#endif
|
|
||||||
if ((context->attribs->flags & RC_VisualID)) {
|
if ((context->attribs->flags & RC_VisualID)) {
|
||||||
XVisualInfo *vinfo, templ;
|
XVisualInfo *vinfo, templ;
|
||||||
int nret;
|
int nret;
|
||||||
|
|||||||
@@ -34,10 +34,6 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#ifdef BENCH
|
|
||||||
#include "bench.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wraster.h"
|
#include "wraster.h"
|
||||||
|
|
||||||
#ifdef XSHM
|
#ifdef XSHM
|
||||||
@@ -324,10 +320,6 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * image)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BENCH
|
|
||||||
cycle_bench(1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ctx->attribs->render_mode == RBestMatchRendering) {
|
if (ctx->attribs->render_mode == RBestMatchRendering) {
|
||||||
int ofs, r, g, b;
|
int ofs, r, g, b;
|
||||||
int x, y;
|
int x, y;
|
||||||
@@ -424,10 +416,6 @@ static RXImage *image2TrueColor(RContext * ctx, RImage * image)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BENCH
|
|
||||||
cycle_bench(0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ximg;
|
return ximg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,27 +888,15 @@ int RConvertImage(RContext * context, RImage * image, Pixmap * pixmap)
|
|||||||
|
|
||||||
switch (context->vclass) {
|
switch (context->vclass) {
|
||||||
case TrueColor:
|
case TrueColor:
|
||||||
#ifdef BENCH
|
|
||||||
cycle_bench(1);
|
|
||||||
#endif
|
|
||||||
ximg = image2TrueColor(context, image);
|
ximg = image2TrueColor(context, image);
|
||||||
#ifdef BENCH
|
|
||||||
cycle_bench(0);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PseudoColor:
|
case PseudoColor:
|
||||||
case StaticColor:
|
case StaticColor:
|
||||||
#ifdef BENCH
|
|
||||||
cycle_bench(1);
|
|
||||||
#endif
|
|
||||||
if (context->attribs->standard_colormap_mode != RIgnoreStdColormap)
|
if (context->attribs->standard_colormap_mode != RIgnoreStdColormap)
|
||||||
ximg = image2StandardPseudoColor(context, image);
|
ximg = image2StandardPseudoColor(context, image);
|
||||||
else
|
else
|
||||||
ximg = image2PseudoColor(context, image);
|
ximg = image2PseudoColor(context, image);
|
||||||
#ifdef BENCH
|
|
||||||
cycle_bench(0);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GrayScale:
|
case GrayScale:
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef BENCH
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
Window win;
|
Window win;
|
||||||
@@ -26,9 +22,6 @@ void print_help()
|
|||||||
puts(" -v <vis-id> visual id to use");
|
puts(" -v <vis-id> visual id to use");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BENCH
|
|
||||||
#include "bench.h"
|
|
||||||
#endif
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RContextAttributes attr;
|
RContextAttributes attr;
|
||||||
@@ -38,10 +31,6 @@ int main(int argc, char **argv)
|
|||||||
XColor color;
|
XColor color;
|
||||||
XSetWindowAttributes val;
|
XSetWindowAttributes val;
|
||||||
int visualID = -1;
|
int visualID = -1;
|
||||||
#ifdef BENCH
|
|
||||||
double t1, t2, total, t, rt;
|
|
||||||
struct timeval timev;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ProgName = strrchr(argv[0], '/');
|
ProgName = strrchr(argv[0], '/');
|
||||||
if (!ProgName)
|
if (!ProgName)
|
||||||
@@ -135,56 +124,12 @@ int main(int argc, char **argv)
|
|||||||
val.background_pixel = ctx->black;
|
val.background_pixel = ctx->black;
|
||||||
val.colormap = ctx->cmap;
|
val.colormap = ctx->cmap;
|
||||||
val.backing_store = Always;
|
val.backing_store = Always;
|
||||||
#ifdef BENCH
|
|
||||||
win = XCreateWindow(dpy, DefaultRootWindow(dpy), 10, 10, 250, 250,
|
|
||||||
0, ctx->depth, InputOutput, ctx->visual,
|
|
||||||
CWColormap | CWBackPixel | CWBackingStore, &val);
|
|
||||||
#else
|
|
||||||
win = XCreateWindow(dpy, DefaultRootWindow(dpy), 10, 10, 750, 250,
|
win = XCreateWindow(dpy, DefaultRootWindow(dpy), 10, 10, 750, 250,
|
||||||
0, ctx->depth, InputOutput, ctx->visual,
|
0, ctx->depth, InputOutput, ctx->visual,
|
||||||
CWColormap | CWBackPixel | CWBackingStore, &val);
|
CWColormap | CWBackPixel | CWBackingStore, &val);
|
||||||
#endif
|
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
||||||
#ifdef BENCH
|
|
||||||
rt = 0;
|
|
||||||
gettimeofday(&timev, NULL);
|
|
||||||
t = (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
|
||||||
for (i = 0; i < 9; i++) {
|
|
||||||
if (i > 0)
|
|
||||||
printf("\nrepeating...\n\n");
|
|
||||||
gettimeofday(&timev, NULL);
|
|
||||||
t1 = (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
|
||||||
if (i % 3 == 0)
|
|
||||||
imgh = RRenderMultiGradient(550, 550, colors, RGRD_HORIZONTAL);
|
|
||||||
else if (i % 3 == 1)
|
|
||||||
imgh = RRenderMultiGradient(550, 550, colors, RGRD_VERTICAL);
|
|
||||||
else
|
|
||||||
imgh = RRenderMultiGradient(550, 550, colors, RGRD_DIAGONAL);
|
|
||||||
|
|
||||||
gettimeofday(&timev, NULL);
|
|
||||||
t2 = (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
|
||||||
total = t2 - t1;
|
|
||||||
printf("gradient rendered in %f sec\n", total);
|
|
||||||
|
|
||||||
RConvertImage(ctx, imgh, &pix);
|
|
||||||
gettimeofday(&timev, NULL);
|
|
||||||
t1 = (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
|
||||||
total = t1 - t2;
|
|
||||||
rt += total;
|
|
||||||
printf("image converted in %f sec\n", total);
|
|
||||||
|
|
||||||
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 0, 0);
|
|
||||||
|
|
||||||
XFlush(dpy);
|
|
||||||
}
|
|
||||||
t1 = (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
|
||||||
printf("------------------------------------------\n");
|
|
||||||
printf("%i images processed in %f sec\n", i, t1 - t);
|
|
||||||
printf("average time per convertion %f sec\n", rt / i);
|
|
||||||
printf("------------------------------------------\n");
|
|
||||||
#else
|
|
||||||
imgh = RRenderMultiGradient(250, 250, colors, RGRD_HORIZONTAL);
|
imgh = RRenderMultiGradient(250, 250, colors, RGRD_HORIZONTAL);
|
||||||
imgv = RRenderMultiGradient(250, 250, colors, RGRD_VERTICAL);
|
imgv = RRenderMultiGradient(250, 250, colors, RGRD_VERTICAL);
|
||||||
imgd = RRenderMultiGradient(250, 250, colors, RGRD_DIAGONAL);
|
imgd = RRenderMultiGradient(250, 250, colors, RGRD_DIAGONAL);
|
||||||
@@ -198,7 +143,6 @@ int main(int argc, char **argv)
|
|||||||
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 500, 0);
|
XCopyArea(dpy, pix, win, ctx->copy_gc, 0, 0, 250, 250, 500, 0);
|
||||||
|
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
#endif
|
|
||||||
|
|
||||||
getchar();
|
getchar();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user