計算機性能(Computer performance)這個詞的意思是“計算機在做它應該做的工作方面做得有多好。”它基本上取決於計算機系統的響應時間、吞吐量和執行時間。
響應時間(Response time)是從任務開始到完成的時間。這還包括:
- 操作系統開銷
- 等待I/O和其他進程
- 訪問磁盤和內存
- 在CPU上執行所花費的時間或執行時間
吞吐量(Throughput)是在給定時間內完成的工作總量。
CPU執行時間(CPU execution time)是CPU在給定任務上花費的總時間。它還不包括用於I/O或運行其他程序的時間。這也簡稱為CPU時間。
性能取決於執行時間,因為性能與執行時間成反比。
<code>Performance
= (1
/ Execution time) /<code>
<code>(Performance of A / Performance of B) = (Execution Time of B / Execution Time of A) /<code>
如果給定處理器A比處理器B快,則意味著A的執行時間小於B的執行時間,因此,A的性能大於B的性能。
例如:
機器A在100秒內運行一個程序,機器B在125秒內運行同一程序
<code>(Performance
of
A
/
Performance
of
B)
=
(Execution
Time
of
B
/
Execution
Time
of
A)
=
125
/
100
=
1.25
/<code>
這意味著機器A比機器B快1.25倍。
執行給定程序的時間可以計算為:
<code>Executiontime
= CPUclock
cycles xclock
cycletime
/<code>
由於時鐘週期時間和時鐘速率是倒數,因此,
<code>Executiontime
= CPUclock
cycles /clock
rate /<code>
CPU時鐘週期數可以通過以下方式確定:
<code>CPUclock
cycles = (No. of instructions / Program ) x (Clock cycles / Instruction) = Instruction Count x CPI /<code>
<code>Executiontime
= Instruction Count x CPI xclock
cycletime
= Instruction Count x CPI /clock
rate /<code>
CPU執行時間的單位為:
如何提高性能?
要提高性能,您可以:
1)使用新的硬件降低CPI(每條指令的時鐘週期)。
2)通過減少傳播延遲或使用流水線來減少時鐘時間或增加時鐘速率。
3)減少所需的週期數或改進ISA或編譯器。