realtimeandembeddedsystems_part4 mathhoang vietnam_hoangminhnguyen
TRANSCRIPT
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
1/24
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
2/24
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
3/24
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
4/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 4
What exactly is beingmeasured ?
Real-Time Scheduling AnalysisTask Execution TimePeriodic Time of Task
The effect of RTOS OverheadContext SwitchInterrupt Processing
The effect of RTOS ServicesMessage PassingSemaphore ProcessingMemory Allocation/Deallocation
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
5/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 5
Measurement Methods
Stop-watchProgram starts, state the watch. Program ends,stop the watch and read the timeToo low in accuracy for real-time codeIgnore this manual method
Software AnalyzerWindView, Tornado Environment (VxWorks)ARM RealView ProfilerReal-Time Trace, Keil ARM Development Tools
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
6/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 6
Measurement Methods WindView
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
7/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 7
Measurement Methods Using Timer Services
start = OSTimerGet();do stuff;finish = OSTimerGet();total = (finish start)/CLOCK_TICKS;
Measurement
Accuracy depends on the tick resolution
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
8/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 8
Code Execution TimeEstimation
T = I c * CPI / f
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
9/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 9
Measurement Methods Hardware Tools
The best tools for accuratelymeasuring execution time
Hook up the probes to the CPU pinsThe embedded application is designedwith at least one such port dedicated
to testing and debuggingThe software must send the signals tothese dedicated port pins
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
10/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 10
Measurement Methods Hardware Tools
Using LPC2294s GPIO portpins to measure theexecution time
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
11/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 11
Measurement Methods Logic Analyzer
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
12/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 12
Measurement Methods Oscilloscope
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
13/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 13
Measurement Methods
Must setup macros for writing theoutput port
#define MEZ_START(id)output(dioport,0x50|id&0xF)
#define MEZ_STOP(id)output(dioport,0x60|id&0xF)
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
14/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 14
Measuring Task Execution
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
15/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 15
Measuring Task Execution
e task c = (55.081 28.677) (3.0669 +5.0944 + 3.3741 + 3.0464) = 11.8222msec
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
16/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 16
Measuring Task Execution Effectof Context Switch Overhead
e 1,1 = t g ; e 2,1 = t c ; e 3,1 = t a e 2,2 = t f +t h +2 thr ; e 3,2 = t b +t d +2 thr e idle = t y +t z +4 thr ; e 3,3 = t e +t i +t k +4 thr Whenever a high priority task preempts a low-priority task, the preemptionoverhead ( thr ) is added to the execution time of the lower priority task
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
17/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 17
Measuring Task Execution Effectof Context Switch Overhead
Need this overhead for each task is constantSupposing the start task event was logged
before the overhead, and the end task eventwas logged after the overhead
e 1,1 = t g + 2 thr ; e 2,1 = t c + 2 thr ; e 3,1 = t a + 2 thr
e 2,2 = t f +t h +2 thr ; e 3,2 = t b +t d +2 thr e idle = t y +t z ; e 3,3 = t e +t i +t k +2 thr
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
18/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 18
Measuring Task Execution Effectof Context Switch Overhead
( 2. )max min . / 1,1{1 } { }
where S { . | 1, ..., ; 1, ..., / }i
The entire task set is feasible by RMS if and only if
e ji L t p j ji n t S i t
k p j i k p p j i j
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
19/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 19
Measuring Time of TaskContext Switch
Using two periodic tasks each at a different priorityThe slowest task toggles bit on a GPIO pin connecting to channel 1The other toggles bit on another GPIO pin connecting to channel 2
2 thr = t 1 t 2 t 3
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
20/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 20
Measuring Time of InterruptLatency
Force a software interrupt
Toggle a GPIO pin
Toggle a GPIO pin
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
21/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 21
Measuring Time of InterruptLatency
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
22/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 22
Measuring Time of InterruptLatency
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
23/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 23
Measuring Time of RTOSsServices
Message PassingSemaphore ProcessingMemory Allocation/Deallocation
-
8/8/2019 RealTimeAndEmbeddedSystems_Part4 mathhoang vietnam_hoangminhnguyen
24/24
8/20/2010 Embedded Systems Course: Measuring Execution Time and Real-Time Performance - 2010 24
Reference
David B. Stewart, Measuring Execution Time and Real-Time Performance, Embedded SystemsConference, Boston, September 2006
William Lamie and John Carbone, Measure your RTOSs Real -Time Performance,http://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performance , 2007Phillip A. Laplante, Real-Time System Design and Analysis An Engineers Handbook, John Wiley &Sons, Inc., Third Edition, 2004
http://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performancehttp://www.eetimes.com/design/automotive-design/4007081/Measure-your-RTOS-s-real-time-performance