mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Cleaned up the scheduler.
This commit is contained in:
parent
b729c3cc99
commit
db4bd1f186
20 changed files with 326 additions and 392 deletions
|
@ -4670,14 +4670,14 @@ static void cliStatus(char *cmdline)
|
|||
|
||||
// Run status
|
||||
|
||||
const int gyroRate = getTaskDeltaTime(TASK_GYRO) == 0 ? 0 : (int)(1000000.0f / ((float)getTaskDeltaTime(TASK_GYRO)));
|
||||
const int gyroRate = getTaskDeltaTimeUs(TASK_GYRO) == 0 ? 0 : (int)(1000000.0f / ((float)getTaskDeltaTimeUs(TASK_GYRO)));
|
||||
int rxRate = getCurrentRxRefreshRate();
|
||||
if (rxRate != 0) {
|
||||
rxRate = (int)(1000000.0f / ((float)rxRate));
|
||||
}
|
||||
const int systemRate = getTaskDeltaTime(TASK_SYSTEM) == 0 ? 0 : (int)(1000000.0f / ((float)getTaskDeltaTime(TASK_SYSTEM)));
|
||||
const int systemRate = getTaskDeltaTimeUs(TASK_SYSTEM) == 0 ? 0 : (int)(1000000.0f / ((float)getTaskDeltaTimeUs(TASK_SYSTEM)));
|
||||
cliPrintLinef("CPU:%d%%, cycle time: %d, GYRO rate: %d, RX rate: %d, System rate: %d",
|
||||
constrain(averageSystemLoadPercent, 0, 100), getTaskDeltaTime(TASK_GYRO), gyroRate, rxRate, systemRate);
|
||||
constrain(getAverageSystemLoadPercent(), 0, LOAD_PERCENTAGE_ONE), getTaskDeltaTimeUs(TASK_GYRO), gyroRate, rxRate, systemRate);
|
||||
|
||||
// Battery meter
|
||||
|
||||
|
@ -4720,22 +4720,22 @@ static void cliTasks(char *cmdline)
|
|||
cliPrintLine("Task list");
|
||||
}
|
||||
#endif
|
||||
for (cfTaskId_e taskId = 0; taskId < TASK_COUNT; taskId++) {
|
||||
cfTaskInfo_t taskInfo;
|
||||
for (taskId_e taskId = 0; taskId < TASK_COUNT; taskId++) {
|
||||
taskInfo_t taskInfo;
|
||||
getTaskInfo(taskId, &taskInfo);
|
||||
if (taskInfo.isEnabled) {
|
||||
int taskFrequency = taskInfo.averageDeltaTime == 0 ? 0 : lrintf(1e6f / taskInfo.averageDeltaTime);
|
||||
int taskFrequency = taskInfo.averageDeltaTimeUs == 0 ? 0 : lrintf(1e6f / taskInfo.averageDeltaTimeUs);
|
||||
cliPrintf("%02d - (%15s) ", taskId, taskInfo.taskName);
|
||||
const int maxLoad = taskInfo.maxExecutionTime == 0 ? 0 :(taskInfo.maxExecutionTime * taskFrequency + 5000) / 1000;
|
||||
const int averageLoad = taskInfo.averageExecutionTime == 0 ? 0 : (taskInfo.averageExecutionTime * taskFrequency + 5000) / 1000;
|
||||
const int maxLoad = taskInfo.maxExecutionTimeUs == 0 ? 0 :(taskInfo.maxExecutionTimeUs * taskFrequency + 5000) / 1000;
|
||||
const int averageLoad = taskInfo.averageExecutionTimeUs == 0 ? 0 : (taskInfo.averageExecutionTimeUs * taskFrequency + 5000) / 1000;
|
||||
if (taskId != TASK_SERIAL) {
|
||||
maxLoadSum += maxLoad;
|
||||
averageLoadSum += averageLoad;
|
||||
}
|
||||
if (systemConfig()->task_statistics) {
|
||||
cliPrintLinef("%6d %7d %7d %4d.%1d%% %4d.%1d%% %9d",
|
||||
taskFrequency, taskInfo.maxExecutionTime, taskInfo.averageExecutionTime,
|
||||
maxLoad/10, maxLoad%10, averageLoad/10, averageLoad%10, taskInfo.totalExecutionTime / 1000);
|
||||
taskFrequency, taskInfo.maxExecutionTimeUs, taskInfo.averageExecutionTimeUs,
|
||||
maxLoad/10, maxLoad%10, averageLoad/10, averageLoad%10, taskInfo.totalExecutionTimeUs / 1000);
|
||||
} else {
|
||||
cliPrintLinef("%6d", taskFrequency);
|
||||
}
|
||||
|
@ -4746,7 +4746,7 @@ static void cliTasks(char *cmdline)
|
|||
if (systemConfig()->task_statistics) {
|
||||
cfCheckFuncInfo_t checkFuncInfo;
|
||||
getCheckFuncInfo(&checkFuncInfo);
|
||||
cliPrintLinef("RX Check Function %19d %7d %25d", checkFuncInfo.maxExecutionTime, checkFuncInfo.averageExecutionTime, checkFuncInfo.totalExecutionTime / 1000);
|
||||
cliPrintLinef("RX Check Function %19d %7d %25d", checkFuncInfo.maxExecutionTimeUs, checkFuncInfo.averageExecutionTimeUs, checkFuncInfo.totalExecutionTimeUs / 1000);
|
||||
cliPrintLinef("Total (excluding SERIAL) %25d.%1d%% %4d.%1d%%", maxLoadSum/10, maxLoadSum%10, averageLoadSum/10, averageLoadSum%10);
|
||||
schedulerResetCheckFunctionMaxExecutionTime();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue