# 計組 L1 ## CPU Time:處理器花在某項工作上的時間,不包含等待I/O的時間 - 分為**User CPU Time / System CPU Time** - 本章專注處理器效能,以User CPU Time來做execution time 的量測 - 絕對時間(ex.幾秒)在量測CPU Time上很難做到... → 所以用**clock(時脈)當作協調硬體動作同步信號** | clock rate: Hz | cycle time(clock period): S(Second) | | -------- | -------- | | K=10^3 | m=10^-3 | | M=10^6 | u=10^-6 | | G=10^9 | n=10^-9 | | T=10^12 | p=10^-12 | :::info ## CPU時間 = clock cycles數目 * clock cycle time週期時間               (= 1/clock rate 時脈頻率) ::: :::warning ### 1. :warning:一個程式使用的clock cycles可定義為: #### Instruction count執行指令數目 * CPI (Cycles Per Instruction) 每個指令所需cycle數目 --- ### 2. 執行不同指令之CPI亦不同,故clock cycles可以 = IC*CPI乘積加總 ![](https://i.imgur.com/LrDvFDy.png =50%x50%) --- ### 3. 故,平均CPI = clock cycles週期總數/Instruction Count指令總數 ![](https://i.imgur.com/7uQmJHc.png =60%x660%) ::: --- :::info ### 謬誤: 使用 MIPS(Millions of Instructions Per Second) 做時間估算 ![](https://i.imgur.com/KFJwLDN.png =50%x50%) - 通常MIPS越大,代表電腦較快。 - <font color="red">但有以下兩個問題:</font> -MIPS表示指令的執行率,**但並沒有把每一指令的能力考慮進來** -**即使在同一台電腦上的不同程式,MIPS亦可能不同** ::: --- ## Amdahl’s Law ![](https://i.imgur.com/7328stk.png =50%x50%) ![](https://i.imgur.com/vRpZ3Dh.png =60%x60%) - Principle: make the common case fast --- ##### tags: `計組` `CO` `L1`