Browse Source

first commit

Giuseppe Lipari 11 years ago
commit
067393cea9
4 changed files with 1218 additions and 0 deletions
  1. 21
    0
      README.md
  2. 105
    0
      rtsched-beamer-doc.tex
  3. 623
    0
      rtsched-doc.tex
  4. 469
    0
      rtsched.sty

+ 21
- 0
README.md View File

@@ -0,0 +1,21 @@
1
+========================================
2
+ rtsched: The Real-Time scheduling style
3
+========================================
4
+
5
+Author: Giuseppe Lipari (g.lipari@sssup.it)
6
+Version: 1.0
7
+Date:    2011/09/29
8
+
9
+This package contains the rtsched package for drawing GANTT charts
10
+(chronograms). The package can be useful for drawing real-time timing
11
+diagrams in LaTeX, as often needs to be done for preparing articles,
12
+lectures and presentation in the Real-Time Scheduling research
13
+community. The package depends on keyval, multido and pstricks.
14
+
15
+A more complete documentation, with a set of examples, is available in
16
+file rtsched-doc.pdf.
17
+
18
+This material is subject to the LaTeX Project Public License. See
19
+http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for
20
+the details of that license.
21
+

+ 105
- 0
rtsched-beamer-doc.tex View File

@@ -0,0 +1,105 @@
1
+\documentclass[dvips]{beamer}
2
+
3
+\usepackage{rtsched}
4
+\usepackage[english]{babel}
5
+\usepackage[latin1]{inputenc}
6
+
7
+\title{An example of using the \texttt{rtsched} package with Beamer}
8
+\author{Giuseppe Lipari}
9
+\institute[Scuola Superiore Sant'Anna]{Scuola Superiore Sant'Anna -- Pisa}
10
+
11
+\usetheme{Madrid}
12
+
13
+\begin{document}
14
+
15
+\begin{frame}
16
+  \titlepage
17
+\end{frame}
18
+
19
+\begin{frame}
20
+  \frametitle{An example with fixed priority}
21
+  \transduration<2-15>{.5}
22
+  \begin{itemize}
23
+  \item After you click on this slides, an animation will start where
24
+    every move in the schedule is shown for half a second.
25
+  \end{itemize}
26
+  \begin{figure}
27
+    \centering
28
+    \begin{RTGrid}[width=.7\textwidth]{2}{20}
29
+      %% the first job of task 1 arrives at time 0, 
30
+      %% with a relative deadline of 4 
31
+      \only<+->{
32
+        \TaskArrDead{1}{0}{4}     
33
+        \TaskArrDead{2}{0}{4}
34
+      }
35
+      \TaskExecution<+->{1}{0}{1}
36
+      \TaskExecution<+->{2}{1}{4}
37
+
38
+      \TaskArrDead<+->{1}{4}{4}
39
+      \TaskExecution<+->{1}{4}{5}
40
+
41
+      \TaskArrDead<+->{2}{6}{4}
42
+      \TaskExecution<+->{2}{6}{8}
43
+      \TaskArrDead<+->{1}{8}{4}
44
+      \TaskExecution<+->{1}{8}{9}
45
+      \TaskExecution<+->{2}{9}{10}
46
+      
47
+      \only<+->{
48
+        \TaskArrDead{1}{12}{4}
49
+        \TaskArrDead{2}{12}{4}
50
+      }
51
+      \TaskExecution<+->{1}{12}{13}
52
+      \TaskExecution<+->{2}{13}{16}
53
+      
54
+      \TaskArrDead<+->{1}{16}{4}
55
+      \TaskExecution<+->{1}{16}{17}
56
+    \end{RTGrid}
57
+  \end{figure}
58
+  \begin{itemize}
59
+  \item<+-> You can now click to move to the next slide
60
+  \end{itemize}
61
+\end{frame}
62
+
63
+\begin{frame}
64
+  \frametitle{A simple RTBox to highlight part of the schedule}
65
+  \transduration<2-22>{.2}
66
+  \begin{itemize}
67
+  \item Now, when you click an animation will start that shows a
68
+    hatched box from time 6 to time 10 in ``slow motion''
69
+  \end{itemize}
70
+  \begin{figure}
71
+    \centering
72
+    \begin{RTGrid}[width=.7\textwidth]{2}{20}
73
+      \multido{\i=2+1,\n=6+.2}{20} {
74
+        \RTBox<\i>{6}{\n}
75
+      }
76
+      \RTBox<23>{6}{10}
77
+
78
+      \multido{\n=0+4}{5}{        % 5 instances of period 4 
79
+        \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
80
+        \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
81
+        % from \n to \n+1
82
+      }
83
+      
84
+      \multido{\n=0+6}{3}{        % 3 instances of period 6 
85
+        \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
86
+      }
87
+      % no simple formula for lowest priority, sorry!
88
+      \TaskExecution{2}{1}{4}
89
+      \TaskExecution{2}{6}{8}
90
+      \TaskExecution{2}{9}{10}
91
+      \TaskExecution{2}{13}{16}
92
+
93
+    \end{RTGrid}
94
+  \end{figure}
95
+  \begin{itemize}
96
+  \item<23> Again, you can now click to move to next animation
97
+  \end{itemize}
98
+\end{frame}
99
+
100
+\end{document}
101
+
102
+%%% Local Variables: 
103
+%%% mode: latex
104
+%%% TeX-master: t
105
+%%% End: 

+ 623
- 0
rtsched-doc.tex View File

@@ -0,0 +1,623 @@
1
+\documentclass{article}
2
+
3
+\usepackage{rtsched}
4
+\usepackage{url}
5
+
6
+\title{The \texttt{rtsched} package for \LaTeX \\ (version 1.0)}
7
+\author{Giuseppe Lipari}
8
+
9
+\begin{document}
10
+
11
+\maketitle
12
+
13
+\listoffigures
14
+
15
+\section{Introduction}
16
+
17
+In this document, I give an overview of the \texttt{rtsched} \LaTeX
18
+package, which can be used to easily draw chronograms (GANTT charts).
19
+These diagrams are quite common in real-time scheduling research.
20
+
21
+The package depends on keyval, multido and pstricks, all widely
22
+available on any \TeX distribution.
23
+
24
+The drawing capabilities are completely based on the PSTricks: for
25
+this reason, it may not be safe to use \texttt{pdfLaTeX} to compile a
26
+document that uses the \texttt{rtsched} package, due to the fact that
27
+at the time of this writing, PSTricks is not well supported by
28
+pdfLatex. If you want to produce pdf files (for example for making
29
+slides with Beamer), consider using the following compilation chain:
30
+
31
+\begin{verbatim}
32
+latex doc.tex && dvips doc.dvi && ps2pdf doc.ps 
33
+\end{verbatim}
34
+
35
+As said, the style works also with Beamer, and it is also possible to
36
+use animations.
37
+
38
+You can find more examples of usage of this style in my lectures,
39
+which can be downloaded at the following address:
40
+\url{http://retis.sssup.it/~lipari/courses/}.
41
+
42
+I prefer to demonstrate the capabilities of the package by a set of
43
+examples. You can just cut and paste the examples and play with them
44
+as you wish.
45
+
46
+\section{Basic commands}
47
+
48
+\subsection{Simple example with two tasks}
49
+
50
+In Figure \ref{fig:ex1} I show a simple example of the Rate Monotonic
51
+schedule of two simple tasks, followed by the code that generated it.
52
+To draw the grid, with the numbers, you have to use the
53
+\texttt{RTGrid} environment:
54
+\begin{verbatim}
55
+\begin{RTGrid}[options]{n}{t}
56
+...
57
+\end{RTGrid}
58
+\end{verbatim}
59
+\noindent where \texttt{n} is the number of horizontal axis (one per
60
+task, in this case), and \texttt{t} is the length of the axis in time
61
+units. This also draws the task labels on the left, and the numbering
62
+on the bottom.
63
+
64
+Every job arrival is depicted with an upward arrow; a deadline is
65
+depicted by a downward arrow (not very visible here, since it concides
66
+with the next arrival, see Figure \ref{fig:ex1c} for deadlines
67
+different from periods). The task execution is depicted by a gray box.
68
+
69
+The arrival of a job and the corresponding deadline can be obtained by
70
+using the following commands:
71
+\begin{verbatim}
72
+\TaskArrival{i}{t}
73
+\TaskArrDeadl{i}{t}{reld}
74
+\end{verbatim}
75
+\noindent where \texttt{i} is the task index (from 1 to \texttt{n}
76
+included), \texttt{t} is the arival time, and \texttt{reld} is the
77
+relative deadline; an absolute deadline will be drawn at \texttt{t +
78
+  reld}.
79
+
80
+In this example there are a lot of repetitions. These can be avoided
81
+if you use the \texttt{multido} macro, as shown in the example of
82
+Figure \ref{fig:ex1a}.
83
+
84
+To draw the execution rectangle, you can use the following command:
85
+\begin{verbatim}
86
+\TaskExecution{i}{t1}{t2}
87
+\TaskExecDelta{i}{t}{delta}
88
+\end{verbatim}
89
+The first one is used to draw an execution rectangle of height 1-unit
90
+for the \texttt{i}-th task from \texttt{t1} to \texttt{t2}. The second
91
+command draws a rectangle from \texttt{t} to \texttt{t+delta}.
92
+
93
+In Figure \ref{fig:ex1b}, you can see how to only draw arrival upward
94
+arrows, and how to specify offsets. Finally, in Figure \ref{fig:ex1c}
95
+you can see an example with 2 tasks with relative deadlines different
96
+from periods (the so-called \emph{constrained deadline tasks}).
97
+
98
+\begin{figure}[h]
99
+  \centering
100
+  % 2 tasks, for 20 units of time
101
+  % we specify the width (10cm is the default
102
+  % value, so we will stop specifying it from now on)
103
+  \begin{RTGrid}[width=10cm]{2}{20}
104
+    %% the first job of task 1 arrives at time 0, 
105
+    %% with a relative deadline of 4 
106
+    \TaskArrDead{1}{0}{4}     
107
+    %% the second job arrives at time 4
108
+    \TaskArrDead{1}{4}{4}
109
+    %% etc
110
+    \TaskArrDead{1}{8}{4}
111
+    \TaskArrDead{1}{12}{4}
112
+    \TaskArrDead{1}{16}{4}
113
+
114
+    %% the task executes in intervals [0,1], [4,5], etc.
115
+    \TaskExecution{1}{0}{1}
116
+    \TaskExecution{1}{4}{5}
117
+    \TaskExecution{1}{8}{9}
118
+    \TaskExecution{1}{12}{13}
119
+    \TaskExecution{1}{16}{17}
120
+
121
+    %% the second task
122
+    \TaskArrDead{2}{0}{4}
123
+    \TaskArrDead{2}{6}{4}
124
+    \TaskArrDead{2}{12}{4}
125
+    \TaskExecution{2}{1}{4}
126
+    \TaskExecution{2}{6}{8}
127
+    \TaskExecution{2}{9}{10}
128
+    \TaskExecution{2}{13}{16}
129
+  \end{RTGrid}
130
+\begin{verbatim}
131
+  % 2 tasks, for 20 units of time
132
+  % we specify the width (10cm is the default
133
+  % value, so we will stop specifying it from now on)
134
+  \begin{RTGrid}[width=10cm]{2}{20}
135
+    %% the first job of task 1 arrives at time 0, 
136
+    %% with a relative deadline of 4 
137
+    \TaskArrDead{1}{0}{4}     
138
+    %% the second job arrives at time 4
139
+    \TaskArrDead{1}{4}{4}
140
+    %% etc
141
+    \TaskArrDead{1}{8}{4}
142
+    \TaskArrDead{1}{12}{4}
143
+    \TaskArrDead{1}{16}{4}
144
+
145
+    %% the task executes in intervals [0,1], [4,5], etc.
146
+    \TaskExecution{1}{0}{1}
147
+    \TaskExecution{1}{4}{5}
148
+    \TaskExecution{1}{8}{9}
149
+    \TaskExecution{1}{12}{13}
150
+    \TaskExecution{1}{16}{17}
151
+
152
+    %% the second task
153
+    \TaskArrDead{2}{0}{4}
154
+    \TaskArrDead{2}{6}{4}
155
+    \TaskArrDead{2}{12}{4}
156
+    \TaskExecution{2}{1}{4}
157
+    \TaskExecution{2}{6}{8}
158
+    \TaskExecution{2}{9}{10}
159
+    \TaskExecution{2}{13}{16}
160
+  \end{RTGrid}
161
+\end{verbatim}
162
+  \caption{Two tasks, with deadline equal to period, RM scheduling}
163
+  \label{fig:ex1}
164
+\end{figure}
165
+
166
+\begin{figure}[h]
167
+  \centering
168
+  \begin{RTGrid}{2}{20}
169
+    \multido{\n=0+4}{5}{        % 5 instances of period 4 
170
+      \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
171
+      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
172
+                                % from \n to \n+1
173
+    }
174
+ 
175
+    \multido{\n=0+6}{3}{        % 3 instances of period 6 
176
+      \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
177
+    }
178
+    % no simple formula for lowest priority, sorry!
179
+    \TaskExecution{2}{1}{4}
180
+    \TaskExecution{2}{6}{8}
181
+    \TaskExecution{2}{9}{10}
182
+    \TaskExecution{2}{13}{16}    
183
+  \end{RTGrid}
184
+
185
+\begin{verbatim}
186
+  \begin{RTGrid}{2}{20}
187
+    \multido{\n=0+4}{5}{        % 4 instances of period 4 
188
+      \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
189
+      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
190
+                                % from \n to \n+1
191
+    }
192
+ 
193
+    \multido{\n=0+6}{3}{        % 3 instances of period 6 
194
+      \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
195
+    }
196
+    % no simple formula for lowest priority, sorry!
197
+    \TaskExecution{2}{1}{4}
198
+    \TaskExecution{2}{6}{8}
199
+    \TaskExecution{2}{9}{10}
200
+    \TaskExecution{2}{13}{16}    
201
+  \end{RTGrid}
202
+\end{verbatim}
203
+  \caption{Using multido to avoid repetitions}
204
+  \label{fig:ex1a}
205
+\end{figure}
206
+
207
+\begin{figure}[h]
208
+  \centering
209
+  \begin{RTGrid}{3}{14}
210
+    \multido{\n=0+3}{4}{        % 4 instances of period 3, starting from 0 
211
+      \TaskArrival{1}{\n}       % draw only the arrival
212
+      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
213
+                                % from \n to \n+1
214
+    }
215
+ 
216
+    \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
217
+      \TaskArrival{2}{\n}       % draw only the arrival
218
+    }
219
+    \TaskExecDelta{2}{4}{1}
220
+    \TaskExecDelta{2}{7}{1}
221
+    \TaskExecDelta{2}{11}{1}
222
+
223
+    \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
224
+      \TaskArrival{3}{\n}       % draw only the arrival
225
+    }
226
+    \TaskExecDelta{3}{1}{1}
227
+    \TaskExecDelta{3}{8}{1}
228
+    \TaskExecDelta{3}{12}{1}
229
+  \end{RTGrid}
230
+
231
+\begin{verbatim}
232
+  \begin{RTGrid}{3}{14}
233
+    \multido{\n=0+3}{4}{        % 4 instances of period 3 
234
+      \TaskArrival{1}{\n}       % draw only the arrival
235
+      \TaskExecDelta{1}{\n}{1}} % draw execution (highest priority), 
236
+                                % from \n to \n+1
237
+ 
238
+    \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
239
+      \TaskArrival{2}{\n}}      % draw only the arrival
240
+
241
+    \TaskExecDelta{2}{4}{1}
242
+    \TaskExecDelta{2}{7}{1}
243
+    \TaskExecDelta{2}{11}{1}
244
+
245
+    \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
246
+      \TaskArrival{3}{\n}}      % draw only the arrival
247
+
248
+    \TaskExecDelta{3}{1}{1}
249
+    \TaskExecDelta{3}{8}{1}
250
+    \TaskExecDelta{3}{12}{1}
251
+  \end{RTGrid}
252
+\end{verbatim}
253
+  \caption{Three tasks with offsets, and only arrivals with no deadlines}
254
+  \label{fig:ex1b}
255
+\end{figure}
256
+
257
+\begin{figure}[h]
258
+  \centering
259
+  \begin{RTGrid}[width=8cm]{2}{15}
260
+    \multido{\n=0+6}{3}{
261
+    \TaskArrDead{1}{\n}{3}}
262
+    \multido{\n=2+8}{2}{
263
+    \TaskArrDead{2}{\n}{5}}
264
+  \end{RTGrid}
265
+\begin{verbatim}
266
+    \multido{\n=0+6}{3}{
267
+    \TaskArrDead{1}{\n}{3}}
268
+    \multido{\n=2+8}{2}{
269
+    \TaskArrDead{2}{\n}{5}}
270
+\end{verbatim}
271
+  \caption{Deadlines less than periods}
272
+  \label{fig:ex1c}
273
+\end{figure}
274
+
275
+It is also possible to visualise preempted tasks with a hatched fill
276
+style. An example is in Figure~\ref{fig:resp-time} that uses command
277
+\texttt{TaskRespTime}. 
278
+
279
+\begin{figure}
280
+  \centering
281
+  \begin{RTGrid}{2}{20}
282
+    \multido{\n=0+4}{5}{        % 5 instances of period 4 
283
+      \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
284
+      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
285
+                                % from \n to \n+1
286
+    }
287
+ 
288
+    \multido{\n=0+6}{3}{        % 3 instances of period 6 
289
+      \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
290
+    }
291
+
292
+    \TaskRespTime{2}{0}{4}
293
+    \TaskExecution{2}{1}{4}
294
+    \TaskRespTime{2}{6}{4}
295
+    \TaskExecution{2}{6}{8}
296
+    \TaskExecution{2}{9}{10}
297
+    \TaskRespTime{2}{12}{4}
298
+    \TaskExecution{2}{13}{16}    
299
+  \end{RTGrid}  
300
+\begin{verbatim}
301
+  \begin{RTGrid}{2}{20}
302
+    \multido{\n=0+4}{5}{         
303
+      \TaskArrDead{1}{\n}{4}    
304
+      \TaskExecDelta{1}{\n}{1}}
305
+    \multido{\n=0+6}{3}{        
306
+      \TaskArrDead{2}{\n}{6}}
307
+
308
+    \TaskRespTime{2}{0}{4}   % draws the hatched rectangle in [0,4]
309
+    \TaskExecution{2}{1}{4}  % draws execution (over the previous rectangle)
310
+    \TaskRespTime{2}{6}{4}   % draws the hatched rectangle in [6,10]
311
+    \TaskExecution{2}{6}{8}  % draws execution
312
+    \TaskExecution{2}{9}{10} % draws execution
313
+    \TaskRespTime{2}{12}{4}   % draws the hatched rectangle in [12,16]
314
+    \TaskExecution{2}{13}{16} % draws execution   
315
+  \end{RTGrid}  
316
+\end{verbatim}
317
+  \caption{Example with TaskRespTime}
318
+  \label{fig:resp-time}
319
+\end{figure}
320
+
321
+
322
+\subsection{Controlling visualization}
323
+
324
+It is possible to specify many options in the \texttt{RTGrid}
325
+environment.  Maybe you don't like the grid: then, you can decide to
326
+not visualise it as in Figure \ref{fig:ex2}, where we also removed the
327
+task symbols.
328
+\begin{figure}[h]
329
+  \centering
330
+  %% no grid and no symbols
331
+  \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
332
+    \multido{\n=0+4}{5}{         
333
+      \TaskArrDead{1}{\n}{4}    
334
+      \TaskExecDelta{1}{\n}{1}}
335
+    \multido{\n=0+6}{3}{         
336
+        \TaskArrDead{2}{\n}{6}}
337
+    \TaskExecution{2}{1}{4}
338
+    \TaskExecution{2}{6}{8}
339
+    \TaskExecution{2}{9}{10}
340
+    \TaskExecution{2}{13}{16}        
341
+  \end{RTGrid}
342
+\begin{verbatim}
343
+  %% no grid and no symbols
344
+  \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
345
+    \multido{\n=0+4}{5}{         
346
+      \TaskArrDead{1}{\n}{4}    
347
+      \TaskExecDelta{1}{\n}{1}}
348
+    \multido{\n=0+6}{3}{         
349
+        \TaskArrDead{2}{\n}{6}}
350
+    \TaskExecution{2}{1}{4}
351
+    \TaskExecution{2}{6}{8}
352
+    \TaskExecution{2}{9}{10}
353
+    \TaskExecution{2}{13}{16}        
354
+  \end{RTGrid}
355
+\end{verbatim}
356
+  \caption{Removing visualization of the grid and of the task names}
357
+  \label{fig:ex2}
358
+\end{figure}
359
+
360
+The next figure \ref{fig:ex2a} uses different task symbols, does not
361
+show the numbers on the time line, and the color of the boxes that
362
+denote the execution of the second instance of the second task are
363
+changed to red. Also, I am changing the width, so the figure looks
364
+smaller.
365
+
366
+\begin{figure}[h]
367
+  \centering
368
+  %% specify 1) no numbers on the time line, 2) a different symbol, 3)
369
+  %% a different size of the symbol (default is 8pt).
370
+  %% Notice that you should not use the math mode in the
371
+  %% specification of the symbol, as the symbol is already used in a
372
+  %% math environment inside the macro
373
+  \begin{RTGrid}[width=8cm,symbol=\gamma,nonumbers=1,labelsize=11pt]{2}{20}
374
+    \multido{\n=0+4}{5}{         
375
+      \TaskArrDead{1}{\n}{4}    
376
+      \TaskExecDelta{1}{\n}{1}}
377
+    \multido{\n=0+6}{3}{         
378
+      \TaskArrDead{2}{\n}{6}    
379
+    }
380
+    %% here, the border changes to cyan, and the fill to white
381
+    \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
382
+    %% the next two boxes are filled with red instead of gray
383
+    \TaskExecution[color=red]{2}{6}{8}
384
+    \TaskExecution[color=red]{2}{9}{10}
385
+    \TaskExecution{2}{13}{16}        
386
+  \end{RTGrid}
387
+
388
+\begin{verbatim}
389
+  %% specify 1) no numbers on the time line, 2) a different symbol, 3)
390
+  %% a different size of the symbol (default is 8pt).
391
+  %% Notice that you should not use the math mode in the
392
+  %% specification of the symbol, as the symbol is already used in a
393
+  %% math environment inside the macro
394
+  \begin{RTGrid}[symbol=\gamma,nonumbers=1,labelsize=11pt]{2}{20}
395
+    \multido{\n=0+4}{5}{         
396
+      \TaskArrDead{1}{\n}{4}    
397
+      \TaskExecDelta{1}{\n}{1}}
398
+    \multido{\n=0+6}{3}{         
399
+      \TaskArrDead{2}{\n}{6}    
400
+    }
401
+    %% here, the border changes to cyan, and the fill to white
402
+    \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
403
+    %% the next two boxes are filled with red instead of gray
404
+    \TaskExecution[color=red]{2}{6}{8}
405
+    \TaskExecution[color=red]{2}{9}{10}
406
+    \TaskExecution{2}{13}{16}        
407
+  \end{RTGrid}
408
+\end{verbatim}
409
+  \caption{Different symbols (with size 11pt), no numbers, a different
410
+    task color}
411
+  \label{fig:ex2a}
412
+\end{figure}
413
+
414
+Do you want to specify an arbitrary symbol at a certain row?
415
+No problem! See the example in Figure \ref{fig:ex2b}. Here we use the command:
416
+\begin{verbatim}
417
+\RowLabel{i}{label}
418
+\end{verbatim}
419
+which writes the \texttt{label} at the specified row (index 1 stays at
420
+the top). Here we show also how to specify an arbitrary starting
421
+number in the time line, using the \texttt{numoffset=12} option.
422
+
423
+\begin{figure}[h]
424
+  \centering
425
+  %% specify 1) no numbers on the time line, 2) number starting from
426
+  %% 12
427
+  \begin{RTGrid}[nosymbols=1,numoffset=12]{2}{20}
428
+    %% the symbol for the first row
429
+    \RowLabel{1}{Server}
430
+    %% the symbol for the second row
431
+    \RowLabel{2}{$\Pi_2$}
432
+    \multido{\n=0+4}{5}{         
433
+      \TaskArrDead{1}{\n}{4}    
434
+      \TaskExecDelta{1}{\n}{1}}
435
+    \multido{\n=0+6}{3}{         
436
+      \TaskArrDead{2}{\n}{6}
437
+    }
438
+    \TaskExecution{2}{1}{4}
439
+    \TaskExecution{2}{6}{8}
440
+    \TaskExecution{2}{9}{10}
441
+    \TaskExecution{2}{13}{16}        
442
+  \end{RTGrid}
443
+\begin{verbatim}
444
+  %% specify 1) no numbers on the time line, 2) number starting from 12
445
+  \begin{RTGrid}[nosymbols=1,numoffset=12]{2}{20}
446
+    %% the symbol for the first row
447
+    \RowLabel{1}{Server}
448
+    %% the symbol for the second row
449
+    \RowLabel{2}{$\Pi_2$}
450
+    \multido{\n=0+4}{5}{         
451
+      \TaskArrDead{1}{\n}{4}    
452
+      \TaskExecDelta{1}{\n}{1}}
453
+    \multido{\n=0+6}{3}{         
454
+      \TaskArrDead{2}{\n}{6}
455
+    }
456
+    \TaskExecution{2}{1}{4}
457
+    \TaskExecution{2}{6}{8}
458
+    \TaskExecution{2}{9}{10}
459
+    \TaskExecution{2}{13}{16}        
460
+  \end{RTGrid}
461
+\end{verbatim}
462
+  \caption{Arbitrary symbols with an appropriate offset, no grid, numbering starting from 12}
463
+  \label{fig:ex2b}
464
+\end{figure}
465
+
466
+% In the last example (Figure \ref{fig:ex2c}), we show an empty grid in
467
+% which we specify width and height.
468
+
469
+% \begin{figure}[h]
470
+%   \centering
471
+%   %% 3 tasks, 10 units of time
472
+%   \begin{RTGrid}[width=12cm, height=4cm]{3}{10}
473
+    
474
+%   \end{RTGrid}
475
+
476
+% \begin{verbatim}
477
+%   %% 3 tasks, 10 units of time
478
+%   \begin{RTGrid}[width=12cm, height=4cm]{3}{10}
479
+    
480
+%   \end{RTGrid}
481
+% \end{verbatim}
482
+%   \caption{Empty grid with strange width and height}
483
+%   \label{fig:ex2c}
484
+% \end{figure}
485
+
486
+\subsection{Highlighting and labeling objects}
487
+
488
+Sometimes it may be important to say that one task has caused the
489
+activation of another task. You can use the following command, as
490
+shown in Figure \ref{fig:ex3a}:
491
+\begin{verbatim}
492
+\Activation{i}{t1}{j}{t2}
493
+\end{verbatim}
494
+which draws an arrow from the baseline of task \texttt{i} at time
495
+\texttt{t1} to the baseline of task \texttt{j} at time \texttt{t2}.
496
+Also, you can put an arbitrary label inside a shadow box with the
497
+following command:
498
+\begin{verbatim}
499
+\Label{y}{x}{label}
500
+\end{verbatim}
501
+which draws a boxed label at position \texttt{x,y} in the grid.
502
+
503
+Finally, it is possible to draw a rectangular box with rounded corners
504
+to highlight a portion of the schedule with \texttt{RTBox}:
505
+\begin{verbatim}
506
+\RTBox{t1}{t2}
507
+\end{verbatim}
508
+
509
+\begin{figure}[h]
510
+  \centering
511
+  \begin{RTGrid}{2}{20}
512
+    \RTBox{12}{16}
513
+    \multido{\n=0+6}{4}{
514
+      \TaskArrival{1}{\n}
515
+      \TaskExecDelta{1}{\n}{2}}
516
+    \TaskArrival{2}{10}
517
+    \TaskExecDelta{2}{10}{3}
518
+    \Activation{1}{8}{2}{10}
519
+    \Label{6}{7}{$\delta$}
520
+  \end{RTGrid}
521
+\begin{verbatim}
522
+  \begin{RTGrid}{2}{20}
523
+    \RTBox{12}{16}
524
+    \multido{\n=0+6}{4}{
525
+      \TaskArrival{1}{\n}
526
+      \TaskExecDelta{1}{\n}{2}}
527
+    \TaskArrival{2}{10}
528
+    \TaskExecDelta{2}{10}{3}
529
+    \Activation{1}{8}{2}{10}
530
+    \Label{6}{7}{$\delta$}
531
+  \end{RTGrid}
532
+\end{verbatim}
533
+  \caption{Activation (from one task to another one), and an arbitrary label}
534
+  \label{fig:ex3a}
535
+\end{figure}
536
+
537
+Notice that the order with which the objects are drawn is exactly the
538
+same as the order in which they are specified in the code. For
539
+example, in Figure \ref{fig:ex3a}, the executions of all the tasks are
540
+drawn on top of the box. You can try to move the \texttt{RTBox}
541
+command at the end to see what happens.
542
+
543
+\subsection{Priority Inheritance}
544
+
545
+An example of task locking/unlocking and the use of the Priority
546
+Inheritance Protocol is shown in Figure \ref{fig:pi}. Here, task
547
+$\tau_3$ locks resource $S$ at time $t=2$. This is obtained by using
548
+command:
549
+\begin{verbatim}
550
+\TaskLock{3}{2}{S}
551
+\end{verbatim}
552
+Unlock is similarly obtained by using command: 
553
+\begin{verbatim}
554
+\TaskUnlock{3}{7}{S}
555
+\end{verbatim}
556
+
557
+Task $\tau_1$ tries to lock the same resource at time $t=5$. The
558
+priority of $\tau_1$ is then inherited by $\tau_3$: the inheritance
559
+rule is depicted by using a dashed tick arrow from the baseline of
560
+$\tau_1$ to $\tau_3$, using command:
561
+\begin{verbatim}
562
+\Inherit{1}{3}{4}
563
+\end{verbatim}
564
+The fact that $\tau_3$ is executing inside a critical section is
565
+denoted by putting a label inside the execution block, using the
566
+following command:
567
+\begin{verbatim}
568
+\TaskExecution[color=white,execlabel=S]{3}{4}{5}
569
+\end{verbatim}
570
+
571
+\begin{figure}
572
+  \centering
573
+  \begin{RTGrid}[width=12cm]{3}{25}
574
+    \TaskArrDead{3}{0}{20}
575
+    \TaskExecution{3}{0}{2}
576
+    \TaskLock{3}{2}{S}
577
+    \TaskExecution[color=white,execlabel=S]{3}{2}{3}
578
+    \TaskArrDead{1}{3}{9}  
579
+    \TaskExecution{1}{3}{4}
580
+    \TaskLock{1}{4}{S}
581
+    \Inherit{1}{3}{4}
582
+    \TaskExecution[color=white,execlabel=S]{3}{4}{5}
583
+    \TaskArrDead{2}{5}{12}
584
+    \TaskExecution[color=white,execlabel=S]{3}{5}{7}
585
+    \TaskUnlock{3}{7}{S}
586
+    \TaskExecution[color=white,execlabel=S]{1}{7}{9}
587
+    \TaskUnlock{1}{9}{S}
588
+    \TaskExecution{1}{9}{10}
589
+    \TaskExecution{2}{10}{15}
590
+    \TaskExecution{3}{15}{17}
591
+  \end{RTGrid}
592
+  \caption{Task blocking on resources: the Priority Inheritance Protocol}
593
+  \label{fig:pi}
594
+\begin{verbatim}
595
+  \begin{RTGrid}[width=12cm]{3}{25}
596
+    \TaskArrDead{3}{0}{20}
597
+    \TaskExecution{3}{0}{2}
598
+    \TaskLock{3}{2}{S}
599
+    \TaskExecution[color=white,execlabel=S]{3}{2}{3}
600
+    \TaskArrDead{1}{3}{9}  
601
+    \TaskExecution{1}{3}{4}
602
+    \TaskLock{1}{4}{S}
603
+    \Inherit{1}{3}{4}
604
+    \TaskExecution[color=white,execlabel=S]{3}{4}{5}
605
+    \TaskArrDead{2}{5}{12}
606
+    \TaskExecution[color=white,execlabel=S]{3}{5}{7}
607
+    \TaskUnlock{3}{7}{S}
608
+    \TaskExecution[color=white,execlabel=S]{1}{7}{9}
609
+    \TaskUnlock{1}{9}{S}
610
+    \TaskExecution{1}{9}{10}
611
+    \TaskExecution{2}{10}{15}
612
+    \TaskExecution{3}{15}{17}
613
+    \end{RTGrid}
614
+\end{verbatim}
615
+  \caption{Priority Inheritance example}
616
+  \label{fig:ex4}
617
+\end{figure}
618
+
619
+\end{document}
620
+%%% Local Variables: 
621
+%%% mode: latex
622
+%%% TeX-master: t
623
+%%% End: 

+ 469
- 0
rtsched.sty View File

@@ -0,0 +1,469 @@
1
+\NeedsTeXFormat{LaTeX2e}[1995/12/01]
2
+\ProvidesPackage{rtsched}[2005/01/01]
3
+\typeout{'rtsched' style for Latex and PSTricks}
4
+\typeout{Easily draw real-time schedules in TeX/Latex.}
5
+\typeout{(c) 2005, Giuseppe Lipari, Pisa, Italy (g.lipari@sssup.it)}
6
+\typeout{Version 1.0}
7
+
8
+\RequirePackage{multido}
9
+\RequirePackage{pstricks}
10
+\RequirePackage{keyval}
11
+
12
+%%
13
+%% These can be changed at any time
14
+%% 
15
+\def\RTWindowLength{10cm}    % window length
16
+\def\RTWindowHeight{0cm}     % window height
17
+\def\RTNullWindowHeight{0cm} % nullwindow height
18
+\def\RTTaskLabelSize{10pt}   % Size in pt of the task label
19
+\def\RTNumberLabelSize{10pt} % Size in pt of the number labels
20
+\def\RTDefTaskSymbol{\tau}
21
+\def\RTDefNumberOffset{0}
22
+\def\RTDefTaskFill{solid}
23
+\def\RTDefTaskColor{gray}
24
+\def\RTDefLineColor{black}
25
+\def\RTDefXScale{1}
26
+\def\RTDefWriteSymbols{0}
27
+\def\RTDefGridInvisible{0}
28
+\def\RTDefNumbersInvisible{0}
29
+\def\RTDefRowLabelOffset{0pt}
30
+
31
+\def\RTExecLabel{\ }
32
+\def\RTTaskSymbol{\RTDefTaskSymbol}
33
+\def\RTTaskFill{\RTDefTaskFill}
34
+\def\RTTaskColor{\RTDefTaskColor}
35
+\def\RTLineColor{\RTDefLineColor}
36
+\def\RTXScale{\RTDefXScale}
37
+\def\RTWriteSymbols{\RTDefWriteSymbols}
38
+\def\RTNumberOffset{\RTDefNumberOffset}
39
+\def\RTNumberOffset{\RTDefNumberOffset}
40
+\def\RTGridInvisible{\RTDefGridInvisible}
41
+\def\RTNumbersInvisible{\RTDefGridInvisible}
42
+\def\RTRowLabelOffset{\RTDefRowLabelOffset}
43
+
44
+\define@key{RT}{height}[\RTNullWindowHeight]{\def\RTWindowHeight{#1}}
45
+\define@key{RT}{width}[10cm]{\def\RTWindowLength{#1}}
46
+\define@key{RT}{labelsize}[10pt]{\def\RTTaskLabelSize{#1}}
47
+\define@key{RT}{numbersize}[10pt]{\def\RTNumberLabelSize{#1}}
48
+\define@key{RT}{color}[\RTDefTaskColor]{\def\RTTaskColor{#1}}
49
+\define@key{RT}{linecolor}[\RTDefLineColor]{\def\RTLineColor{#1}}
50
+\define@key{RT}{execlabel}[\ ]{\def\RTExecLabel{#1}}
51
+\define@key{RT}{fillstyle}[\RTDefTaskFill]{\def\RTTaskFill{#1}}
52
+\define@key{RT}{nocommand}{}
53
+\define@key{RT}{xscale}[\RTDefXScale]{\def\RTXScale{#1}}
54
+\define@key{RT}{symbol}[{\tau}]{\def\RTTaskSymbol{#1}}
55
+\define@key{RT}{nosymbols}[\RTDefWriteSymbols]{\def\RTWriteSymbols{#1}}
56
+\define@key{RT}{numoffset}[\RTDefNumberOffset]{\def\RTNumberOffset{#1}}
57
+\define@key{RT}{nogrid}[\RTDefGridInvisible]{\def\RTGridInvisible{#1}}
58
+\define@key{RT}{nonumbers}[\RTDefNumbersInvisible]{\def\RTNumbersInvisible{#1}}
59
+\define@key{RT}{labeloffset}[\RTDefRowLabelOffset]{\def\RTRowLabelOffset{#1}}
60
+
61
+
62
+%%
63
+%% temporaries
64
+\newdimen\sx % slot length
65
+\newdimen\sy % slot height
66
+\newdimen\hy % frame height
67
+\newdimen\xx % x position
68
+\newdimen\yy % y position
69
+\newdimen\xxx % x position
70
+\newdimen\yyy % y position
71
+\newcount\nsx % number of horizontal slots
72
+\newcount\nsy % number of vertical slots
73
+\newcount\nhl % number of horizonatal lines
74
+\newcount\nvl % number of vertical lines
75
+\newcount\tmp % temp
76
+
77
+\newcounter{myLabel}
78
+
79
+\def\RTGrid{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
80
+
81
+\def\RTGridBegin{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
82
+\def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
83
+  %% number of horizontal steps in the grid
84
+  \nsx = #3 \advance \nsx by 2 %
85
+  %% real lenght of the window (approx)
86
+  \nvl = \nsx \advance \nvl by 1 %
87
+  %% compute lenght of a step
88
+  \sx = \RTWindowLength \divide \sx by \nsx %
89
+  %% number of vertical steps in the grid
90
+  \nsy = #2 \multiply \nsy by 3 \advance \nsy by 1 %
91
+  %% compute lenght of a vertical step (if height is null, \sy is the
92
+  %% same as \sx)
93
+  \ifx\RTWindowHeight\RTNullWindowHeight%
94
+    \sy = \sx%
95
+    \hy = \sy \multiply \hy by \nsy \advance \hy by \sy%
96
+  \else 
97
+    \sy = \RTWindowHeight \divide \sy by \nsy %
98
+    \hy = \RTWindowHeight \advance \hy by \sy %
99
+  \fi
100
+  %% compute real height
101
+  \nhl = \nsy \advance \nhl by 1 %
102
+  \advance \nsy by -1 \advance \nsx by -1
103
+  %% the picture
104
+  \begin{pspicture}(0,0)(\RTWindowLength,\hy) %
105
+    %% draw grid (if not invisible)
106
+    \if\RTGridInvisible\RTDefGridInvisible
107
+      \multips(0,\sy)(0,\sy){\nsy}{\psline[linecolor=lightgray]{-}(0,\sy)(\RTWindowLength,\sy)}%
108
+      \multips(\sx,0)(\sx,0){\nsx}{\psline[linecolor=lightgray]{-}(0,\sy)(0,\hy)}%
109
+      \psframe(0,\sy)(\RTWindowLength,\hy)%
110
+    \else\relax
111
+    \fi
112
+    %% draw numbers (if not invisible)
113
+    \if\RTNumbersInvisible\RTDefNumbersInvisible
114
+      \tmp = #3 \divide \tmp by 2 \advance \tmp by 1%
115
+      \pssetlength{\xx}{\sx}%
116
+      \setcounter{myLabel}{\RTNumberOffset}
117
+      \multido{\n=0+1}{\tmp}{%
118
+        \uput{4pt}[d](\xx,\sy){%
119
+          \usefont{T1}{phv}{m}{n}%
120
+          \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
121
+          \selectfont{\arabic{myLabel}}}%
122
+        \psaddtolength{\xx}{\sx}%
123
+        \psaddtolength{\xx}{\sx}%
124
+        \addtocounter{myLabel}{2}
125
+      }
126
+    \else\relax
127
+    \fi
128
+    % 
129
+    %% Task Names
130
+    \setcounter{myLabel}{1}
131
+    \pssetlength{\yy}{\hy}%
132
+    \psaddtolength{\yy}{-\sy}
133
+    \multido{\n=0+1}{#2}{%
134
+      \uput{4pt}[d](-\sx,\yy){
135
+        \usefont{T1}{phv}{m}{n}
136
+        \fontsize{\RTTaskLabelSize}{\RTTaskLabelSize}
137
+        \if\RTWriteSymbols\RTDefWriteSymbols\selectfont{$\RTTaskSymbol_{\arabic{myLabel}}$}
138
+          \else\relax
139
+        \fi
140
+      }%
141
+      \psaddtolength{\yy}{-3\sy}%
142
+      \addtocounter{myLabel}{1}
143
+    }%    
144
+    %% Horizontal axes
145
+    \xx = \sx \xxx = \RTWindowLength \advance \xxx by -\sx
146
+    \yy = 2\sy 
147
+    \multido{\n=0+1}{#2}{
148
+      \psline{->}(\xx,\yy)(\xxx,\yy)
149
+      \advance \yy by 3\sy
150
+    }
151
+}
152
+
153
+
154
+\def\@RTDefaultValues{%
155
+  \setkeys{RT}{height}%
156
+  \setkeys{RT}{width}%
157
+  \setkeys{RT}{labelsize}%
158
+  \setkeys{RT}{numbersize}%
159
+  \setkeys{RT}{symbol}%
160
+  \setkeys{RT}{fillstyle}%
161
+  \setkeys{RT}{color}
162
+  \setkeys{RT}{linecolor}%
163
+  \setkeys{RT}{xscale}%
164
+  \setkeys{RT}{nosymbols}%
165
+}
166
+
167
+\def\@RTExecDefaultValues{
168
+  \setkeys{RT}{color}%
169
+  \setkeys{RT}{execlabel}%
170
+  \setkeys{RT}{linecolor}%
171
+}
172
+
173
+\def\RTGridEnd{
174
+    \end{pspicture}%
175
+    \@RTDefaultValues%
176
+}
177
+
178
+\def\endRTGrid{
179
+    \end{pspicture}%
180
+    \@RTDefaultValues%
181
+}
182
+
183
+\newcommand{\RTSet}[1]{
184
+  \setkeys{RT}{#1}
185
+}
186
+
187
+\newcommand{\RTSetDefault}{
188
+  \@RTDefaultValues
189
+}
190
+
191
+%% internal
192
+\newcommand{\@compute@xx}[1]{
193
+  \xx = #1\sx
194
+  \divide \xx by \RTXScale
195
+  \advance \xx by \sx
196
+}
197
+
198
+\newcommand{\@compute@xxx}[1]{
199
+  \xxx = #1\sx
200
+  \divide \xxx by \RTXScale
201
+  \advance \xxx by \sx
202
+}
203
+
204
+\newcommand{\@compute@yy}[1]{
205
+  \yy = -3\sy \multiply \yy by #1
206
+  \advance \yy by \hy
207
+}
208
+
209
+
210
+%% Task Arrival: draws an up arrow at the specified slot
211
+%% #1  : task number from 1 to n
212
+%% #2  : slot number from 0 to l-1
213
+\newcommand{\TaskArrival}[3][nocommand=1]{%
214
+    \setkeys{RT}{#1}%
215
+    \@compute@yy{#2}
216
+    \@compute@xx{#3}
217
+    \yyy = \yy \advance \yyy by 2\sy%
218
+    \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xx,\yyy)%
219
+    \@RTExecDefaultValues%
220
+}
221
+
222
+%% Task Arrival and deadline: draws an up arrow and a down arrow at the specified slots
223
+%% #1  : task number from 1 to n
224
+%% #2  : slot number from 0 to l-1
225
+%% #3  : relative deadline
226
+\newcommand{\TaskArrDead}[4][nocommand=1]{
227
+  \setkeys{RT}{#1}%
228
+  \@compute@yy{#2}
229
+  \@compute@xx{#3}
230
+  \yyy = \yy \advance \yyy by 2\sy
231
+  \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xx,\yyy)
232
+  \advance \xx by #4\sx
233
+  \psline[linecolor=\RTLineColor]{->}(\xx,\yyy)(\xx,\yy)
234
+  \@RTExecDefaultValues
235
+}
236
+
237
+
238
+%% Task Deadline: draws a down arrow at the specified slot
239
+%% #1  : task number from 1 to n
240
+%% #2  : slot number from 0 to l-1
241
+\newcommand{\TaskDeadline}[3][nocommand=1]{
242
+  \setkeys{RT}{#1}%
243
+  \@compute@yy{#2}
244
+  \@compute@xx{#3}
245
+  \yyy = \yy \advance \yyy by 2\sy
246
+  \psline[linecolor=\RTLineColor]{<-}(\xx,\yy)(\xx,\yyy)
247
+  \@RTExecDefaultValues
248
+}
249
+
250
+\newcommand{\TaskExecution}[4][nocommand=1]{
251
+  \setkeys{RT}{#1}%
252
+  \@compute@yy{#2}
253
+  \@compute@xx{#3}
254
+  \yyy = \yy \advance \yyy by \sy
255
+  \@compute@xxx{#4}
256
+  \psframe[fillstyle=\RTTaskFill,fillcolor=\RTTaskColor,linecolor=\RTLineColor](\xx,\yy)(\xxx,\yyy)
257
+  \advance \xx by \xxx \xx = .5\xx
258
+  \uput{2pt}[u](\xx,\yy){%
259
+    \usefont{T1}{phv}{m}{n}%
260
+    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
261
+    \selectfont{\RTExecLabel}%
262
+  }
263
+  \@RTExecDefaultValues
264
+}
265
+
266
+% Task Lock
267
+% par 1:  task 
268
+% par 2:  time
269
+% par 3:  resource
270
+%
271
+\newcommand{\TaskLock}[4][nocommand=1]{
272
+  \setkeys{RT}{#1}%
273
+  \@compute@yy{#2}
274
+  \@compute@xx{#3}
275
+  \yyy = \yy \advance \yyy by \sy
276
+  \uput{2pt}[u](\xx,\yyy){%
277
+    \usefont{T1}{phv}{m}{n}%
278
+    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
279
+    \selectfont{L(#4)}%
280
+  }
281
+  \@RTExecDefaultValues
282
+}
283
+
284
+% \TaskUnlock
285
+% par 1:  task 
286
+% par 2:  time
287
+% par 3:  resource
288
+%
289
+\newcommand{\TaskUnlock}[4][nocommand=1]{
290
+  \setkeys{RT}{#1}%
291
+  \@compute@yy{#2}
292
+  \@compute@xx{#3}
293
+  \yyy = \yy \advance \yyy by \sy
294
+  \uput{2pt}[u](\xx,\yyy){%
295
+    \usefont{T1}{phv}{m}{n}%
296
+    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
297
+    \selectfont{U(#4)}%
298
+  }
299
+  \@RTExecDefaultValues
300
+}
301
+
302
+% 
303
+% par 1:  number of vertical slot 
304
+% par 2:  time
305
+% par 3:  label
306
+%
307
+\newcommand{\Label}[4][nocommand=1]{
308
+  \setkeys{RT}{#1}%
309
+  %\@compute@yy{#2}
310
+  \@compute@xx{#3}
311
+  \yy = -\sy \multiply \yy by #2
312
+  \advance \yy by \hy
313
+  \yyy = \yy \advance \yyy by \sy
314
+  \uput{2pt}[u](\xx,\yyy){%
315
+    \psshadowbox{
316
+      \usefont{T1}{phv}{m}{n}%
317
+      \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
318
+      \selectfont{{#4}}}%
319
+  }
320
+  \@RTExecDefaultValues
321
+}
322
+
323
+% 
324
+% par 1:  higher priority task (from) 
325
+% par 2:  lower priority task (to)
326
+% par 3:  time
327
+%
328
+\newcommand{\Inherit}[4][nocommand=1]{
329
+  \setkeys{RT}{#1}%
330
+  \@compute@yy{#2}
331
+  \@compute@xx{#4}
332
+  \yyy = -3\sy \multiply \yyy by #3 \advance \yyy by \sy
333
+  \advance \yyy by \hy \advance \yyy by -\sy % \RTWindowHeight
334
+  \psline[linestyle=dashed,linewidth=1.5pt]{->}(\xx,\yy)(\xx,\yyy)
335
+  \@RTExecDefaultValues
336
+}
337
+
338
+% 
339
+% par 1:  activating task (from) 
340
+% par 2:  signal start time 
341
+% par 3:  activated task (to)
342
+% par 4:  signal arrival time
343
+%
344
+\newcommand{\Activation}[5][nocommand=1]{
345
+  \setkeys{RT}{#1}%
346
+  \@compute@yy{#2}
347
+  \@compute@xx{#3}
348
+  \yyy = -3\sy \multiply \yyy by #4 %\advance \yyy by \sy
349
+  \advance \yyy by \hy %\advance \yyy by -\sy %\RTWindowHeight
350
+  \xxx = #5\sx \advance \xxx by \sx
351
+  \psline[linestyle=dashed,linewidth=1pt]{->}(\xx,\yy)(\xxx,\yyy)
352
+}
353
+
354
+% 
355
+% par 1:  time1
356
+% par 2:  time2
357
+%
358
+\newcommand{\RTBox}[3][nocommand=1]{
359
+  \setkeys{RT}{#1}%
360
+  \yy = 0cm
361
+  \advance \yy by \hy
362
+  \yyy = \sy
363
+  \@compute@xx{#2}
364
+  \@compute@xxx{#3}
365
+  \psframe[fillstyle=crosshatch,hatchwidth=.2pt,hatchsep=2pt,hatchcolor=lightgray,linewidth=0pt,framearc=.2](\xx,\yy)(\xxx,\yyy)
366
+  \@RTExecDefaultValues
367
+}
368
+
369
+% %
370
+% % par 1: task
371
+% % par 2: first instant (arrival)
372
+% % par 3: second instant (deadline)
373
+% %
374
+% \newcommand{\Interval}[4][nocommand=1]{
375
+%   \setkeys{RT}{#1}%
376
+%   \@compute@yy{#2}
377
+%   \advance \yy by 2.5\sy
378
+%   \@compute@xx{#3}
379
+%   \@compute@xxx{#4}
380
+%   % da cambiare con psarc
381
+%   \pscurve*[linecolor=\RTLineColor]{-}(\xx,\yy)(\xxx,\yy)
382
+%   \@RTExecDefaultValues  
383
+% }
384
+
385
+\newcommand{\RowLabel}[3][nocommand=1]{
386
+  \setkeys{RT}{#1}%
387
+  \@compute@yy{#2}
388
+  \advance \yy by 1.5\sy
389
+  \xx = \RTRowLabelOffset %\advance \xx by \sx
390
+  \uput{4pt}[dl](-\xx,\yy){
391
+    \usefont{T1}{phv}{m}{n}
392
+    \fontsize{\RTTaskLabelSize}{\RTTaskLabelSize}
393
+    \selectfont{#3}
394
+  }%
395
+}
396
+
397
+\newcommand{\TaskExecDelta}[4][nocommand=1]{
398
+  \setkeys{RT}{#1}%
399
+  \@compute@yy{#2}
400
+  \@compute@xx{#3}
401
+  \yyy = \yy \advance \yyy by \sy
402
+  %\@compute@xxx{#4}
403
+  \xxx = \xx \advance \xxx by #4\sx
404
+  \psframe[fillstyle=\RTTaskFill,fillcolor=\RTTaskColor,linecolor=\RTLineColor](\xx,\yy)(\xxx,\yyy)
405
+  \advance \xx by \xxx \xx = .5\xx
406
+  \uput{2pt}[u](\xx,\yy){%
407
+    \usefont{T1}{phv}{m}{n}%
408
+    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
409
+    \selectfont{\RTExecLabel}%
410
+  }
411
+  \@RTExecDefaultValues
412
+}
413
+
414
+\newcommand{\TaskRespTime}[4][nocommand=1]{
415
+  \setkeys{RT}{#1}
416
+  \@compute@yy{#2}
417
+  \@compute@xx{#3}
418
+  \yyy = \yy \advance \yyy by \sy  
419
+  \xxx = \xx \advance \xxx by #4\sx
420
+  \psframe[fillstyle=crosshatch*,hatchcolor=white,
421
+  hatchwidth=.4pt,hatchsep=1pt,
422
+  linestyle=none,fillcolor=\RTTaskColor](\xx,\yy)(\xxx,\yyy)
423
+  \@RTExecDefaultValues
424
+}
425
+
426
+\@ifclassloaded{beamer}{
427
+  \renewcommand<>{\TaskArrival}[3][nocommand=1]{
428
+    \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
429
+  }
430
+  \renewcommand<>{\TaskArrDead}[4][nocommand=1]{
431
+    \only#5{\beameroriginal{\TaskArrDead}[#1]{#2}{#3}{#4}}
432
+  }
433
+  \renewcommand<>{\TaskDeadline}[3][nocommand=1]{
434
+    \only#4{\beameroriginal{\TaskDeadline}[#1]{#2}{#3}}
435
+  }
436
+  \renewcommand<>{\TaskExecution}[4][nocommand=1]{
437
+    \only#5{\beameroriginal{\TaskExecution}[#1]{#2}{#3}{#4}}
438
+  }
439
+  \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
440
+    \only#5{\beameroriginal{\TaskExecDelta}[#1]{#2}{#3}{#4}}
441
+  }
442
+  \renewcommand<>{\TaskRespTime}[4][nocommand=1]{
443
+    \only#5{\beameroriginal{\TaskRespTime}[#1]{#2}{#3}{#4}}
444
+  }
445
+  \renewcommand<>{\TaskLock}[4][nocommand=1]{
446
+    \only#5{\beameroriginal{\TaskLock}[#1]{#2}{#3}{#4}}
447
+  }
448
+  \renewcommand<>{\TaskUnlock}[4][nocommand=1]{
449
+    \only#5{\beameroriginal{\TaskUnlock}[#1]{#2}{#3}{#4}}
450
+  }
451
+  \renewcommand<>{\Label}[4][nocommand=1]{
452
+    \only#5{\beameroriginal{\Label}[#1]{#2}{#3}{#4}}
453
+  }
454
+  \renewcommand<>{\Inherit}[4][nocommand=1]{
455
+    \only#5{\beameroriginal{\Inherit}[#1]{#2}{#3}{#4}}
456
+  }
457
+  \renewcommand<>{\Activation}[5][nocommand=1]{
458
+    \only#6{\beameroriginal{\Activation}[#1]{#2}{#3}{#4}{#5}}
459
+  }
460
+  \renewcommand<>{\RTBox}[3][nocommand=1]{
461
+    \only#4{\beameroriginal{\RTBox}[#1]{#2}{#3}}
462
+  }  
463
+}
464
+{
465
+  \typeout{beamer not loaded}
466
+}
467
+
468
+\endinput
469
+

Loading…
Cancel
Save