11.07.2015 Views

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Performance and resource usage*/static void LPTask(void) {OS_U32 MeasureOverhead;OS_U32 v;// Time for Measure Overhead//// Measure overhead for time measurement so we can take this into// account by subtracting it OS_Timing_Start(&MeasureOverhead);// OS_Timing_End(&MeasureOverhead);//// Perform measurements in endless loop//while (1) {OS_Delay(100);// Syncronize to tick to avoid jitterOS_Timing_Start(&_Time); // Start measurementOS_Resume(&TCBHP);// Resume high priority task to force task switchv = OS_Timing_GetCycles(&_Time) - OS_Timing_GetCycles(&MeasureOverhead);v = OS_ConvertCycles2us(1000 * v);printf("Context switch time: %u.%.3u usec\r\n", v / 1000, v % 1000);}}The example program calculates and subtracts the measurement overhead itself, so there is no need to do this. Use theC-SPY terminal I/O window to check the results.PP<strong>RTOS</strong>-2131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!