aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2010-11-24 06:23:33 +0800
committerbrian <brian@FreeBSD.org>2010-11-24 06:23:33 +0800
commitbab3ada07acb2acdcfa51bc944be21dd31926fdf (patch)
treee2ddc25816752144074d199a785e0c69fa63e15a /benchmarks
parent4fe96f1f0b780fc887f12ef18d8a3d6abe78a78a (diff)
downloadfreebsd-ports-gnome-bab3ada07acb2acdcfa51bc944be21dd31926fdf.tar.gz
freebsd-ports-gnome-bab3ada07acb2acdcfa51bc944be21dd31926fdf.tar.zst
freebsd-ports-gnome-bab3ada07acb2acdcfa51bc944be21dd31926fdf.zip
Add a -t switch for varying the benchmark run time. I'll work on
submitting this upstream.
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/ubench/files/patch-timeout-cpubench.c45
-rw-r--r--benchmarks/ubench/files/patch-timeout-diskbench.c45
-rw-r--r--benchmarks/ubench/files/patch-timeout-membench.c45
-rw-r--r--benchmarks/ubench/files/patch-timeout-netbench.c11
-rw-r--r--benchmarks/ubench/files/patch-timeout-ubench.c73
5 files changed, 219 insertions, 0 deletions
diff --git a/benchmarks/ubench/files/patch-timeout-cpubench.c b/benchmarks/ubench/files/patch-timeout-cpubench.c
new file mode 100644
index 000000000000..88ad0dfbfca4
--- /dev/null
+++ b/benchmarks/ubench/files/patch-timeout-cpubench.c
@@ -0,0 +1,45 @@
+--- cpubench.c.orig 2000-05-28 20:21:13.000000000 -0700
++++ cpubench.c 2010-11-23 14:20:52.000000000 -0800
+@@ -114,7 +114,7 @@
+ return i;
+ }
+ /*****************************************************************************/
+-int cpubench()
++int cpubench(int cpubench_time)
+ {
+ int sv[2],i;
+ int d=0;
+@@ -126,7 +126,7 @@
+ return 0;
+ }
+ cpu_score=0;
+- alarm(CPUBENCH_TIME);
++ alarm(cpubench_time);
+ switch ( (i=sigsetjmp(env,0xffff)) )
+ {
+ case 0:
+@@ -136,7 +136,7 @@
+ if ( child ) exit(0);
+ child_number=0;
+ close(sv[0]);
+- dlt=(double )cpu_score*(double )itim;
++ dlt=(double )cpu_score * CPUBENCH_TIME * (double )itim / cpubench_time;
+ dlt=dlt/(double )CPUREFSCORE;
+ cpu_score=dlt;
+ fprintf(stdout,"Ubench CPU: %8d\n",cpu_score);
+@@ -152,13 +152,13 @@
+ itim=cpucalibrate(CPUREFTIME);
+ if ( ONEflag )
+ {
+- dlt=itim*(double )CPUBENCH_TIME/(double )CPUREFTIME/(double )CPUREFSCORE;
++ dlt=itim*(double )cpubench_time/(double )CPUREFTIME/(double )CPUREFSCORE;
+ cpu_score=dlt;
+ fprintf(stdout,"Ubench Single CPU: %8d (%.2fs)\n",
+ cpu_score,cpuload(itim));
+ return cpu_score;
+ }
+- alarm(CPUBENCH_TIME);
++ alarm(cpubench_time);
+ child_pid[child_number]=fork();
+ if ( child_pid[child_number] == -1 )
+ {
diff --git a/benchmarks/ubench/files/patch-timeout-diskbench.c b/benchmarks/ubench/files/patch-timeout-diskbench.c
new file mode 100644
index 000000000000..c8957bbb5b75
--- /dev/null
+++ b/benchmarks/ubench/files/patch-timeout-diskbench.c
@@ -0,0 +1,45 @@
+--- diskbench.c.orig 2000-07-31 10:24:10.000000000 -0700
++++ diskbench.c 2010-11-23 14:20:52.000000000 -0800
+@@ -103,7 +103,7 @@
+ return i;
+ }
+ /*****************************************************************************/
+-int diskbench()
++int diskbench(int diskbench_time)
+ {
+ int sv[2],i;
+ int d=0;
+@@ -115,7 +115,7 @@
+ return 0;
+ }
+ cpu_score=0;
+- alarm(DISKBENCH_TIME);
++ alarm(diskbench_time);
+ switch ( (i=sigsetjmp(env,0xffff)) )
+ {
+ case 0:
+@@ -124,7 +124,7 @@
+ for (i=0;i<child_number;i++) kill(child_pid[i],SIGALRM);
+ if ( child ) exit(0);
+ close(sv[0]);
+- dlt=(double )cpu_score*(double )itim;
++ dlt=(double )cpu_score * DISKBENCH_TIME * (double )itim / diskbench_time;
+ dlt=dlt/(double )DISKREFSCORE;
+ cpu_score=dlt;
+ fprintf(stdout,"Ubench DISK: %d\n",cpu_score);
+@@ -140,13 +140,13 @@
+ itim=diskcalibrate(DISKREFTIME);
+ if ( ONEflag )
+ {
+- dlt=itim*(double )DISKBENCH_TIME/(double )DISKREFTIME/(double )DISKREFSCORE;
++ dlt=itim*(double )diskbench_time/(double )DISKREFTIME/(double )DISKREFSCORE;
+ cpu_score=dlt;
+ fprintf(stdout,"Ubench Single DISK: %d (%.2fs)\n",
+ cpu_score,diskload(itim));
+ return cpu_score;
+ }
+- alarm(DISKBENCH_TIME);
++ alarm(diskbench_time);
+ child_pid[child_number]=fork();
+ if ( child_pid[child_number] == -1 )
+ {
diff --git a/benchmarks/ubench/files/patch-timeout-membench.c b/benchmarks/ubench/files/patch-timeout-membench.c
new file mode 100644
index 000000000000..f9fa3489af5c
--- /dev/null
+++ b/benchmarks/ubench/files/patch-timeout-membench.c
@@ -0,0 +1,45 @@
+--- membench.c.orig 2000-07-31 10:23:27.000000000 -0700
++++ membench.c 2010-11-23 14:20:52.000000000 -0800
+@@ -102,7 +102,7 @@
+ return i;
+ }
+ /*****************************************************************************/
+-int membench()
++int membench(int membench_time)
+ {
+ int sv[2],i;
+ int d=0;
+@@ -114,7 +114,7 @@
+ return 0;
+ }
+ cpu_score=0;
+- alarm(MEMBENCH_TIME);
++ alarm(membench_time);
+ switch ( (i=sigsetjmp(env,0xffff)) )
+ {
+ case 0:
+@@ -123,7 +123,7 @@
+ for (i=0;i<child_number;i++) kill(child_pid[i],SIGALRM);
+ if ( child ) exit(0);
+ close(sv[0]);
+- dlt=(double )cpu_score*(double )itim;
++ dlt=(double )cpu_score * MEMBENCH_TIME * (double )itim / membench_time;
+ dlt=dlt/(double )MEMREFSCORE;
+ cpu_score=dlt;
+ fprintf(stdout,"Ubench MEM: %8d\n",cpu_score);
+@@ -139,13 +139,13 @@
+ itim=memcalibrate(MEMREFTIME);
+ if ( ONEflag )
+ {
+- dlt=itim*(double )MEMBENCH_TIME/(double )MEMREFTIME/(double )MEMREFSCORE;
++ dlt=itim*(double )membench_time/(double )MEMREFTIME/(double )MEMREFSCORE;
+ cpu_score=dlt;
+ fprintf(stdout,"Ubench Single MEM: %8d (%.2fs)\n",
+ cpu_score,memload(itim));
+ return cpu_score;
+ }
+- alarm(MEMBENCH_TIME);
++ alarm(membench_time);
+ child_pid[child_number]=fork();
+ if ( child_pid[child_number] == -1 )
+ {
diff --git a/benchmarks/ubench/files/patch-timeout-netbench.c b/benchmarks/ubench/files/patch-timeout-netbench.c
new file mode 100644
index 000000000000..d1979de4ded9
--- /dev/null
+++ b/benchmarks/ubench/files/patch-timeout-netbench.c
@@ -0,0 +1,11 @@
+--- netbench.c.orig 2000-02-18 14:39:30.000000000 -0800
++++ netbench.c 2010-11-23 14:20:52.000000000 -0800
+@@ -18,7 +18,7 @@
+ */
+
+ extern int NETflag;
+-int netbench()
++int netbench(int netbench_time)
+ {
+ NETflag = 0;
+ return 0;
diff --git a/benchmarks/ubench/files/patch-timeout-ubench.c b/benchmarks/ubench/files/patch-timeout-ubench.c
new file mode 100644
index 000000000000..26d8d21c55e5
--- /dev/null
+++ b/benchmarks/ubench/files/patch-timeout-ubench.c
@@ -0,0 +1,73 @@
+--- ubench.c.orig 2000-05-28 20:07:21.000000000 -0700
++++ ubench.c 2010-11-23 14:20:52.000000000 -0800
+@@ -37,11 +37,11 @@
+ #define sys_errlist _sys_errlist
+ #endif
+
+-int cpubench();
+-int membench();
++int cpubench(int);
++int membench(int);
+ #ifdef DISKNETYES
+-int diskbench();
+-int netbench();
++int diskbench(int);
++int netbench(int);
+ #endif
+ void signalSetup();
+
+@@ -66,10 +66,10 @@
+ {
+ #ifdef DISKNETYES
+ fprintf(stderr,
+- "Usage: ubench [-cmhs] [-d [raw_device]] [-n [interface]]\n");
++ "Usage: ubench [-cmhs] [-d [raw_device]] [-n [interface]] [-t testtime]\n");
+ #else
+ fprintf(stderr,
+- "Usage: ubench [-cmhs]\n");
++ "Usage: ubench [-cmhs] [-t testtime]\n");
+ #endif
+ }
+ /*****************************************************************************/
+@@ -81,6 +81,7 @@
+ int s = 1;
+ int k = 1;
+ int i = 1;
++ int timeout = 180;
+
+ while ( argc[i] )
+ if ( argc[i][0]=='-' )
+@@ -112,6 +113,17 @@
+ s++;
+ ONEflag=1;
+ goto prgs;
++ case 't':
++ if (!argc[i][++s]) {
++ if (!argc[++i]) {
++ print_usage();
++ exit(1);
++ }
++ s = 0;
++ }
++ timeout = atoi(argc[i] + s);
++ s += strlen(argc[i] + s);
++ goto prgs;
+ default:
+ print_version();
+ print_usage();
+@@ -156,11 +168,11 @@
+ #endif
+ }
+ i=0;
+- if ( CPUflag ) i+=cpubench();
+- if ( MEMflag ) i+=membench();
++ if ( CPUflag ) i+=cpubench(timeout);
++ if ( MEMflag ) i+=membench(timeout);
+ #ifdef DISKNETYES
+- if ( DISKflag ) i+=diskbench();
+- if ( NETflag ) i+=netbench();
++ if ( DISKflag ) i+=diskbench(timeout);
++ if ( NETflag ) i+=netbench(timeout);
+ if ( CPUflag&MEMflag&DISKflag&NETflag )
+ {
+ if ( ONEflag )