This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294中,怎么计算一段程序的运行时间?



我的一个1294的程序中,主程序如下:

int
main(void)
{
//SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//************PWM Period Init**********************************//
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_2);//B通道连接引脚
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_2 , ~GPIO_PIN_2);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_4);//B通道连接引脚
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_4 , GPIO_PIN_4);

CONFIG_UART();

CONFIG_PWM();

while(1)
{
//*************************************************
PWM_Para_Set(Frequency_pwm,PWM_Duty);
//********************************************
}
}

我该怎么计算while循环里面执行一次所需要的时间?