mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/freertos_runtime_counter_support_v5.2' into 'release/v5.2'
feat(freertos): Runtime Counter support (v5.2) See merge request espressif/esp-idf!31135
This commit is contained in:
commit
52df721bb1
@ -220,11 +220,11 @@ extern void vTaskExitCritical( void );
|
|||||||
// ------------------- Run Time Stats ----------------------
|
// ------------------- Run Time Stats ----------------------
|
||||||
|
|
||||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
|
||||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
/* Coarse resolution time (us) */
|
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
|
#else
|
||||||
#endif
|
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||||
|
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
|
|
||||||
// --------------------- TCB Cleanup -----------------------
|
// --------------------- TCB Cleanup -----------------------
|
||||||
|
|
||||||
|
@ -226,11 +226,11 @@ extern void vTaskExitCritical( void );
|
|||||||
|
|
||||||
//Timers are already configured, so nothing to do for configuration of run time stats timer
|
//Timers are already configured, so nothing to do for configuration of run time stats timer
|
||||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||||
//We define get run time counter value regardless because the rest of ESP-IDF uses it
|
|
||||||
#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount()
|
|
||||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) ({x = (uint32_t)esp_timer_get_time();})
|
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||||
#endif
|
#else // Uses CCOUNT
|
||||||
|
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) xthal_get_ccount())
|
||||||
|
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
|
|
||||||
// --------------------- TCB Cleanup -----------------------
|
// --------------------- TCB Cleanup -----------------------
|
||||||
|
|
||||||
|
@ -586,11 +586,11 @@ void vPortTCBPreDeleteHook( void *pxTCB );
|
|||||||
// ------------------- Run Time Stats ----------------------
|
// ------------------- Run Time Stats ----------------------
|
||||||
|
|
||||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
|
||||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
/* Coarse resolution time (us) */
|
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
|
#else
|
||||||
#endif
|
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||||
|
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
|
|
||||||
// --------------------- TCB Cleanup -----------------------
|
// --------------------- TCB Cleanup -----------------------
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
@ -513,15 +513,11 @@ extern void _frxt_setup_switch( void ); //Defined in portasm.S
|
|||||||
|
|
||||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||||
|
|
||||||
/**
|
|
||||||
* - Fine resolution uses ccount
|
|
||||||
* - ALT is coarse and uses esp_timer
|
|
||||||
* @note [refactor-todo] Make fine and alt timers mutually exclusive
|
|
||||||
*/
|
|
||||||
#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount()
|
|
||||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
|
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||||
#endif
|
#else // Uses CCOUNT
|
||||||
|
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) xthal_get_ccount())
|
||||||
|
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||||
|
|
||||||
// --------------------- TCB Cleanup -----------------------
|
// --------------------- TCB Cleanup -----------------------
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
|
|||||||
#if CONFIG_FREERTOS_SMP
|
#if CONFIG_FREERTOS_SMP
|
||||||
UBaseType_t uxCoreAffinityMask;
|
UBaseType_t uxCoreAffinityMask;
|
||||||
|
|
||||||
/* Get the core affinity mask and covert it to an ID */
|
/* Get the core affinity mask and convert it to an ID */
|
||||||
uxCoreAffinityMask = vTaskCoreAffinityGet( xTask );
|
uxCoreAffinityMask = vTaskCoreAffinityGet( xTask );
|
||||||
|
|
||||||
/* If the task is not pinned to a particular core, treat it as tskNO_AFFINITY */
|
/* If the task is not pinned to a particular core, treat it as tskNO_AFFINITY */
|
||||||
@ -503,7 +503,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
|
|||||||
|
|
||||||
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimeCounterForCore( BaseType_t xCoreID )
|
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimeCounterForCore( BaseType_t xCoreID )
|
||||||
{
|
{
|
||||||
uint32_t ulRunTimeCounter;
|
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter;
|
||||||
|
|
||||||
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
|
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
|
||||||
|
|
||||||
@ -530,7 +530,11 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
|
|||||||
|
|
||||||
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
|
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
|
||||||
|
|
||||||
|
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
|
||||||
|
portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalTime );
|
||||||
|
#else
|
||||||
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
|
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For percentage calculations. */
|
/* For percentage calculations. */
|
||||||
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100;
|
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100;
|
||||||
@ -848,11 +852,11 @@ uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
|
|||||||
/**
|
/**
|
||||||
* @brief Get reentrancy structure of the current task
|
* @brief Get reentrancy structure of the current task
|
||||||
*
|
*
|
||||||
* - This funciton is required by newlib (when __DYNAMIC_REENT__ is enabled)
|
* - This function is required by newlib (when __DYNAMIC_REENT__ is enabled)
|
||||||
* - It will return a pointer to the current task's reent struct
|
* - It will return a pointer to the current task's reent struct
|
||||||
* - If FreeRTOS is not running, it will return the global reent struct
|
* - If FreeRTOS is not running, it will return the global reent struct
|
||||||
*
|
*
|
||||||
* @return Pointer to a the (current taks's)/(globa) reent struct
|
* @return Pointer to a the (current taks's)/(global) reent struct
|
||||||
*/
|
*/
|
||||||
struct _reent * __getreent( void )
|
struct _reent * __getreent( void )
|
||||||
{
|
{
|
||||||
@ -1019,7 +1023,7 @@ int xTaskGetNext( TaskIterator_t * xIterator )
|
|||||||
if( !portVALID_LIST_MEM( pxNextListItem ) )
|
if( !portVALID_LIST_MEM( pxNextListItem ) )
|
||||||
{
|
{
|
||||||
/* Nothing to do with the corrupted list item. We will skip to the next task state list.
|
/* Nothing to do with the corrupted list item. We will skip to the next task state list.
|
||||||
* pxNextListItem should be NULL at the beggining of each task list.
|
* pxNextListItem should be NULL at the beginning of each task list.
|
||||||
*/
|
*/
|
||||||
pxNextListItem = NULL;
|
pxNextListItem = NULL;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user