1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Enable task run time monitoring in osx simulation

This commit is contained in:
James Cotton 2012-03-11 20:49:54 -05:00
parent 0e815540ff
commit dee17f8fd4
4 changed files with 40 additions and 3 deletions

View File

@ -125,10 +125,10 @@ void TaskMonitorUpdateAll(void)
data.StackRemaining[n] = 10000;
#else
data.StackRemaining[n] = uxTaskGetStackHighWaterMark(handles[n]) * 4;
#endif
#if ( configGENERATE_RUN_TIME_STATS == 1 )
/* Generate run time stats */
data.RunningTime[n] = uxTaskGetRunTime(handles[n]) / deltaTime;
#endif
#endif
}

View File

@ -88,9 +88,14 @@ to exclude the API function. */
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_uxTaskGetStackHighWaterMark 0
/* Enable run time stats collection */
#define configGENERATE_RUN_TIME_STATS 1
#define INCLUDE_uxTaskGetRunTime 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
#define portGET_RUN_TIME_COUNTER_VALUE() clock()
#error Here
/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */
#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */

View File

@ -1044,6 +1044,19 @@ void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
*/
void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION;
/**
* task.h
* <PRE>unsigned portBASE_TYPE uxTaskGetRunTime( xTaskHandle xTask );</PRE>
*
* Returns the run time of selected task
*
* @param xTask Handle of the task associated with the stack to be checked.
* Set xTask to NULL to check the stack of the calling task.
*
* @return The run time of selected task
*/
unsigned portBASE_TYPE uxTaskGetRunTime( xTaskHandle xTask );
/**
* task. h
* <PRE>void vTaskStartTrace( char * pcBuffer, unsigned portBASE_TYPE uxBufferSize );</PRE>

View File

@ -1312,6 +1312,24 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
xTaskResumeAll();
}
/*-----------------------------------------------------------*/
#if ( INCLUDE_uxTaskGetRunTime == 1 )
unsigned portBASE_TYPE uxTaskGetRunTime( xTaskHandle xTask )
{
unsigned long runTime;
tskTCB *pxTCB;
pxTCB = prvGetTCBFromHandle( xTask );
runTime = pxTCB->ulRunTimeCounter;
pxTCB->ulRunTimeCounter = 0;
return runTime;
}
#endif
/*-----------------------------------------------------------*/
#endif
/*----------------------------------------------------------*/
@ -2112,6 +2130,7 @@ tskTCB *pxNewTCB;
}
#endif
/*-----------------------------------------------------------*/
#if ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) )