1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-315: Extend TaskInfo to include run time stats. Still need to configure a

timer to run at around 10 khz.  RTC a good option.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2940 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-03-03 04:28:29 +00:00 committed by peabody124
parent 267efe0b88
commit 528f74b512
3 changed files with 19 additions and 3 deletions

View File

@ -71,6 +71,16 @@ configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
/* Enable run time stats collection */
#if defined(DEBUG)
#define configGENERATE_RUN_TIME_STATS 1
#define INCLUDE_uxTaskGetRunTime 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
// Note: Using the tick count defeats the purpose here, need some timer on the scale of 10khz
#define portGET_RUN_TIME_COUNTER_VALUE() xTaskGetTickCount()
#endif
/**
* @}
*/

View File

@ -39,7 +39,7 @@ static xTaskHandle handles[TASKINFO_RUNNING_NUMELEM];
// Private functions
/**
* Initialize library
* Initialize library
*/
int32_t TaskMonitorInitialize(void)
{
@ -49,7 +49,7 @@ int32_t TaskMonitorInitialize(void)
}
/**
* Register a task handle with the library
* Register a task handle with the library
*/
int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle)
{
@ -85,7 +85,7 @@ int32_t TaskMonitorRemove(TaskInfoRunningElem task)
}
/**
* Update the status of all tasks
* Update the status of all tasks
*/
void TaskMonitorUpdateAll(void)
{
@ -105,7 +105,12 @@ void TaskMonitorUpdateAll(void)
data.StackRemaining[n] = 10000;
#else
data.StackRemaining[n] = uxTaskGetStackHighWaterMark(handles[n]) * 4;
#if ( configGENERATE_RUN_TIME_STATS == 1 )
/* Generate run time stats */
data.RunningTime[n] = uxTaskGetRunTime(handles[n]);
#endif
#endif
}
else
{

View File

@ -3,6 +3,7 @@
<description>Task information</description>
<field name="StackRemaining" units="bytes" type="uint16" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<field name="Running" units="bool" type="enum" options="False,True" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<field name="RunningTime" units="µs" type="uint16" elementnames="System,Actuator,Attitude,TelemetryTx,TelemetryTxPri,TelemetryRx,GPS,ManualControl,Altitude,AHRSComms,Stabilization,Guidance,FlightPlan"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="periodic" period="10000"/>