0
0
FreeRTOSprogramming~10 mins

vTaskGetRunTimeStats() for CPU usage in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare a buffer for runtime stats.

FreeRTOS
char statsBuffer[[1]];
Drag options to blanks, or click blank then click option'
A512
B1024
C256
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Using too small a buffer causing string truncation.
Using an uninitialized buffer.
2fill in blank
medium

Complete the code to call vTaskGetRunTimeStats with the buffer.

FreeRTOS
vTaskGetRunTimeStats([1]);
Drag options to blanks, or click blank then click option'
AstatsBuffer
B&statsBuffer
CNULL
Dbuffer
Attempts:
3 left
💡 Hint
Common Mistakes
Passing &statsBuffer which is a pointer to the whole array, not a char pointer.
Passing NULL which causes no output.
3fill in blank
hard

Fix the error in printing the runtime stats string.

FreeRTOS
printf("CPU Usage:\n%s", [1]);
Drag options to blanks, or click blank then click option'
A*statsBuffer
B&statsBuffer
CstatsBuffer
DstatsBuffer[0]
Attempts:
3 left
💡 Hint
Common Mistakes
Using &statsBuffer which is a pointer to the array, not a char pointer.
Using *statsBuffer which is a char, not a pointer.
4fill in blank
hard

Fill both blanks to declare and initialize the buffer, then get runtime stats.

FreeRTOS
char [1][512];
vTaskGetRunTimeStats([2]);
Drag options to blanks, or click blank then click option'
AstatsBuffer
Bbuffer
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for declaration and function call.
Passing an uninitialized buffer.
5fill in blank
hard

Fill all three blanks to declare buffer, get stats, and print them.

FreeRTOS
char [1][1024];
vTaskGetRunTimeStats([2]);
printf("Task CPU Usage:\n%s", [3]);
Drag options to blanks, or click blank then click option'
AruntimeStats
DstatsBuffer
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for buffer declaration and usage.
Passing NULL or wrong pointer to vTaskGetRunTimeStats.