mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
Add a -t switch for varying the benchmark run time. I'll work on
submitting this upstream.
This commit is contained in:
parent
981d45c88b
commit
3c5ba9aed0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=265034
5 changed files with 219 additions and 0 deletions
45
benchmarks/ubench/files/patch-timeout-cpubench.c
Normal file
45
benchmarks/ubench/files/patch-timeout-cpubench.c
Normal file
|
@ -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 )
|
||||
{
|
45
benchmarks/ubench/files/patch-timeout-diskbench.c
Normal file
45
benchmarks/ubench/files/patch-timeout-diskbench.c
Normal file
|
@ -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 )
|
||||
{
|
45
benchmarks/ubench/files/patch-timeout-membench.c
Normal file
45
benchmarks/ubench/files/patch-timeout-membench.c
Normal file
|
@ -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 )
|
||||
{
|
11
benchmarks/ubench/files/patch-timeout-netbench.c
Normal file
11
benchmarks/ubench/files/patch-timeout-netbench.c
Normal file
|
@ -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;
|
73
benchmarks/ubench/files/patch-timeout-ubench.c
Normal file
73
benchmarks/ubench/files/patch-timeout-ubench.c
Normal file
|
@ -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 )
|
Loading…
Add table
Reference in a new issue