diff -uNpr hdbench-0.14.0.orig/src/Makefile.am hdbench-0.14.0/src/Makefile.am --- hdbench-0.14.0.orig/src/Makefile.am Wed Oct 6 22:35:13 1999 +++ hdbench-0.14.0/src/Makefile.am Thu Sep 15 22:28:54 2011 @@ -6,7 +6,7 @@ INCLUDES = \ bin_PROGRAMS = hdbench -hdbench_SOURCES = benchcpu.s benchmark.c getinfo.c hdbench.c intl.h main.c \ +hdbench_SOURCES = benchcpu.c benchmark.c getinfo.c hdbench.c intl.h main.c \ proto.h selection.c selection.h shhopt.c shhopt.h sighandler.c support.c variable.h hdbench_LDADD = @GTK_LIBS@ $(INTLLIBS) diff -uNpr hdbench-0.14.0.orig/src/Makefile.in hdbench-0.14.0/src/Makefile.in --- hdbench-0.14.0.orig/src/Makefile.in Wed Oct 6 22:39:58 1999 +++ hdbench-0.14.0/src/Makefile.in Thu Sep 15 22:28:54 2011 @@ -96,7 +96,7 @@ INCLUDES = -I$(top_srcdir)/intl @GTK_CFLAGS@ bin_PROGRAMS = hdbench -hdbench_SOURCES = benchcpu.s benchmark.c getinfo.c hdbench.c intl.h main.c proto.h selection.c selection.h shhopt.c shhopt.h sighandler.c support.c variable.h +hdbench_SOURCES = benchcpu.c benchmark.c getinfo.c hdbench.c intl.h main.c proto.h selection.c selection.h shhopt.c shhopt.h sighandler.c support.c variable.h hdbench_LDADD = @GTK_LIBS@ $(INTLLIBS) diff -uNpr hdbench-0.14.0.orig/src/benchcpu.c hdbench-0.14.0/src/benchcpu.c --- hdbench-0.14.0.orig/src/benchcpu.c Thu Jan 1 09:00:00 1970 +++ hdbench-0.14.0/src/benchcpu.c Thu Sep 15 22:28:54 2011 @@ -0,0 +1,74 @@ +#include "proto.h" +#include "variable.h" + +gint32 bench_integer(void) +{ + gint i; + gint32 result = 0; + volatile gint32 x; + volatile static gint32 a = 256; + volatile static gint32 b = 128; + + while (1) { + for (i = 0; i < 300; i++) { + x = a * b; + x = a * b; + x = a / b; + x = a / b; + x = a + b; + x = a + b; + x = a - b; + x = a - b; + } + + result++; + if (done_flag) return result; + } +} + +gint32 bench_float(void) +{ + gint i; + gint32 result = 0; + volatile gfloat x; + volatile static gfloat a = 256.0; + volatile static gfloat b = 128.0; + + while (1) { + for (i = 0; i < 300; i++) { + x = a * b; + x = a * b; + x = a / b; + x = a / b; + x = a + b; + x = a + b; + x = a - b; + x = a - b; + } + + result++; + if (done_flag) return result; + } +} + +gint32 bench_memory(gchar *src, gchar *dest) +{ + gint i, j; + gint32 *s, *d; + gint32 result = 0; + + while (1) { + // src, dest must be 4-byte aligned + s = (gint32 *)src; + d = (gint32 *)dest; + + for (i = 0; i < 64; i++) { + for (j = 0; j < 8192; j++) { // 2MB/4/64 + *d++ = *s++; + } + + result++; + if (done_flag) return result; + } + } +} diff -uNpr hdbench-0.14.0.orig/src/benchmark.c hdbench-0.14.0/src/benchmark.c --- hdbench-0.14.0.orig/src/benchmark.c Wed Oct 6 21:23:01 1999 +++ hdbench-0.14.0/src/benchmark.c Thu Sep 15 22:28:54 2011 @@ -30,7 +30,11 @@ #include #include #include +#if defined(__OpenBSD__) // XXX +#include +#else #include +#endif #include #include #include diff -uNpr hdbench-0.14.0.orig/src/proto.h hdbench-0.14.0/src/proto.h --- hdbench-0.14.0.orig/src/proto.h Wed Oct 6 20:50:43 1999 +++ hdbench-0.14.0/src/proto.h Thu Sep 15 22:28:54 2011 @@ -61,7 +61,7 @@ void set_sigalarm(gint sec); void alarm_handler(void); -/* benchcpu.s */ +/* benchcpu.c */ gint32 bench_integer(void); gint32 bench_float(void); diff -uNpr hdbench-0.14.0.orig/src/variable.h hdbench-0.14.0/src/variable.h --- hdbench-0.14.0.orig/src/variable.h Wed Oct 6 03:36:37 1999 +++ hdbench-0.14.0/src/variable.h Thu Sep 15 22:51:27 2011 @@ -55,7 +55,7 @@ struct Disk_Result { gint32 write; }; -GLOBAL gint done_flag; +GLOBAL volatile gint done_flag; GLOBAL gint disk_capacity GLOBAL_VAL(10); GLOBAL gchar *font_name GLOBAL_VAL("-adobe-helvetica-medium-r-*--14-*"); GLOBAL gchar *video_text GLOBAL_VAL("HDBENCH clone");