1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 20:10:08 +03:00

Tasks switching log added (use -DDEBUG_TASKS=YES to enable and CLI command "print tsl" to see it, only works on Horus)

This commit is contained in:
Damjan Adamic 2016-03-28 12:48:25 +02:00
parent 9673df83a7
commit a8aa6148e5
7 changed files with 122 additions and 1 deletions

View file

@ -139,3 +139,29 @@ void dumpTraceBuffer()
struct InterruptCounters interruptCounters;
#endif //#if defined(DEBUG_INTERRUPTS)
#if defined(DEBUG_TASKS)
uint32_t taskSwitchLog[DEBUG_TASKS_LOG_SIZE] __SDRAM;
uint16_t taskSwitchLogPos;
/**
*******************************************************************************
* @brief Hook for task switch logging
* @param[in] taskID Task which is now in RUNNING state
* @retval None
*
* @par Description
* @details This function logs the time when a task entered the RUNNING state.
*******************************************************************************
*/
void CoTaskSwitchHook(uint8_t taskID)
{
/* Log task switch here */
taskSwitchLog[taskSwitchLogPos] = (taskID << 24) + ((uint32_t)CoGetOSTime() & 0xFFFFFF);
if(++taskSwitchLogPos >= DEBUG_TASKS_LOG_SIZE) {
taskSwitchLogPos = 0;
}
}
#endif // #if defined(DEBUG_TASKS)