mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
Merge branch 'feature/freertos_runtime_counter_support' into 'master'
feat(freertos): Runtime Counter support Closes IDFGH-12057 See merge request espressif/esp-idf!30150
This commit is contained in:
commit
40684a0e1c
@ -239,11 +239,11 @@ extern void vTaskExitCritical( void );
|
||||
// ------------------- 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
|
||||
/* Coarse resolution time (us) */
|
||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
|
||||
#endif
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#else
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
|
@ -227,11 +227,11 @@ extern void vTaskExitCriticalFromISR( UBaseType_t uxSavedInterruptStatus );
|
||||
|
||||
//Timers are already configured, so nothing to do for configuration of run time stats timer
|
||||
#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
|
||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) ({x = (uint32_t)esp_timer_get_time();})
|
||||
#endif
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#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 -----------------------
|
||||
|
||||
|
@ -594,11 +594,11 @@ void vPortTCBPreDeleteHook( void *pxTCB );
|
||||
// ------------------- 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
|
||||
/* Coarse resolution time (us) */
|
||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
|
||||
#endif
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#else
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() 0
|
||||
#endif // CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
|
||||
|
||||
// --------------------- TCB Cleanup -----------------------
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
* 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
|
||||
* 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()
|
||||
|
||||
/**
|
||||
* - 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
|
||||
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
|
||||
#endif
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() ((configRUN_TIME_COUNTER_TYPE) esp_timer_get_time())
|
||||
#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 -----------------------
|
||||
|
||||
|
@ -408,7 +408,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
|
||||
#if CONFIG_FREERTOS_SMP
|
||||
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 );
|
||||
|
||||
/* If the task is not pinned to a particular core, treat it as tskNO_AFFINITY */
|
||||
@ -487,7 +487,7 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
|
||||
|
||||
configRUN_TIME_COUNTER_TYPE ulTaskGetIdleRunTimeCounterForCore( BaseType_t xCoreID )
|
||||
{
|
||||
uint32_t ulRunTimeCounter;
|
||||
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter;
|
||||
|
||||
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
|
||||
|
||||
@ -514,7 +514,11 @@ BaseType_t xTaskGetCoreID( TaskHandle_t xTask )
|
||||
|
||||
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
|
||||
|
||||
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE
|
||||
portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalTime );
|
||||
#else
|
||||
ulTotalTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
#endif
|
||||
|
||||
/* For percentage calculations. */
|
||||
ulTotalTime /= ( configRUN_TIME_COUNTER_TYPE ) 100;
|
||||
@ -836,11 +840,11 @@ uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
|
||||
/**
|
||||
* @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
|
||||
* - 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 )
|
||||
{
|
||||
@ -1000,7 +1004,7 @@ int xTaskGetNext( TaskIterator_t * xIterator )
|
||||
if( !portVALID_LIST_MEM( pxNextListItem ) )
|
||||
{
|
||||
/* 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;
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user