1-3 Performance
计算机性能的度量
- 响应时间:从输⼊到相应输出所⽤的时钟周期数—执⾏时间 (越短越好)
-
吞吐率:每个时钟周期完成多少结果 (越大越好)
-
执行时间(响应时间):一般我们考虑cpu的执行时间,又分为
- 系统CPU时间:为执⾏程序⽽花费在操作系统上的时间
- 用户CPU时间:在程序本身所花费的 CPU 时间
我们关注的是用户CPU时间
$性能={1\over 响应时间}$
执⾏时间是唯⼀有效的计算机性能度量⽅法。
CPU时间
-
CC:时钟周期(Clock period): duration of a clock cycle
-
CR:时钟频率(Clock frequency (rate)): cycles per second
CC=${1\over CR}$
1s=10^3 ms=10^6 us=10^9 ns=10^12 ps
如何改善性能
$程序执行时间=执行程序所需周期数 \times 时钟周期$
CPU 性能取决于三个特性:
- clock cycle (or rate) 时钟周期或时钟频率
- clock cycles per instruction (CPI) 每条指令所需周期数
- instruction count. 指令数
经典的CPU性能公式
$CPU时钟周期数=程序指令数 \times CPI$
$CPU时间=CPU时钟周期数 \times 时钟周期=程序指令数 \times CPI \times 时钟周期 = {程序指令数 \times CPI\over 时钟频率}$
- 指令数(instruction count) : 执⾏某程序所需要的总指令数量
- CPI( clock cycle per instruction) : 即每条指令的时钟周期数, 表示执⾏某个应⽤程序或者程序⽚段时每条指令所需要的时钟周期平均数 。
阿姆达尔定律 :优化大概率事件


The Power Wall
$功耗 = 负载电容 \times $电压2$ \times 开关频率$