mirror of
https://github.com/kdlucas/byte-unixbench.git
synced 2024-12-11 23:30:07 +08:00
Merge pull request #34 from gstrauss/Makefile-modernization
Makefile modernization. Looks good. Let's merge and see if anyone finds issues they cannot resolve.
This commit is contained in:
commit
c22488d72c
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
UnixBench/pgms
|
||||
UnixBench/results
|
||||
UnixBench/tmp
|
@ -31,6 +31,8 @@
|
||||
# 09/30/07 adding ubgears, GRAPHIC_TESTS switch
|
||||
# 10/14/07 adding large.txt
|
||||
# 01/13/11 added support for parallel compilation
|
||||
# 01/07/16 [refer to version control commit messages and
|
||||
# cease using two-digit years in date formats]
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
@ -39,9 +41,9 @@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# GRAPHICS TESTS: Uncomment the definition of "GRAPHIC_TESTS" to enable
|
||||
# GRAPHIC TESTS: Uncomment the definition of "GRAPHIC_TESTS" to enable
|
||||
# the building of the graphics benchmarks. This will require the
|
||||
# X11 libraries on your system.
|
||||
# X11 libraries on your system. (e.g. libX11-devel mesa-libGL-devel)
|
||||
#
|
||||
# Comment the line out to disable these tests.
|
||||
# GRAPHIC_TESTS = defined
|
||||
@ -71,14 +73,33 @@ CC=gcc
|
||||
# -m386 -malign-loops=1 -malign-jumps=1 -malign-functions=1
|
||||
|
||||
## For Solaris 2, or general-purpose GCC 2.7.x
|
||||
OPTON = -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall
|
||||
#OPTON = -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall
|
||||
|
||||
## For Digital Unix v4.x, with DEC cc v5.x
|
||||
#OPTON = -O4
|
||||
#CFLAGS = -DTIME -std1 -verbose -w0
|
||||
|
||||
## gcc optimization flags
|
||||
## (-ffast-math) disables strict IEEE or ISO rules/specifications for math funcs
|
||||
OPTON = -O3 -ffast-math
|
||||
|
||||
## OS detection. Comment out if gmake syntax not supported by other 'make'.
|
||||
OSNAME:=$(shell uname -s)
|
||||
|
||||
ifeq ($(OSNAME),Linux)
|
||||
OPTON += -march=native -mtune=native
|
||||
endif
|
||||
ifeq ($(OSNAME),Darwin)
|
||||
# (adjust flags or comment out this section for older versions of XCode or OS X)
|
||||
# (-mmacosx-versin-min= requires at least that version of SDK be installed)
|
||||
OPTON += -march=native -mmacosx-version-min=10.10
|
||||
#http://stackoverflow.com/questions/9840207/how-to-use-avx-pclmulqdq-on-mac-os-x-lion/19342603#19342603
|
||||
CFLAGS += -Wa,-q
|
||||
endif
|
||||
|
||||
|
||||
## generic gcc CFLAGS. -DTIME must be included.
|
||||
CFLAGS = -DTIME -Wall -pedantic -ansi
|
||||
CFLAGS = -Wall -pedantic $(OPTON) -I $(SRCDIR) -DTIME
|
||||
|
||||
|
||||
##############################################################################
|
||||
@ -104,7 +125,7 @@ SOURCES = arith.c big.c context1.c \
|
||||
dhry_1.c dhry_2.c dhry.h whets.c ubgears.c
|
||||
TESTS = sort.src cctest.c dc.dat large.txt
|
||||
|
||||
ifdef GRAPHIC_TESTS
|
||||
ifneq (,$(GRAPHIC_TESTS))
|
||||
GRAPHIC_BINS = $(PROGDIR)/ubgears
|
||||
else
|
||||
GRAPHIC_BINS =
|
||||
@ -128,13 +149,15 @@ REQD = $(BINS) $(PROGDIR)/unixbench.logo \
|
||||
$(TESTDIR)/large.txt
|
||||
|
||||
# ######################### the big ALL ############################
|
||||
all: distr programs
|
||||
all:
|
||||
## Ick!!! What is this about??? How about let's not chmod everything bogusly.
|
||||
# @chmod 744 * $(SRCDIR)/* $(PROGDIR)/* $(TESTDIR)/* $(DOCDIR)/*
|
||||
$(MAKE) distr
|
||||
$(MAKE) programs
|
||||
|
||||
# ####################### a check for Run ######################
|
||||
check: $(REQD)
|
||||
make all
|
||||
$(MAKE) all
|
||||
# ##############################################################
|
||||
# distribute the files out to subdirectories if they are in this one
|
||||
distr:
|
||||
@ -178,76 +201,86 @@ distr:
|
||||
echo "$(RESULTDIR) exists" \
|
||||
; fi
|
||||
|
||||
.PHONY: all check distr programs run clean spotless
|
||||
|
||||
programs: $(BINS)
|
||||
|
||||
# (use $< to link only the first dependency, instead of $^,
|
||||
# since the programs matching this pattern have only
|
||||
# one input file, and others are #include "xxx.c"
|
||||
# within the first. (not condoning, just documenting))
|
||||
# (dependencies could be generated by modern compilers,
|
||||
# but let's not assume modern compilers are present)
|
||||
$(PROGDIR)/%:
|
||||
$(CC) -o $@ $(CFLAGS) $< $(LDFLAGS)
|
||||
|
||||
# Individual programs
|
||||
$(PROGDIR)/arithoh: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/arithoh ${CFLAGS} ${OPTON} -Darithoh $(SRCDIR)/arith.c
|
||||
$(PROGDIR)/register: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/register ${CFLAGS} ${OPTON} -Ddatum='register int' $(SRCDIR)/arith.c
|
||||
$(PROGDIR)/short: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/short ${CFLAGS} ${OPTON} -Ddatum=short $(SRCDIR)/arith.c
|
||||
$(PROGDIR)/int: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/int ${CFLAGS} ${OPTON} -Ddatum=int $(SRCDIR)/arith.c
|
||||
$(PROGDIR)/long: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/long ${CFLAGS} ${OPTON} -Ddatum=long $(SRCDIR)/arith.c
|
||||
$(PROGDIR)/float: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/float ${CFLAGS} ${OPTON} -Ddatum=float $(SRCDIR)/arith.c
|
||||
$(PROGDIR)/double: $(SRCDIR)/arith.c
|
||||
$(CC) -o $(PROGDIR)/double ${CFLAGS} ${OPTON} -Ddatum=double $(SRCDIR)/arith.c
|
||||
# Sometimes the same source file is compiled in different ways.
|
||||
# This limits the 'make' patterns that can usefully be applied.
|
||||
|
||||
$(PROGDIR)/arithoh: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/arithoh: CFLAGS += -Darithoh
|
||||
$(PROGDIR)/register: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/register: CFLAGS += -Ddatum='register int'
|
||||
$(PROGDIR)/short: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/short: CFLAGS += -Ddatum=short
|
||||
$(PROGDIR)/int: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/int: CFLAGS += -Ddatum=int
|
||||
$(PROGDIR)/long: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/long: CFLAGS += -Ddatum=long
|
||||
$(PROGDIR)/float: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/float: CFLAGS += -Ddatum=float
|
||||
$(PROGDIR)/double: $(SRCDIR)/arith.c $(SRCDIR)/timeit.c
|
||||
$(PROGDIR)/double: CFLAGS += -Ddatum=double
|
||||
|
||||
$(PROGDIR)/poll: $(SRCDIR)/time-polling.c
|
||||
$(PROGDIR)/poll: CFLAGS += -DUNIXBENCH -DHAS_POLL
|
||||
$(PROGDIR)/poll2: $(SRCDIR)/time-polling.c
|
||||
$(PROGDIR)/poll2: CFLAGS += -DUNIXBENCH -DHAS_POLL2
|
||||
$(PROGDIR)/select: $(SRCDIR)/time-polling.c
|
||||
$(PROGDIR)/select: CFLAGS += -DUNIXBENCH -DHAS_SELECT
|
||||
|
||||
$(PROGDIR)/whetstone-double: $(SRCDIR)/whets.c
|
||||
$(CC) -o $(PROGDIR)/whetstone-double ${CFLAGS} ${OPTON} -DDP -DUNIX -DUNIXBENCH $(SRCDIR)/whets.c -lm
|
||||
$(PROGDIR)/hanoi: $(SRCDIR)/hanoi.c
|
||||
$(CC) -o $(PROGDIR)/hanoi ${CFLAGS} ${OPTON} $(SRCDIR)/hanoi.c
|
||||
$(PROGDIR)/whetstone-double: CFLAGS += -DDP -DUNIX -DUNIXBENCH
|
||||
$(PROGDIR)/whetstone-double: LDFLAGS += -lm
|
||||
|
||||
$(PROGDIR)/poll: $(SRCDIR)/time-polling.c
|
||||
$(CC) -DHAS_POLL -DUNIXBENCH -o $(PROGDIR)/poll ${CFLAGS} ${OPTON} $(SRCDIR)/time-polling.c
|
||||
$(PROGDIR)/pipe: $(SRCDIR)/pipe.c $(SRCDIR)/timeit.c
|
||||
|
||||
$(PROGDIR)/poll2: $(SRCDIR)/time-polling.c
|
||||
$(CC) -DHAS_POLL2 -DUNIXBENCH -o $(PROGDIR)/poll2 ${CFLAGS} ${OPTON} $(SRCDIR)/time-polling.c
|
||||
$(PROGDIR)/execl: $(SRCDIR)/execl.c $(SRCDIR)/big.c
|
||||
|
||||
$(PROGDIR)/select: $(SRCDIR)/time-polling.c
|
||||
$(CC) -DHAS_SELECT -DUNIXBENCH -o $(PROGDIR)/select ${CFLAGS} ${OPTON} $(SRCDIR)/time-polling.c
|
||||
$(PROGDIR)/spawn: $(SRCDIR)/spawn.c $(SRCDIR)/timeit.c
|
||||
|
||||
$(PROGDIR)/hanoi: $(SRCDIR)/hanoi.c $(SRCDIR)/timeit.c
|
||||
|
||||
$(PROGDIR)/fstime: $(SRCDIR)/fstime.c
|
||||
$(CC) -o $(PROGDIR)/fstime ${CFLAGS} ${OPTON} $(SRCDIR)/fstime.c
|
||||
|
||||
$(PROGDIR)/syscall: $(SRCDIR)/syscall.c
|
||||
$(CC) -o $(PROGDIR)/syscall ${CFLAGS} ${OPTON} $(SRCDIR)/syscall.c
|
||||
$(PROGDIR)/context1: $(SRCDIR)/context1.c
|
||||
$(CC) -o $(PROGDIR)/context1 ${CFLAGS} ${OPTON} $(SRCDIR)/context1.c
|
||||
$(PROGDIR)/pipe: $(SRCDIR)/pipe.c
|
||||
$(CC) -o $(PROGDIR)/pipe ${CFLAGS} ${OPTON} $(SRCDIR)/pipe.c
|
||||
$(PROGDIR)/spawn: $(SRCDIR)/spawn.c
|
||||
$(CC) -o $(PROGDIR)/spawn ${CFLAGS} ${OPTON} $(SRCDIR)/spawn.c
|
||||
$(PROGDIR)/execl: $(SRCDIR)/execl.c $(SRCDIR)/big.c
|
||||
$(CC) -o $(PROGDIR)/execl ${CFLAGS} ${OPTON} $(SRCDIR)/execl.c
|
||||
$(PROGDIR)/syscall: $(SRCDIR)/syscall.c $(SRCDIR)/timeit.c
|
||||
|
||||
$(PROGDIR)/dhry2: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c $(SRCDIR)/dhry.h
|
||||
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DHZ=${HZ} ${OPTON} dhry_1.c
|
||||
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DHZ=${HZ} ${OPTON} dhry_2.c
|
||||
$(CC) -o $(PROGDIR)/dhry2 ${CFLAGS} ${OPTON} $(SRCDIR)/dhry_1.o $(SRCDIR)/dhry_2.o
|
||||
cd $(SRCDIR); rm -f dhry_1.o dhry_2.o
|
||||
$(PROGDIR)/dhry2reg: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c $(SRCDIR)/dhry.h
|
||||
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DREG=register -DHZ=${HZ} ${OPTON} dhry_1.c -o dhry_1_reg.o
|
||||
cd $(SRCDIR); $(CC) -c ${CFLAGS} -DREG=register -DHZ=${HZ} ${OPTON} dhry_2.c -o dhry_2_reg.o
|
||||
$(CC) -o $(PROGDIR)/dhry2reg ${CFLAGS} ${OPTON} $(SRCDIR)/dhry_1_reg.o $(SRCDIR)/dhry_2_reg.o
|
||||
cd $(SRCDIR); rm -f dhry_1_reg.o dhry_2_reg.o
|
||||
$(PROGDIR)/context1: $(SRCDIR)/context1.c $(SRCDIR)/timeit.c
|
||||
|
||||
$(PROGDIR)/looper: $(SRCDIR)/looper.c
|
||||
$(CC) -o $(PROGDIR)/looper ${CFLAGS} ${OPTON} $(SRCDIR)/looper.c
|
||||
$(PROGDIR)/looper: $(SRCDIR)/looper.c $(SRCDIR)/timeit.c
|
||||
|
||||
$(PROGDIR)/ubgears: $(SRCDIR)/ubgears.c
|
||||
$(CC) -o $(PROGDIR)/ubgears ${CFLAGS} ${OPTON} $(SRCDIR)/ubgears.c $(GL_LIBS)
|
||||
$(PROGDIR)/ubgears: LDFLAGS += -lm $(GL_LIBS)
|
||||
|
||||
$(PROGDIR)/dhry2: CFLAGS += -DHZ=${HZ}
|
||||
$(PROGDIR)/dhry2: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c \
|
||||
$(SRCDIR)/dhry.h $(SRCDIR)/timeit.c
|
||||
$(CC) -o $@ ${CFLAGS} $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c
|
||||
|
||||
$(PROGDIR)/dhry2reg: CFLAGS += -DHZ=${HZ} -DREG=register
|
||||
$(PROGDIR)/dhry2reg: $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c \
|
||||
$(SRCDIR)/dhry.h $(SRCDIR)/timeit.c
|
||||
$(CC) -o $@ ${CFLAGS} $(SRCDIR)/dhry_1.c $(SRCDIR)/dhry_2.c
|
||||
|
||||
# Run the benchmarks and create the reports
|
||||
run:
|
||||
sh ./Run
|
||||
|
||||
clean:
|
||||
rm -f $(BINS) core *~ */*~
|
||||
$(RM) $(BINS) core *~ */*~
|
||||
|
||||
spotless: clean
|
||||
rm -f $(RESULTDIR)/* $(TMPDIR)/*
|
||||
$(RM) $(RESULTDIR)/* $(TMPDIR)/*
|
||||
|
||||
## END ##
|
||||
|
@ -672,30 +672,48 @@ sub processCpuFlags {
|
||||
# these fields:
|
||||
# describing the model etc. Returns undef if the information can't be got.
|
||||
sub getCpuInfo {
|
||||
open(my $fd, "<", "/proc/cpuinfo") || return undef;
|
||||
if (!("$^O" eq "darwin")) {
|
||||
open(my $fd, "<", "/proc/cpuinfo") || return undef;
|
||||
|
||||
my $cpus = [ ];
|
||||
my $cpu = 0;
|
||||
while (<$fd>) {
|
||||
chomp;
|
||||
my ( $field, $val ) = split(/[ \t]*:[ \t]*/);
|
||||
next if (!$field || !$val);
|
||||
if ($field eq "processor") {
|
||||
$cpu = $val;
|
||||
} elsif ($field eq "model name") {
|
||||
my $model = $val;
|
||||
$model =~ s/ +/ /g;
|
||||
$cpus->[$cpu]{'model'} = $model;
|
||||
} elsif ($field eq "bogomips") {
|
||||
$cpus->[$cpu]{'bogo'} = $val;
|
||||
} elsif ($field eq "flags") {
|
||||
$cpus->[$cpu]{'flags'} = processCpuFlags($val);
|
||||
my $cpus = [ ];
|
||||
my $cpu = 0;
|
||||
while (<$fd>) {
|
||||
chomp;
|
||||
my ( $field, $val ) = split(/[ \t]*:[ \t]*/);
|
||||
next if (!$field || !$val);
|
||||
if ($field eq "processor") {
|
||||
$cpu = $val;
|
||||
} elsif ($field eq "model name") {
|
||||
my $model = $val;
|
||||
$model =~ s/ +/ /g;
|
||||
$cpus->[$cpu]{'model'} = $model;
|
||||
} elsif ($field eq "bogomips") {
|
||||
$cpus->[$cpu]{'bogo'} = $val;
|
||||
} elsif ($field eq "flags") {
|
||||
$cpus->[$cpu]{'flags'} = processCpuFlags($val);
|
||||
}
|
||||
}
|
||||
|
||||
close($fd);
|
||||
|
||||
$cpus;
|
||||
|
||||
} else {
|
||||
|
||||
my $model = getCmdOutput("sysctl -n machdep.cpu.brand_string");
|
||||
my $flags = getCmdOutput("sysctl -n machdep.cpu.features | tr [A-Z] [a-z]");
|
||||
my $ncpu = getCmdOutput("sysctl -n hw.ncpu");
|
||||
|
||||
my $cpus = [ ];
|
||||
my $cpu = 0;
|
||||
|
||||
for ($cpu = 0; $cpu < $ncpu; $cpu++) {
|
||||
$cpus->[$cpu]{'model'} = $model;
|
||||
$cpus->[$cpu]{'bogo'} = 0;
|
||||
$cpus->[$cpu]{'flags'} = processCpuFlags($flags);
|
||||
}
|
||||
$cpus;
|
||||
}
|
||||
|
||||
close($fd);
|
||||
|
||||
$cpus;
|
||||
}
|
||||
|
||||
|
||||
@ -723,7 +741,7 @@ sub getSystemInfo {
|
||||
$info->{'osRel'} = getCmdOutput("uname -r");
|
||||
$info->{'osVer'} = getCmdOutput("uname -v");
|
||||
$info->{'mach'} = getCmdOutput("uname -m");
|
||||
$info->{'platform'} = getCmdOutput("uname -i");
|
||||
$info->{'platform'} = getCmdOutput("uname -i") || "unknown";
|
||||
|
||||
# Get the system name (SUSE, Red Hat, etc.) if possible.
|
||||
$info->{'system'} = $info->{'os'};
|
||||
@ -735,9 +753,9 @@ sub getSystemInfo {
|
||||
|
||||
# Get the language info.
|
||||
my $lang = getCmdOutput("printenv LANG");
|
||||
my $map = getCmdOutput("locale -k LC_CTYPE | grep charmap");
|
||||
my $map = getCmdOutput("locale -k LC_CTYPE | grep charmap") || "";
|
||||
$map =~ s/.*=//;
|
||||
my $coll = getCmdOutput("locale -k LC_COLLATE | grep collate-codeset");
|
||||
my $coll = getCmdOutput("locale -k LC_COLLATE | grep collate-codeset") || "";
|
||||
$coll =~ s/.*=//;
|
||||
$info->{'language'} = sprintf "%s (charmap=%s, collate=%s)",
|
||||
$lang, $map, $coll;
|
||||
@ -753,7 +771,7 @@ sub getSystemInfo {
|
||||
$info->{'graphics'} = getCmdOutput("3dinfo | cut -f1 -d\'(\'");
|
||||
|
||||
# Get system run state, load and usage info.
|
||||
$info->{'runlevel'} = getCmdOutput("runlevel | cut -f2 -d\" \"");
|
||||
$info->{'runlevel'} = getCmdOutput("who -r | awk '{print \$3}'");
|
||||
$info->{'load'} = getCmdOutput("uptime");
|
||||
$info->{'numUsers'} = getCmdOutput("who | wc -l");
|
||||
|
||||
|
@ -45,10 +45,7 @@
|
||||
#define MAXCHILD 12
|
||||
#define MAXWORK 10
|
||||
|
||||
/* Can't seem to get this declared in the headers... */
|
||||
extern int kill(pid_t pid, int sig);
|
||||
|
||||
void wrapup(char *);
|
||||
void wrapup(const char *);
|
||||
void onalarm(int);
|
||||
void pipeerr();
|
||||
void grunt();
|
||||
@ -56,7 +53,7 @@ void getwork(void);
|
||||
#if debug
|
||||
void dumpwork(void);
|
||||
#endif
|
||||
void fatal(char *s);
|
||||
void fatal(const char *s);
|
||||
|
||||
float thres;
|
||||
float est_rate = DEF_RATE;
|
||||
@ -420,7 +417,7 @@ void pipeerr()
|
||||
sigpipe++;
|
||||
}
|
||||
|
||||
void wrapup(char *reason)
|
||||
void wrapup(const char *reason)
|
||||
{
|
||||
int i;
|
||||
int killed = 0;
|
||||
@ -449,7 +446,6 @@ void getwork(void)
|
||||
char *q = (void *)0;
|
||||
struct st_work *w = (void *)0;
|
||||
char line[MAXLINE];
|
||||
char c;
|
||||
|
||||
while (fgets(line, MAXLINE, stdin) != NULL) {
|
||||
if (nwork >= MAXWORK) {
|
||||
@ -492,7 +488,6 @@ void getwork(void)
|
||||
/* standard input for this job */
|
||||
q = ++lp;
|
||||
while (*lp && *lp != ' ') lp++;
|
||||
c = *lp;
|
||||
*lp = '\0';
|
||||
if ((f = open(q, 0)) == -1) {
|
||||
fprintf(stderr, "cannot open input file (%s) for job %d\n",
|
||||
@ -580,10 +575,10 @@ void dumpwork(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void fatal(char *s)
|
||||
void fatal(const char *s)
|
||||
{
|
||||
int i;
|
||||
fprintf(stderr, s);
|
||||
fprintf(stderr, "%s", s);
|
||||
fflush(stderr);
|
||||
perror("Reason?");
|
||||
fflush(stderr);
|
||||
|
@ -44,6 +44,7 @@ char *argv[];
|
||||
int duration;
|
||||
unsigned long check;
|
||||
int p1[2], p2[2];
|
||||
ssize_t ret;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: context duration\n");
|
||||
@ -70,8 +71,8 @@ char *argv[];
|
||||
perror("master write failed");
|
||||
exit(1);
|
||||
}
|
||||
if (read(p2[0], (char *)&check, sizeof(check)) != sizeof(check)) {
|
||||
if ((errno != 0) && (errno != EINTR))
|
||||
if ((ret = read(p2[0], (char *)&check, sizeof(check))) != sizeof(check)) {
|
||||
if ((ret == -1) && (errno != 0) && (errno != EINTR))
|
||||
perror("master read failed");
|
||||
exit(1);
|
||||
}
|
||||
@ -90,8 +91,8 @@ char *argv[];
|
||||
/* slave, read p1 & write p2 */
|
||||
close(p1[1]); close(p2[0]);
|
||||
while (1) {
|
||||
if (read(p1[0], (char *)&check, sizeof(check)) != sizeof(check)) {
|
||||
if ((errno != 0) && (errno != EINTR))
|
||||
if ((ret = read(p1[0], (char *)&check, sizeof(check))) != sizeof(check)) {
|
||||
if ((ret == -1) && (errno != 0) && (errno != EINTR))
|
||||
perror("slave read failed");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -74,15 +74,13 @@ Enumeration Func_1 ();
|
||||
/* variables for time measurement: */
|
||||
|
||||
#ifdef TIMES
|
||||
struct tms time_info;
|
||||
extern int times ();
|
||||
/* see library function "times" */
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#define Too_Small_Time 120
|
||||
/* Measurements should last at least about 2 seconds */
|
||||
#endif
|
||||
#ifdef TIME
|
||||
extern long time();
|
||||
/* see library function "time" */
|
||||
#include <time.h>
|
||||
#define Too_Small_Time 2
|
||||
/* Measurements should last at least 2 seconds */
|
||||
#endif
|
||||
|
@ -51,8 +51,6 @@ char SCCSid[] = "@(#) @(#)fstime.c:3.5 -- 5/15/91 19:30:19";
|
||||
#define FNAME0 "dummy0"
|
||||
#define FNAME1 "dummy1"
|
||||
|
||||
extern void sync(void);
|
||||
|
||||
int w_test(int timeSecs);
|
||||
int r_test(int timeSecs);
|
||||
int c_test(int timeSecs);
|
||||
@ -318,7 +316,6 @@ int r_test(int timeSecs)
|
||||
unsigned long tmp;
|
||||
double start, end;
|
||||
extern int sigalarm;
|
||||
extern int errno;
|
||||
|
||||
/* Sync and let it settle */
|
||||
sync();
|
||||
|
@ -90,7 +90,7 @@ char *argv[];
|
||||
fprintf(stderr,"%s: fork failed\n", argv[0]);
|
||||
exit(1);
|
||||
} else if (pid == 0) {
|
||||
execl("/bin/true", (char *) 0);
|
||||
execl("/bin/true", "/bin/true", (char *) 0);
|
||||
fprintf(stderr,"%s: exec /bin/true failed\n", argv[0]);
|
||||
exit(1);
|
||||
} else {
|
||||
|
@ -80,6 +80,8 @@
|
||||
typedef int flag;
|
||||
|
||||
|
||||
#ifdef HAS_SELECT
|
||||
|
||||
/*
|
||||
static inline int find_first_set_bit (CONST void *array, int size)
|
||||
*/
|
||||
@ -144,6 +146,8 @@ static int find_next_set_bit (CONST void *array, int size, int offset)
|
||||
return (find_first_set_bit (++ul_array, size - index) + index);
|
||||
} /* End Function find_next_set_bit */
|
||||
|
||||
#endif /* HAS_SELECT */
|
||||
|
||||
|
||||
struct callback_struct
|
||||
{
|
||||
@ -245,7 +249,7 @@ static void time_poll (struct pollfd *pollfd_array, int start_index,
|
||||
short revents;
|
||||
int fd, count, nready;
|
||||
struct timeval time1, time2;
|
||||
struct pollfd *pollfd_ptr, *stop_pollfd;
|
||||
struct pollfd *pollfd_ptr;
|
||||
|
||||
/* Warm the cache a bit */
|
||||
poll (pollfd_array + start_index, num_to_test, 0);
|
||||
@ -264,11 +268,11 @@ static void time_poll (struct pollfd *pollfd_array, int start_index,
|
||||
fprintf (stderr, "Error: nready: %d\n", nready);
|
||||
exit (1);
|
||||
}
|
||||
stop_pollfd = pollfd_array + start_index + num_to_test;
|
||||
for (pollfd_ptr = pollfd_array + start_index; TRUE; ++pollfd_ptr)
|
||||
for (pollfd_ptr = pollfd_array + start_index; nready; ++pollfd_ptr)
|
||||
{
|
||||
if (pollfd_ptr->revents == 0) continue;
|
||||
/* Have an active descriptor */
|
||||
--nready;
|
||||
revents = pollfd_ptr->revents;
|
||||
fd = pollfd_ptr->fd;
|
||||
if (revents & POLLPRI)
|
||||
@ -277,7 +281,6 @@ static void time_poll (struct pollfd *pollfd_array, int start_index,
|
||||
(*callbacks[fd].input_func) (callbacks[fd].info);
|
||||
if (revents & POLLOUT)
|
||||
(*callbacks[fd].output_func) (callbacks[fd].info);
|
||||
if (--nready == 0) break;
|
||||
}
|
||||
gettimeofday (&time2, NULL);
|
||||
times[count] = (time2.tv_sec - time1.tv_sec) * 1000000;
|
||||
@ -373,9 +376,6 @@ char *argv[];
|
||||
struct poll2ofd poll2ofd_array[MAX_FDS];
|
||||
long poll2_times[MAX_ITERATIONS];
|
||||
#endif
|
||||
#if 0
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SELECT
|
||||
FD_ZERO (&input_fds);
|
||||
|
Loading…
Reference in New Issue
Block a user