In the CPU time equation (Tcpu) what are the number of instructions (IC) and cycles per instruction (CPI)?

From a slide About Computer Organization:

Instruction Performance

A given program will require:

  • a number of machine instructions
  • a certain number of cycles
  • a certain number of seconds

Like this:

Tcpu = IC * CPI * Tempodocyclodeclock

IC = number of machine instructions ( instruction count )

CPI (cycles per instruction)

I didn't quite understand this slide.

The IC is the number of machine instructions involved for example in a sum or multiplication operation (it is last more complex than the sum). Would it be the number of most basic statements that make up an addition statement?

Is the CPI a fixed value, or does it vary per statement? Or is it an average?

Still, not required but if you can add, how does it all affect performance in the execution of instructions?

Taken from here , also here . And this one can also help.

Author: Maniero, 2020-05-24

1 answers

The cycle is the basic unit of execution, it is the minimum execution step that occurs and the time between one and the other is defined by the computer's Clock mechanism, so a 4GHz computer runs about 4 billion cycles in a second. I time between each is obviously the second divided by the number of cycles per second.

The instruction is an operation that performs something that makes sense to the computer and to a human. It is something that commands the computer to manipulate data in a certain way. It can be an arithmetic, relational calculation, a movement of data in registers and memory, or something like that. It does minimal complete operation.

What I understood to be the IC in this context is the total statements of a given code, so I would be teaching to calculate a theoretical run time.

There are architectures that all instructions run with the same amount of cycles and others where each instruction has its own cost, even the same statement may vary in each execution. In cases where the cost varies this measure can be an average, just do not know average of that since it depends on context of where it is measuring.

I imagine that this average in this context is calculated by adding the amount of cycles of each of the code instructions being observed by dividing by the number of instructions. But part of the equation is to multiply by the number of instructions, so you shouldn't use the mean, you should just use the summation of cycles. Wikipedia has a formula to better understand .

If not, I don't know what this equation is for.

Even using the Wikipedia formula may not work out in architectures that the actual execution going on will determine how many cycles it will consume in a given statement. And depending on the context it can be worse, for a number of optimizations that can occur. Theory is useful, but it has cases that it does not have a relationship to practice.

I do a lot of optimization and never needed to do this calculation :) I needed others that I might see in these classes. It may be that at a lower level I need the formula (from Wikipedia).

 3
Author: Maniero, 2020-05-25 14:24:35