Merge pull request #2636 from martinbudden/bf_scheduler_tidy
Minor scheduler tidy
This commit is contained in:
commit
f0b7461075
|
@ -25,18 +25,12 @@
|
|||
#include "scheduler/scheduler.h"
|
||||
|
||||
|
||||
void main_step(void)
|
||||
{
|
||||
scheduler();
|
||||
processLoopback();
|
||||
}
|
||||
|
||||
#ifndef NOMAIN
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
while (true) {
|
||||
main_step();
|
||||
scheduler();
|
||||
processLoopback();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -178,7 +178,7 @@ void setTaskEnabled(cfTaskId_e taskId, bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t getTaskDeltaTime(cfTaskId_e taskId)
|
||||
timeDelta_t getTaskDeltaTime(cfTaskId_e taskId)
|
||||
{
|
||||
if (taskId == TASK_SELF) {
|
||||
return currentTask->taskLatestDeltaTime;
|
||||
|
|
|
@ -39,12 +39,12 @@ typedef struct {
|
|||
const char * taskName;
|
||||
const char * subTaskName;
|
||||
bool isEnabled;
|
||||
timeUs_t desiredPeriod;
|
||||
uint8_t staticPriority;
|
||||
timeDelta_t desiredPeriod;
|
||||
timeDelta_t latestDeltaTime;
|
||||
timeUs_t maxExecutionTime;
|
||||
timeUs_t totalExecutionTime;
|
||||
timeUs_t averageExecutionTime;
|
||||
timeUs_t latestDeltaTime;
|
||||
} cfTaskInfo_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -118,23 +118,23 @@ typedef enum {
|
|||
} cfTaskId_e;
|
||||
|
||||
typedef struct {
|
||||
/* Configuration */
|
||||
// Configuration
|
||||
const char * taskName;
|
||||
const char * subTaskName;
|
||||
bool (*checkFunc)(timeUs_t currentTimeUs, timeDelta_t currentDeltaTimeUs);
|
||||
void (*taskFunc)(timeUs_t currentTimeUs);
|
||||
uint32_t desiredPeriod; // target period of execution
|
||||
timeDelta_t desiredPeriod; // target period of execution
|
||||
const uint8_t staticPriority; // dynamicPriority grows in steps of this size, shouldn't be zero
|
||||
|
||||
/* Scheduling */
|
||||
// Scheduling
|
||||
uint16_t dynamicPriority; // measurement of how old task was last executed, used to avoid task starvation
|
||||
uint16_t taskAgeCycles;
|
||||
timeDelta_t taskLatestDeltaTime;
|
||||
timeUs_t lastExecutedAt; // last time of invocation
|
||||
timeUs_t lastSignaledAt; // time of invocation event for event-driven tasks
|
||||
uint32_t taskLatestDeltaTime;
|
||||
|
||||
#ifndef SKIP_TASK_STATISTICS
|
||||
/* Statistics */
|
||||
// Statistics
|
||||
timeUs_t movingSumExecutionTime; // moving sum over 32 samples
|
||||
timeUs_t maxExecutionTime;
|
||||
timeUs_t totalExecutionTime; // total time consumed by task since boot
|
||||
|
@ -148,7 +148,7 @@ void getCheckFuncInfo(cfCheckFuncInfo_t *checkFuncInfo);
|
|||
void getTaskInfo(cfTaskId_e taskId, cfTaskInfo_t *taskInfo);
|
||||
void rescheduleTask(cfTaskId_e taskId, uint32_t newPeriodMicros);
|
||||
void setTaskEnabled(cfTaskId_e taskId, bool newEnabledState);
|
||||
uint32_t getTaskDeltaTime(cfTaskId_e taskId);
|
||||
timeDelta_t getTaskDeltaTime(cfTaskId_e taskId);
|
||||
void schedulerSetCalulateTaskStatistics(bool calculateTaskStatistics);
|
||||
void schedulerResetTaskStatistics(cfTaskId_e taskId);
|
||||
|
||||
|
|
Loading…
Reference in New Issue