Computer Organization and Architecture: Chapter 1: Introduction

Performance Metrics of Computer: Example Problems

Measuring Performance: CPU Time, Performance Metrics, Basic performance equation


Example : 1

If computer A runs a program in 10 seconds and computer B runs the same program in 15 seconds, how much faster is A than B ?

Solution:

We know that A is n times faster than B if

PerformanceA / PerformanceB = Execution timeB / Execution timeA = n

Thus the performance ratio is

15/10 = 1.5

and A is therefore 1.5 times faster than B.

• In the above example, we could also say that computer B is 1.5 times slower than computer A, since

Performance A / PerformanceB = 1.5

means that

PerformanceA / 15 = PerformanceB

• For simplicity, we will normally use the terminology faster than when we try to compare computers quantitatively. Because performance and execution time are reciprocals, increasing performance requires decreasing execution time. To avoid the potential confusion between the terms increasing and decreasing, we usually say "improve performance" or "improve execution time" when we mean "increase performance" and "decrease execution time".

Example : 2

Computer A runs a program in 12 seconds with a 3 GHz clock. We have to design a computer B such that it can run the same program with in 9 seconds. Determine the clock rate for computer B. Assume that due to increase in clock rate, CPU design of computer B is affected and it requires 1.2 times as many clock cycles as computer A for execution this program.

Solution:

Given: Clock rateA = 3 x 109 cycles/sec

CPU time A = 12 seconds

 CPU timeB = 9 seconds

We have,

CPU timeA = CPU clcok cyclesA / Clock rateA

12 seconds = CPU clock cyclesA / (3 x 109 cycles/sec)

CPU clock cyclesA = 12 seconds × 3 × 109 cycle / sec = 36 x 109 cycles

The CPU time for computer B can be given as

CPU timeB = CPU clcok cyclesB / Clock rateB = [ 1.2× CPU clock cyclesA ] / [ Clock rateA ]

9 seconds = [ 1.2 × 36 × 109 cycles ] / [ Clock rateB ]

Clock rateB = [ 1.2 × 36 × 109 cycles ] / [ 9 seconds ] = 4.8 cycles/sec = 4.8 GHz

Example : 3

A program runs in 10 seconds on computer A, which has a 2 GHz clock. Try to help a computer designer build a computer, B, which will run this program in 6 seconds. The designer has determined that a substantial increase in the clock rate is possible, but this increase will affect the rest of the CPU design, causing computer B to require 1.2 times as many clock cycles as computer A for this program. What clock rate should we tell the designer to target?

Solution: Given: Clock rateA = 2 × 109 cycles/sec

CPU timeA = 10 seconds

CPU timeB = 6 seconds

We have,

CPU timeA = CPU clock cyclesA / Clock rateA

10 seconds = CPU clock cyclesA / [2× 109 (cycles/second)]

CPU clock cyclesA = 10 seconds × [2× 109 (cycles/second)] = 20 x 109 cycles

CPU time for B can be found using this equation:

CPU timeB = [1.2 × CPU clock cyclesA ] / Clock rateB

6 seconds = [1.2 × 20 × 109 cyclesA] / Clock raеB

Clock rateB = [ 1.2 × 20 × 109 cycles] / 6 seconds = [ 0.2 × 20 × 109 cycles] / seconds

= [4 × 109 cycles] / seconds = 4 GHz


To run the program in 6 seconds, B must have twice the clock rate of A.

Basic performance equation

The basic performance equation is given by

T = [N× CPI ] / R = (N× CPI) / Clock rate = N × CPI × Clock cycle time

where CPI: The average number of clock cycles each instruction takes to execute.

It is given by

CPI = CPU clock cycles / Instruction count

N: Number of instructions.

R: Clock rate measured in clocks / seconds.

Example: 4

Let us assume that two computers use same instruction set architecture. Computer A has a clock cycle time of 250 ps and a CPI of 2.0 for same program and computer B has a clock cycle time of 500 ps and a CPI of 1.2 for the same program. Which computer is faster for this program and by how much?

Solution: We know that each computer executes the same number of instructions for the program; let's call this number N. First, find the number of processor clock cycles for each computer:

CPU clock cyclesA = N×20

CPU clock cyclesB = N× 1.2

The CPU time for each machine will be

CPU timeA = CPU clock cyclesA × Clock cycle timeA

= N× 2.0 × 250 ps = 500 N ps

CPU timeB = CPU clock cyclesB × Clock cycle timeB

= N × 1.2 × 500 ps = 600 N ps

Thus we can say that computer A is faster. The amount faster is given by the ratio of the execution times.

CPU PerformaceA / CPU PerformanceB = Execution timesB / Execution timeA =

600 N ps / 500 N ps =1.2

We can conclude that computer A is 1.2 times faster than computer B for this program.

Example: 5

Table 1.11.1 (a) shows the two code sequences with number of instructions of different instruction classes within each code sequence, respectively. The instructions are classified as A, B and C according to the CPI as shown in Table 1.11.1 (b). From the given information:

i) Determine which code sequence executes the most instructions.

ii) Determine which code sequence will execute quickly,

iii) Determine the CPI for each code sequence.


Solution:

 i) Code sequence 1 executes : 4+2 + 4 = 10 instructions.

Code sequence 2 executes : 8+2+2 = 12 instruction.

Therefore, code sequence 2 executes more instructions.

ii) CPU clock cycles required to execute these code sequences is given as

CPU clock cycles 1 = (4 × 1) + (2 × 2) + (4 × 3) = 20 cycles

CPU clock cycles 2 = (8 × 1) + (2 × 2) + (2 × 3) = 18 cycles

Thus, we can say that code sequence 2 is faster than code sequence 1, even though it executes two extra instructions.

iii) We know that

CPI = CPU clock cycles / Instruction count

CPI1 = 20 / 10 and CPI2 = 18 / 12 = 1.5

• The above example shows that we can not rely on one factor to access performance. While comparing two computers we must look at all the components of performance listed in Table 1.11.2.

• If some of the factors are identical, performance should be determined by comparing all the nonidentical factors. Since CPI varies by instruction mix (A measure of the dynamic frequency of instructions across one or many programs), both CPI and instruction count must be compared, even if clock rates are identical.

• The performance of a program also depends on the algorithm, the language, the compiler, the architecture and the actual hardware.

 • Table 1.11.2 gives the information of how these components affect the factors in the CPU performance equation.


Example: 6

Consider three different processors P1, P2 and P3 executing the same instruction set. Pl has a 3 GHz clock rate and a CPI of 1.5. P2 has a 2.5 GHz clock rate and a CPI of 1.0. P3 has a 4.0 GHz clock rate and has a CPI of 2.2.

a) Which processor has the highest performance expressed in instructions per second?

b) If the processors each execute a program in 10 seconds, find the number of cycles and the number of instructions in each processor.

Solution:

a) P2 has the highest performance.

Performance of P1 (instructions/sec) = (3 x 109) / 1.5 = 2 × 109

Performance of P2 (instructions/sec) = (2.5 x 109) / 1.0 = 2.5 × 109

Performance of P3 (instructions/sec) = (4 × 109) / 2.2 = 1.82 x 109b)

 Number of cycles = Time × Clock rate

Cycles (P1) = 10 × 3 × 109 = 30 × 109

Cycles (P2) = 10 × 2.5 × 109 = 25 × 109

Cycles (P3) = 10 × 4.0 × 109 = 40 × 109

Time = (Number of instructions × CPI) / Clock rate

Number of instructions = (Time × Clock rate) / CPI = Number of cycles / CPI

No. of Instructions (P1) = 30×109 /1.5 = 20x 109

No. of Instructions (P2) = 25×109 / 1.0 = 25 × 109

No. of Instructions (P3) = 40×109 / 2.2 = 18.18 × 109

Example: 7

Consider two different implementations of the same instruction set architecture. The instructions can be divided into four classes according to their CPI (class A, B, C and D). P1 with a clock rate of 2.5 GHz and CPIs of 1, 2, 3 and 3 respectively and P2 with a clock rate of 3 GHz and CPIs of 2, 2, 2 and 2 respectively. Given a program with a dynamic instruction count of 1.0 × 106 instructions divided into classes as follows: 10% class A, 20% class B, 50 % class C and 20 % class D, which implementation is faster? What is the global CPI for each implementation? Find the What is the clock cycles required in both cases

Solution:

a) Class A: 105 instruction,

Class B: 2 × 105 instruction,

Class C: 5 × 105 instruction,

Class D: 2 × 105 instruction.

Time = No. instruction × CPI / clock rate

Total time P1 = (105 + 2×105×2 + 5×105 × 3 + 2×105×3) / (2.5 × 109) = 10.4 × 10 ‒ 4 S

Total time P2 = (105×2+ 2×105 × 2 + 5×105 × 2+2×105 × 2) / (3 × 109)

      = 6.66 × 10‒ 4 S

CPI (P1) = 10.4× 10‒ 4 × 2.5 × 109 /106 = 2.6.

CPI (P2) = 6.66 × 10‒ 4 × 3 × 109 /106 = 2.0

P2 implementation is faster.

b)

Clock cycles (P1) =105 × 1 + 2 × 105 × 2+5 × 105 × 3+2 × 105 × 3 = 26 × 105

Clock cycles (P2) =105 × 2+2 ×105 ×2+5× 105 ×2 + 2 × 105 ×2+2 × 105 × 2

        = 20 × 105


Computer Organization and Architecture: Chapter 1: Introduction : Tag: Computer : - Performance Metrics of Computer: Example Problems


Computer Organization and Architecture: Chapter 1: Introduction



Under Subject


Computer Organization and Architecture

CW25201 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation



Related Subjects


Discrete Mathematics

MA25C14 3rd Semester CSE,IT,CY,AIDS departments. | 2025 Regulation | 3rd Semester 2025 Regulation


Data Structures

CS25C08 3rd Semester CSE,IT,CY,AIDS departments. | 2025 Regulation | 3rd Semester 2025 Regulation


Computer Organization and Architecture

CW25201 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation


Object Oriented Programming

CS25C07 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation


Web Technologies

IT25301 3rd Semester IT department. | 2025 Regulation | 3rd Semester 2025 Regulation


English Communication Skills Laboratory I

EN25C03 3rd Semester all department. | 2025 Regulation | 3rd Semester 2025 Regulation


Skill Development Course I

3rd Semester all department. | 2025 Regulation | 3rd Semester 2025 Regulation