rtel wrote on Friday, January 27, 2012:
If I understand you correctly, then you have the following scenario, where P1 is a task with priority 1, and P2 is a task with priority 2.
1: P2 suspends itself.
2: Because P2 is suspended P1 runs.
3: When P1 has done something it un-suspends (resumes) P2, so P2 runs again.
and you want to measure between step 1 and step 2.
If the tick count has enough resolution then you can do that by:
void P2( void *pvParameters )
xTickType xTimeBefore, xTotalTimeSuspended;
____for( ;; )
________/* Take a time before suspending. */
________xTimeBefore = xTaskGetTickCount();
________/* Suspend the task. */
________vTaskSuspend( NULL );
________/* The other task will have run an unsuspended P2 for this line to execute. */
________xTotalTimeSuspended = xTaskGetTickCount() - xTimeBefore;