Bird
0
0

Given the following code snippet, what will be the output stored in statsBuffer?

medium📝 Predict Output Q13 of 15
FreeRTOS - Debugging and Monitoring
Given the following code snippet, what will be the output stored in statsBuffer?
char statsBuffer[100];
vTaskGetRunTimeStats(statsBuffer);
printf("%s", statsBuffer);
Assuming two tasks "TaskA" and "TaskB" run and TaskA used 70% CPU, TaskB used 30%.
ATaskA 7 TaskB 3
BTaskA 70% TaskB 30%
CTaskA 7000 TaskB 3000
DTaskA 700 TaskB 300
Step-by-Step Solution
Solution:
  1. Step 1: Understand output format of vTaskGetRunTimeStats()

    The function outputs CPU usage as run time counter ticks, not percentages. If TaskA used 70% CPU, it might show 7000 ticks and TaskB 3000 ticks (assuming 10000 total ticks).
  2. Step 2: Match options with expected output

    TaskA 7000 TaskB 3000 shows usage in ticks (7000 and 3000), matching expected output. Options B, C, and D show percentages or smaller numbers, which are not the direct output format.
  3. Final Answer:

    TaskA 7000 TaskB 3000 -> Option C
  4. Quick Check:

    Output shows ticks, not percentages [OK]
Quick Trick: Output shows ticks, not percent values [OK]
Common Mistakes:
  • Assuming output shows percentages directly
  • Confusing ticks with smaller numbers
  • Expecting formatted percentages in output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes