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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The screenshot below shows the context switch time. The period between the second falling edge and the second risingedge is the context switch time and includes the measurement overhead which has to be substracted. The measuredvalue is T2 = 9.24 us.The time which is required for the pure context switch is:T = T2 - T1 = 9240 ns - 320 ns = 8920 ns = 8.92 usNote:The measured performance of your target system may depart from the above named values. The performance ofa system depends on many factors (CPU, compiler, memory model, optimization, configuration, etc.).Measurement with high-resolution timerThe context switch time may be measured with the high-resolution timer. Refer to section High-resolutionmeasurement on page 115 for detailed information about the <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong> high-resolution measurement.The example MeasureContextSwitchingTime_HRTimerCSpy.c uses a high resolution timer to measure thecontext switch time from a low priority task to a high priority task and display the results on stdout.#include "<strong>RTOS</strong>.h"#include "stdio.h"static OS_STACKPTR int StackHP[128], StackLP[128]; // Task stacksstatic OS_TASK TCBHP, TCBLP;// Task-control-blocksstatic OS_U32 _Time;// Timer values/*********************************************************************** HPTask*/static void HPTask(void) {while (1) {OS_Suspend(NULL);// Suspend high priority taskOS_Timing_End(&_Time);// Stop measurement}}/*********************************************************************** LPTask130<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>for ARM CoresPP<strong>RTOS</strong>-2

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

Saved successfully!

Ooh no, something went wrong!