introduction to worst-case execution-time analysis

20
Introduction to Worst-Case Execution-Time Analysis Peter Puschner slides: P. Puschner, R. Kirner, B. Huber VU 2.0 182.101 SS 2016

Upload: others

Post on 09-Dec-2021

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Worst-Case Execution-Time Analysis

Introduction to Worst-Case Execution-Time AnalysisPeter Puschner

slides: P. Puschner, R. Kirner, B. HuberVU 2.0 182.101 SS 2016

Page 2: Introduction to Worst-Case Execution-Time Analysis

How do we know the timing is right?

2

RTCS

Environment ?

response time

Page 3: Introduction to Worst-Case Execution-Time Analysis

Time in RTS Construction

3

DesignArchitecture, resource planning, schedules

Timing AnalysisSchedulability analysis, WCET analysis

Implementation

Page 4: Introduction to Worst-Case Execution-Time Analysis

From Design to Implementation

4

T1

T4

T2 T3

t

Task set with precedenceconstraints and deadline

T1 T2 T3 T4t

Task sequence:execution times,response time

Can we guarantee that: response time < deadline?

Page 5: Introduction to Worst-Case Execution-Time Analysis

Timing-Analysis Abstraction

5

T1 T2 T3 T4

T1 T2 T3 T4t

In general it is infeasible to model all possible executionscenarios and combinations of task execution times

T1 T2 T3 T4T1 T2T3 T4

Timing analysis abstracts the different execution times of eachtask to one single value ð WCET

TiTi

xt < WCET

xt = WCET

Page 6: Introduction to Worst-Case Execution-Time Analysis

Schedulability and WCET Analysis

Schedulability objects• Units of execution (simple tasks) with WCET• Precedence relations• Synchronization, communication, mutual exclusion• Priorities

WCET-analysis objects• Simple tasks

Interference ... (nasty and therefore widely neglected)• “external” changes of task state that influence exec. time

6

Page 7: Introduction to Worst-Case Execution-Time Analysis

• Inputs available at start• Outputs ready at the end• No blocking inside• No synchronization or

communication inside• Execution time variations only

due to differences in• inputs• task state at start time(no external disturbances)

7

Task

Input

Output

State

State

Simple Task

Page 8: Introduction to Worst-Case Execution-Time Analysis

Why not just Measure WCET?

8

Stop Timing Measurement

Execute Task on Target HW

Start Timing Measurement

WCET estimate ?

Timer,Logic Analyzer,

etc.

Page 9: Introduction to Worst-Case Execution-Time Analysis

Why not just Measure WCET? (2)

• Measuring all different execution traces of a real-size program is intractable in practice.(e.g., mid-size task: 1040 different paths)

• Selected test data for measurement may fail to trigger the longest execution trace.

Rare execution scenarios may be missed (e.g., exception handling, …).

9

Page 10: Introduction to Worst-Case Execution-Time Analysis

Static WCET Analysis

Static WCET Analysis: computes upper bounds for the execution time of pieces of code

10

Execution time: time it takes to execute• a given piece of code (without disturbance)• in a given application context (inputs, state)• on a given machine

cave: execution time is not response time

Page 11: Introduction to Worst-Case Execution-Time Analysis

Goals for WCET Analysis

WCET analysis = modelingComplexity necessitates modeling tradeoffs

11

➭ WCET bounds must be safe➭ WCET bounds should be tight➭ WCET analysis cost should be reasonable

Page 12: Introduction to Worst-Case Execution-Time Analysis

WCET Analysis – Quality

12

BCET WCETt

freq

uenc

y

WCET Bound

Page 13: Introduction to Worst-Case Execution-Time Analysis

WCET Determinants

• Possible sequences of actions of the code (= execution paths) in given application[→ code, context]

• The duration of each occurrence of an action on each possible path[→ hardware, state]

13

t1

t2t3 t4

t5 t6t7

t8

t8

Task

Page 14: Introduction to Worst-Case Execution-Time Analysis

Exec. Time: Simple vs. Complex Arch.Simple Architecture Model

Duration of each action ai is constant:

xt(pk ) = Σ nk,i t(ai )pk … path k xt(pk ) … WCET of pk

t(ai) … WCET of action ai nk,i … number of times action ai is executed on path pk

Complex Architecture ModelDurations of actions ai vary depending on history:

xt(pk ) = Σ t(ai,j(k) )t(ai,j(k)) … WCET of the jth action ai executed on path k

Reasons: pipelining, caches, parallelism, … 14

Page 15: Introduction to Worst-Case Execution-Time Analysis

WCET Analysis Problems

Path analysis: identifying (in)feasible paths to obtainflow facts• Syntactic restrictions – code• Semantic restrictions – code• Input-data space – application• Automatic analysis vs. user annotations

Modelling of hardware timing• CPU architecture• Implementation of instructions• Resource limitations and state dependencies

15

Page 16: Introduction to Worst-Case Execution-Time Analysis

Representation Levels

16

Extraction/annotation of possibleexecution paths – flow facts

Execution-time analysis,computation of WCET bound

Translation of flow facts

Source-CodeRepresentation

Machine-LanguageRepresentation

Page 17: Introduction to Worst-Case Execution-Time Analysis

Representation LevelsFlow-fact mapping between representation levels has

to be formally correctà support by the code transformer

otherwise mapping may be ambiguous.

Possible support by code transformer:• emit execution history

(flow facts update by an external tool)

• perform flow facts transformation in parallel to code transformation.

17

Page 18: Introduction to Worst-Case Execution-Time Analysis

Generic WCET Analysis Framework

18

sourcecode

objectcode

Compilation Transformation ofFlow Facts

Extraction ofFlow Facts

Exec-TimeModeling

WCET

Calculation ofExecutionScenarios

Page 19: Introduction to Worst-Case Execution-Time Analysis

Representation Level

19

WCET analysis of Matlab/Simulink models:

Page 20: Introduction to Worst-Case Execution-Time Analysis

Summary

WCET definition• Code; context (application, situation); machine

WCET versus WCET modelling

Problems of the analysis• Flow fact analysis and annotation

• Hardware modeling

• Bridging the representation levels

20