Browse Source

Merge branch 'addPointAtEnd'

Conflicts:
	rtsched-doc.tex
Antoine Bertout 9 years ago
parent
commit
ddeffdcd45
2 changed files with 142 additions and 8 deletions
  1. 91
    8
      rtsched-doc.tex
  2. 51
    0
      rtsched.sty

+ 91
- 8
rtsched-doc.tex View File

18
 package, which can be used to easily draw chronograms (GANTT charts).
18
 package, which can be used to easily draw chronograms (GANTT charts).
19
 These diagrams are quite common in real-time scheduling research.
19
 These diagrams are quite common in real-time scheduling research.
20
 
20
 
21
-The package depends on keyval and TikZ/PGF (versions 2.10 or greater), both widely
22
-available on any \TeX distribution.
21
+
22
+The package depends on keyval and TikZ/PGF (pgf version 2.10 or greater), both widely available on any \TeX distribution.
23
 
23
 
24
 The drawing capabilities are completely based on TikZ. Thus, you can compile
24
 The drawing capabilities are completely based on TikZ. Thus, you can compile
25
  a document that uses \texttt{rtsched} package with modern tools producing pdf document
25
  a document that uses \texttt{rtsched} package with modern tools producing pdf document
88
  \verb+\TaskDeadline{i}{t}+ & \verb+\TaskNDeadline{i}{t}{p}{n}+ \\
88
  \verb+\TaskDeadline{i}{t}+ & \verb+\TaskNDeadline{i}{t}{p}{n}+ \\
89
  \verb+\TaskArrDeadl{i}{t}{reld}+ & \verb+\TaskNArrDeadl{i}{t}{reld}{p}{n}+  \\
89
  \verb+\TaskArrDeadl{i}{t}{reld}+ & \verb+\TaskNArrDeadl{i}{t}{reld}{p}{n}+  \\
90
  \verb+\TaskExecDelta{i}{t}{delta}+ & \verb+\TaskNExecDelta{i}{t}{delta}{p}{n}+\\
90
  \verb+\TaskExecDelta{i}{t}{delta}+ & \verb+\TaskNExecDelta{i}{t}{delta}{p}{n}+\\
91
+ \verb+\TaskEnd{i}{t}+ & \verb+\TaskNEnd{i}{t}{p}{n}+\\
92
+
91
   \hline
93
   \hline
92
 \end{tabular}
94
 \end{tabular}
93
 \caption{Table of periodic commands where p stands for the period and n for the number of instances}
95
 \caption{Table of periodic commands where p stands for the period and n for the number of instances}
185
     \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
187
     \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
186
     \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
188
     \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
187
                                     % for 5 instances of period 4 
189
                                     % for 5 instances of period 4 
190
+                                    
191
+    \TaskNEnd{1}{1}{4}{5}	       % draws 5 ends of job execution of period 4
192
+
188
 
193
 
189
                                     % draws the arrival and deadline
194
                                     % draws the arrival and deadline
190
     \TaskNArrDead{2}{0}{6}{6}{3}    % for 3 instances of period 6 
195
     \TaskNArrDead{2}{0}{6}{6}{3}    % for 3 instances of period 6 
193
     \TaskExecution{2}{1}{4}
198
     \TaskExecution{2}{1}{4}
194
     \TaskExecution{2}{6}{8}
199
     \TaskExecution{2}{6}{8}
195
     \TaskExecution{2}{9}{10}
200
     \TaskExecution{2}{9}{10}
196
-    \TaskExecution{2}{13}{16}    
201
+    \TaskExecution{2}{13}{16} 
202
+    \TaskEnd{2}{4}
203
+    \TaskEnd{2}{10}
204
+    \TaskEnd{2}{16}   
197
   \end{RTGrid}
205
   \end{RTGrid}
198
 
206
 
199
 \begin{verbatim}
207
 \begin{verbatim}
202
     \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
210
     \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
203
     \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
211
     \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
204
                                     % for 5 instances of period 4 
212
                                     % for 5 instances of period 4 
213
+                                    
214
+    \TaskNEnd{1}{1}{4}{5}           % draws 5 ends of job execution of period 4
205
 
215
 
206
    	\TaskNArrDead{2}{0}{6}{6}{3}    % draws the arrival and deadline
216
    	\TaskNArrDead{2}{0}{6}{6}{3}    % draws the arrival and deadline
207
                                     % for 3 instances of period 6 
217
                                     % for 3 instances of period 6 
218
+	    
208
     
219
     
209
     % no simple formula for lowest priority, sorry!
220
     % no simple formula for lowest priority, sorry!
210
     \TaskExecution{2}{1}{4}
221
     \TaskExecution{2}{1}{4}
211
     \TaskExecution{2}{6}{8}
222
     \TaskExecution{2}{6}{8}
212
     \TaskExecution{2}{9}{10}
223
     \TaskExecution{2}{9}{10}
213
-    \TaskExecution{2}{13}{16}    
224
+    \TaskExecution{2}{13}{16} 
225
+    \TaskEnd{2}{4}
226
+    \TaskEnd{2}{10}
227
+    \TaskEnd{2}{16}  
214
   \end{RTGrid}
228
   \end{RTGrid}
215
 \end{verbatim}
229
 \end{verbatim}
216
   \caption{Using periodic commands to avoid repetitions}
230
   \caption{Using periodic commands to avoid repetitions}
288
 style. An example is in Figure~\ref{fig:resp-time} that uses command
302
 style. An example is in Figure~\ref{fig:resp-time} that uses command
289
 \texttt{TaskRespTime}. 
303
 \texttt{TaskRespTime}. 
290
 
304
 
291
-\begin{figure}
305
+\begin{figure}[!htbp]
292
   \centering
306
   \centering
293
   \begin{RTGrid}{2}{20}
307
   \begin{RTGrid}{2}{20}
294
   
308
   
332
   \label{fig:resp-time}
346
   \label{fig:resp-time}
333
 \end{figure}
347
 \end{figure}
334
 
348
 
349
+It is sometimes usefull to represent the end of a job execution, especially when jobs are preempted. In that case, you can use the following command:
350
+
351
+\begin{verbatim}
352
+\TaskEnd{i}{t}
353
+\end{verbatim}
354
+
355
+and its periodic version detailed in Table~\ref{tab:periodic_versions} that draw little circle(s) at the specified date(s). It works in the same way as \verb+\TaskArrival+ command and its us is shown in Figure~\ref{fig:ex1a}.
356
+
357
+
358
+
335
 
359
 
336
 \subsection{Controlling visualization}
360
 \subsection{Controlling visualization}
337
 
361
 
535
 
559
 
536
 Notice that the order with which the objects are drawn is exactly the
560
 Notice that the order with which the objects are drawn is exactly the
537
 same as the order in which they are specified in the code, excepted 
561
 same as the order in which they are specified in the code, excepted 
538
-for horizontal axes, arrivals and deadlines that are always drawn on the foreground.
539
- For example, in Figure \ref{fig:ex3a}, the executions of all the tasks are
562
+for horizontal axes, arrivals, deadlines and end of job execution that are always drawn on the foreground. 
563
+For 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}
564
 drawn on top of the box. You can try to move the \texttt{RTBox}
541
 command at the end to see what happens.
565
 command at the end to see what happens.
542
 
566
 
568
 \TaskExecution[color=white,execlabel=S]{3}{4}{5}
592
 \TaskExecution[color=white,execlabel=S]{3}{4}{5}
569
 \end{verbatim}
593
 \end{verbatim}
570
 
594
 
571
-\begin{figure}
595
+\begin{figure}[!htbp]
572
   \centering
596
   \centering
573
   \begin{RTGrid}[width=12cm]{3}{25}
597
   \begin{RTGrid}[width=12cm]{3}{25}
574
     \TaskArrDead{3}{0}{20}
598
     \TaskArrDead{3}{0}{20}
616
   \label{fig:ex4}
640
   \label{fig:ex4}
617
 \end{figure}
641
 \end{figure}
618
 
642
 
643
+
644
+\subsection{Jitter}
645
+
646
+
647
+Jitter is often represented as an interval drawned by an horizontal double arrowhead. As shown in the Figure~\ref{fig:interval}, you can define jitter or any other interval with the following command:
648
+
649
+\begin{verbatim}
650
+\TaskInterval{i}{t1}{t2}{label}
651
+\end{verbatim}
652
+
653
+This command draws an horizontal double arrowhead for the \texttt{i}-th task from \texttt{t1} to \texttt{t2} with the specified \texttt{label} in the middle.
654
+
655
+\begin{figure}[!htbp]
656
+  \centering
657
+  \begin{RTGrid}[nogrid=1, nosymbols=1 ,nonumbers=1]{3}{20}
658
+  
659
+    \RowLabel{1}{$\tau_i$}
660
+    \TaskArrival{1}{0}            
661
+    \TaskExecution{1}{1}{4}             
662
+    \TaskDeadline{1}{7}           
663
+
664
+    \RowLabel{2}{msg}
665
+    \TaskArrival{2}{0}              
666
+    \TaskExecution{2}{4}{6}             
667
+    \TaskDeadline{2}{8}            
668
+    \TaskInterval{2}{0}{4}{$J_m$}  % draws an interval between date 0 and 4 for task 2 with a label J_m 
669
+
670
+    \RowLabel{3}{$\tau_j$}
671
+    \TaskArrival{3}{0}             
672
+    \TaskExecution{3}{6}{9}             
673
+    \TaskDeadline{3}{10}          
674
+    \TaskInterval{3}{0}{6}{$J_j$} % draws an interval between date 0 and 6 for task 3 with a label J_j 
675
+  \end{RTGrid}  
676
+\begin{verbatim}
677
+  \begin{RTGrid}[nogrid=1, nosymbols=1 ,nonumbers=1]{3}{20}
678
+  
679
+    \RowLabel{1}{$\tau_i$}
680
+    \TaskArrival{1}{0}            
681
+    \TaskExecution{1}{1}{4}             
682
+    \TaskDeadline{1}{7}           
683
+
684
+    \RowLabel{2}{msg}
685
+    \TaskArrival{2}{0}              
686
+    \TaskExecution{2}{4}{6}             
687
+    \TaskDeadline{2}{8}            
688
+    \TaskInterval{2}{0}{4}{$J_m$}  % draws an interval between date 0 and 4 for task 2 with a label J_m 
689
+
690
+    \RowLabel{3}{$\tau_j$}
691
+    \TaskArrival{3}{0}             
692
+    \TaskExecution{3}{6}{9}             
693
+    \TaskDeadline{3}{10}          
694
+    \TaskInterval{3}{0}{6}{$J_j$} % draws an interval between date 0 and 6 for task 3 with a label J_j 
695
+  \end{RTGrid}  
696
+\end{verbatim}
697
+  \caption{Example with TaskInterval used to represent jitters}
698
+  \label{fig:interval}
699
+\end{figure}
700
+
701
+
619
 \end{document}
702
 \end{document}
620
 %%% Local Variables: 
703
 %%% Local Variables: 
621
 %%% mode: latex
704
 %%% mode: latex

+ 51
- 0
rtsched.sty View File

28
 \usetikzlibrary{shadows, patterns}
28
 \usetikzlibrary{shadows, patterns}
29
 \RequirePackage{keyval}
29
 \RequirePackage{keyval}
30
 \newcommand\rtfont{\usefont{T1}{phv}{m}{n}}
30
 \newcommand\rtfont{\usefont{T1}{phv}{m}{n}}
31
+\@ifpackagelater{pgf}{2008/01/15}
32
+{
33
+ %pgf package date is 2008/01/15 or later
34
+}
35
+{
36
+ %pgf package date is older than 2008/01/15
37
+\PackageError{rtsched}{%
38
+rtsched requires version 2.10 of pgf or greater\MessageBreak
31
 
39
 
40
+}{%
41
+Please update pgf to version 2.10 minimum!\MessageBreak
42
+\space \space Try typing \space \protect\pgfversion
43
+\space to print your current version of pgf.
44
+}
45
+}
32
 
46
 
33
 %%
47
 %%
34
 %% These can be changed at any time
48
 %% These can be changed at any time
510
 \@RTExecDefaultValues
524
 \@RTExecDefaultValues
511
 
525
 
512
 }
526
 }
527
+
528
+% TaskEnd
529
+% Task end: draws a circle when the job terminates
530
+% par 1: task number from 1 to n
531
+% par 2: slot number from 0 to l-1
532
+\newcommand{\TaskEnd}[3][nocommand=1]{%
533
+  \setkeys{RT}{#1}%
534
+  \@compute@yy{#2}
535
+  \@compute@xx{#3}
536
+  \yyy = \yy \advance \yyy by 2\sy%
537
+  \begin{pgfonlayer}{foreground} 
538
+  \draw[fill] (\xx,\yy) circle (1.5pt);
539
+  \end{pgfonlayer}
540
+  \@RTExecDefaultValues%
541
+}
542
+
543
+%
544
+% TaskNEnd
545
+% Task ends: draws periodically a circle when the job terminates
546
+% par 1  : task number from 1 to n
547
+% par 2  : slot number from 0 to l-1
548
+% par 3  : period
549
+% par 4  : number of instances
550
+\newcommand{\TaskNEnd}[5][nocommand=1]{%
551
+ \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
552
+ \TaskEnd[#1]{#2}{\activation}{#4}
553
+ }
554
+}
555
+
556
+
557
+
513
 %% %
558
 %% %
514
 % % par 1: task
559
 % % par 1: task
515
 % % par 2: first instant (arrival)
560
 % % par 2: first instant (arrival)
649
   \renewcommand<>{\TaskInterval}[5][nocommand=1]{
694
   \renewcommand<>{\TaskInterval}[5][nocommand=1]{
650
     \only#6{\beameroriginal{\TaskInterval}[#1]{#2}{#3}{#4}{#5}}
695
     \only#6{\beameroriginal{\TaskInterval}[#1]{#2}{#3}{#4}{#5}}
651
   }
696
   }
697
+  \renewcommand<>{\TaskEnd}[3][nocommand=1]{
698
+    \only#4{\beameroriginal{\TaskEnd}[#1]{#2}{#3}}
699
+  }
700
+  \renewcommand<>{\TaskNEnd}[5][nocommand=1]{
701
+    \only#6{\beameroriginal{\TaskNEnd}[#1]{#2}{#3}{#4}{#5}}
702
+  }
652
 }
703
 }
653
 {\typeout{beamer not loaded}}
704
 {\typeout{beamer not loaded}}
654
 
705
 

Loading…
Cancel
Save