Ch3_CPU_Performance

本文深入探讨了CPU执行时间、时钟周期、CPI、MIPS等关键性能指标的计算方法,以及Amdahl’s定律和SPECratio公式在性能评估中的应用。同时,介绍了算术平均、加权算术平均和几何平均在衡量程序执行效率上的优缺点。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • CPU Exec Time 公式 (越越好)

    • Clock Cycle 公式
    • CPI 公式
    • 軟體如何影響效能
  • MIPS 公式 (越越好)

    • MIPS的三個問題
      • 沒有把每一指令的能力考慮進來
      • 同一台電腦不同程式,MIPS有可能不同
      • 可能跟效能成反比
  • Amdahl’s 定律

    • Speedup公式
    • 改善較常出現部分的最佳化較有效
  • 效能總評

    • 算術平均 (Arithmetic Mean , AM)
      • 每個程式執行次數相同
    • 加權算術平均 (Weighted Arithmetic Mean , WAM)
      • 執行次數不同,給加權值(頻率)
    • SPECratio 公式 (越越好)
      • 作正規化(用算術平均數作為效能總評可能會產生矛盾,改用幾何平均)
    • 幾何平均 (Geometric Mean , GM)
      • 先取幾何平均在做正規化 = 先做正規化再取幾何平均
      • 優 : 與程式執行時間 & 用哪一台機器為正規化基準 無關
      • 缺 : 違背效能測量基本原則 -> 無法測時間
  • 效能評估程式

    • 工作量(Workload) : always running program (簡單比較)
    • 效能評估程式(Benchmark) : (主要比較)
      • SPEC(System Performace Evaluation Coporation)
        -> 最新 : SPEC CPU2000[12整數(CINT2000) & 14浮點數(CFP2000)]
### STM32 ADC Channel 17 Configuration In the context of configuring an Analog-to-Digital Converter (ADC) on a specific channel such as channel 17 within STM32 microcontrollers, it is important to understand that not all channels are available across different series or packages of STM32 devices. For instance, some pins may only be present in certain package types and might serve multiple functions depending upon the device variant. For configuring ADC channel 17 specifically: - Ensure this channel corresponds to a valid pin for your particular STM32 model. - Initialize the system clock settings appropriately since these affect how fast the ADC can operate `hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;`[^1]. The initialization process involves setting up various parameters including resolution, data alignment, external trigger conversion source among others before enabling continuous mode if required. Here's a simplified example demonstrating part of what needs to happen during setup using HAL library provided by STMicroelectronics: ```c // Assuming ADC1 is being used here static void MX_ADC1_Init(void) { ADC_ChannelConfTypeDef sConfig = {0}; /** Configure the global features of the ADC (Clock prescaler) */ hadc1.Instance = ADC1; hadc1.Init.ScanConvMode = DISABLE; // Single-channel conversion hadc1.Init.ContinuousConvMode = ENABLE; // Continuous conversions enabled hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.NbrOfConversion = 1; if (HAL_ADC_Init(&hadc1) != HAL_OK) { Error_Handler(); } /** Configure for the selected ADC regular channel */ sConfig.Channel = ADC_CHANNEL_17; // Configuring channel 17 sConfig.Rank = 1; sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } } ``` When dealing with high-speed sampling scenarios where real-time performance matters significantly, implementing DMA transfers alongside software triggers could enhance efficiency while ensuring timely updates without CPU intervention after initial configuration has been completed[^3]. Furthermore, when connecting sensors directly to ADC inputs especially those having low output impedance like thermistors or photodiodes, consider adding buffer amplifiers between sensor outputs and ADC input lines due to potentially significant loading effects caused by relatively lower internal resistance at ADC ports which can distort readings taken from connected peripherals[^4].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值