Complete the code to get the stack high water mark of a task.
UBaseType_t highWaterMark = uxTaskGetStackHighWaterMark([1]);The function uxTaskGetStackHighWaterMark() requires the task handle as argument to return the stack high water mark.
Complete the code to print the stack high water mark value.
printf("Stack high water mark: %u\n", [1]);
The variable highWaterMark stores the value returned by uxTaskGetStackHighWaterMark() and should be printed.
Fix the error in the code to correctly get the stack high water mark.
UBaseType_t highWaterMark = uxTaskGetStackHighWaterMark([1]);The function requires a valid task handle variable like xTaskHandle. Passing NULL or invalid names causes errors.
Fill both blanks to create a function that returns the stack high water mark of a task.
UBaseType_t getStackHighWaterMark([1] task) { return uxTaskGetStackHighWaterMark([2]); }
The function parameter should be of type TaskHandle_t and the same parameter task is passed to uxTaskGetStackHighWaterMark().
Fill all three blanks to complete the for loop that populates the highWaterMarks array using the corresponding task handles.
const char* taskNames[] = {"Task1", "Task2", "Task3"};
UBaseType_t highWaterMarks[] = {0, 0, 0};
for (int [1] = 0; [2] < 3; [3]++) {
highWaterMarks[i] = uxTaskGetStackHighWaterMark(xTaskHandles[i]);
}The loop variable i is used consistently for initialization, condition, and increment.