DIMENSION Record (500)
!Control parameters:
Num_Computes=500 !Repeat count for computation
Num_Reads=35 !Number of records read
Num_Writes=40 !Number of records written
Num_Iterations=1000 !Repeat count for the experiment
!Open files:
OPEN(UNIT=1,NAME=In.dat,TYPE=Old,
1FORM=Unformatted,ACCESS=Direct)
OPEN(UNIT=2,NAME=Out.dat.TYPE=New,
1FORM=unformatted,ACCESS=Direct)
CALL Get_Time(CPU1.Elapsed1) !Record starting time
DO 500 Iteration=1,Num_Iterations
!Perform a number of read I/Os
DO 100 i-1,Num_Reads
READ(11),Record
100 CONTINUE
!Do computation
DO 200 j=1,Num_Computes
DO 200 i-1,500
200 Record(i)=1 + i + i*i + i*i*i
!Perform a number of write I/Os
DO 300 i=1,Num_Writes
WRITE(2i).Record
300 CONTINUE
500 CONTINUE
CALL Get_Time(CPU2,Elapsed2) !Get ending time
!Close files:
CLOSE(UNIT=1)
CLOSE(UNIT=2)
CPU_Time=(CPU2-CPU1)/Num_Iterations
Elapsed_Time=(Elapsed2-Elapsed1)/Num_Iterations
TYPE *,CPU time per iteration is ,CPU_Time
TYPE *.Elasped time per iteration is .Elapsed_Time
STOP
END
|
FIGURE 4.1 Synthetic workload generation program.
The disadvantages of exercisers are that they are generally too small and do not make representative memory or disk references. The mechanisms of page faults and disk cache may not be adequately exercised. The CPU-I/O overlap may not be representative. In particular, exercisers are not suitable for multiuser environments since the loops may create synchronizations, which may result in better or worse performance.
4.5 APPLICATION BENCHMARKS
If the computer systems to be compared are to be used for a particular application, such as banking or airline reservations, a representative subset of functions for that application may be used. Such benchmarks are generally described in terms of functions to be performed and make use of almost all resources in the system, including processors, I/O devices, networks, and databases.
An example of the application benchmark is the debit-credit benchmark described in Section 4.6.7.
4.6 POPULAR BENCHMARKS
In trade presses, the term benchmark is almost always used synonymously with workload. Kernels, synthetic programs, and application-level workloads, for example, are all called benchmarks. Although the instruction mixes are a type of workload, they have not been called benchmarks. Some authors have attempted to restrict the term benchmark to refer only to the set of programs taken from real workloads. This distinction, however, has mostly been ignored in the literature. Thus, the process of performance comparison for two or more systems by measurements is called benchmarking, and the workloads used in the measurements are called benchmarks. Some of the well-known benchmarks are described next.
4.6.1 Sieve
The sieve kernel has been used to compare microprocessors, personal computers, and high-level languages. It is based on Eratosthenes sieve algorithm and is used to find all prime numbers below a given number n. The algorithm, in its manual form, consists of first writing down all integers from 1 to n and then striking out all multiples of k for k = 2,3,..., √n. For example, to find all prime numbers from 1 to 20, the steps are as follows:
- 1. Write down all numbers from 1 to 20. Mark all as prime:
- 2. Remove all multiples of 2 from the list of primes:
- 3. The next integer in the sequence is 3. Remove all multiples of 3:
|
|
| 4
|
| 6
|
| 8
| 9
| 10
|
| 12
|
| 14
| 15
| 16
|
| 18
|
| 20
|
- 4. The next integer in the sequence is 5, which is greater than the square root of 20. Hence, the remaining sequence consists of the desired prime numbers.
A Pascal program to implement the sieve kernel is given in Figure 4.2.
PROGRAM Prime (OUTPUT);
CONST
MaxNum = 8191; (* Lists all primes up to MaxNum *)
NumIterations = 10; (* Repeats procedure Numlterations times *)
VAR
IsPrime : ARRAY [1..MaxNum] OF BOOLEAN;
i,k,Iteration : INTEGER; (* Loop indexes *)
NumPrimes : INTEGER: (* Number of primes found *)
BEGIN
WRITELN(Using Eratosthenes Sieve to find primes up to , MaxNum);
WRITELN(Repeating it ,NumIterations, times.);
FOR Iteration := 1 TO NumIterations DO
BEGIN (* Initialize all numbers to be prime *)
FOR i := 1 TO MaxNum DO
IsPrime[i] := TRUE;
i := 2;
WHILE i*i <= MaxNum DO
BEGIN
IF IsPrime[i] THEN
BEGIN (* Mark all multiples of i to be nonprime *)
k := i + i;
WHILE k <= MaxNum DO
BEGIN
IsPrime[k] := FALSE;
k := k + i;
END; (* of WHILE k *)
END; (* of If IsPrims *)
i :+ i + 1;
END; (* of WHILE i*i *)
NumPrimes := 0;
FOR i := 1 TO MaxNum DO (* Count the number of primes *)
IF IsPrims[i] THEN NumPrimes := NumPrimes + 1;
WRITELN(NumPrimes. primes);
END; (* of FOR Iterations *)
(* The following can be added during debugging to list primes. *)
(* FOR i := 1 TO MaxNum DO IF IsPrime[i] THEN WRITELN (i); *)
END.
|
FIGURE 4.2 Pascal program to implement sieve workload.