Selaa lähdekoodia

Merge pull request #5 from abertout/master

Add of new commands : TaskEnd, TaskEndN and TaskInterval
Giuseppe Lipari 9 vuotta sitten
vanhempi
commit
b691ca7e09
3 muutettua tiedostoa jossa 166 lisäystä ja 9 poistoa
  1. 1
    1
      README.md
  2. 90
    7
      rtsched-doc.tex
  3. 75
    1
      rtsched.sty

+ 1
- 1
README.md Näytä tiedosto

@@ -11,7 +11,7 @@ This package contains the rtsched package for drawing GANTT charts
11 11
 (chronograms). The package can be useful for drawing real-time timing
12 12
 diagrams in LaTeX, as often needs to be done for preparing articles,
13 13
 lectures and presentation in the Real-Time Scheduling research
14
-community. The package depends on keyval and TikZ/PGF.
14
+community. The package depends on keyval and TikZ/PGF (versions 2.10 or greater).
15 15
 
16 16
 A more complete documentation, with a set of examples, is available in
17 17
 file rtsched-doc.pdf.

+ 90
- 7
rtsched-doc.tex Näytä tiedosto

@@ -18,7 +18,7 @@ In this document, I give an overview of the \texttt{rtsched} \LaTeX
18 18
 package, which can be used to easily draw chronograms (GANTT charts).
19 19
 These diagrams are quite common in real-time scheduling research.
20 20
 
21
-The package depends on keyval and TikZ/PGF, both widely
21
+The package depends on keyval and TikZ/PGF (pgf version 2.10 or greater), both widely
22 22
 available on any \TeX distribution.
23 23
 
24 24
 The drawing capabilities are completely based on TikZ. Thus, you can compile
@@ -88,6 +88,8 @@ Figure \ref{fig:ex1a}. Available periodic versions of the commands can be found
88 88
  \verb+\TaskDeadline{i}{t}+ & \verb+\TaskNDeadline{i}{t}{p}{n}+ \\
89 89
  \verb+\TaskArrDeadl{i}{t}{reld}+ & \verb+\TaskNArrDeadl{i}{t}{reld}{p}{n}+  \\
90 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 93
   \hline
92 94
 \end{tabular}
93 95
 \caption{Table of periodic commands where p stands for the period and n for the number of instances}
@@ -185,6 +187,9 @@ from periods (the so-called \emph{constrained deadline tasks}).
185 187
     \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
186 188
     \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
187 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 194
                                     % draws the arrival and deadline
190 195
     \TaskNArrDead{2}{0}{6}{6}{3}    % for 3 instances of period 6 
@@ -193,7 +198,10 @@ from periods (the so-called \emph{constrained deadline tasks}).
193 198
     \TaskExecution{2}{1}{4}
194 199
     \TaskExecution{2}{6}{8}
195 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 205
   \end{RTGrid}
198 206
 
199 207
 \begin{verbatim}
@@ -202,15 +210,21 @@ from periods (the so-called \emph{constrained deadline tasks}).
202 210
     \TaskNArrDead{1}{0}{4}{4}{5}    % draws the arrivals and deadlines
203 211
     \TaskNExecDelta{1}{0}{1}{4}{5}  % draws executions (highest priority) 
204 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 216
    	\TaskNArrDead{2}{0}{6}{6}{3}    % draws the arrival and deadline
207 217
                                     % for 3 instances of period 6 
218
+	    
208 219
     
209 220
     % no simple formula for lowest priority, sorry!
210 221
     \TaskExecution{2}{1}{4}
211 222
     \TaskExecution{2}{6}{8}
212 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 228
   \end{RTGrid}
215 229
 \end{verbatim}
216 230
   \caption{Using periodic commands to avoid repetitions}
@@ -288,7 +302,7 @@ It is also possible to visualise preempted tasks with a hatched fill
288 302
 style. An example is in Figure~\ref{fig:resp-time} that uses command
289 303
 \texttt{TaskRespTime}. 
290 304
 
291
-\begin{figure}
305
+\begin{figure}[!htbp]
292 306
   \centering
293 307
   \begin{RTGrid}{2}{20}
294 308
   
@@ -332,6 +346,16 @@ style. An example is in Figure~\ref{fig:resp-time} that uses command
332 346
   \label{fig:resp-time}
333 347
 \end{figure}
334 348
 
349
+It is sometimes useful to represent the end of a job execution, especially to distinguish it from preemption. 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 as shown in Figure~\ref{fig:ex1a}.
356
+
357
+
358
+
335 359
 
336 360
 \subsection{Controlling visualization}
337 361
 
@@ -535,8 +559,8 @@ to highlight a portion of the schedule with \texttt{RTBox}:
535 559
 
536 560
 Notice that the order with which the objects are drawn is exactly the
537 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 564
 drawn on top of the box. You can try to move the \texttt{RTBox}
541 565
 command at the end to see what happens.
542 566
 
@@ -568,7 +592,7 @@ following command:
568 592
 \TaskExecution[color=white,execlabel=S]{3}{4}{5}
569 593
 \end{verbatim}
570 594
 
571
-\begin{figure}
595
+\begin{figure}[!htbp]
572 596
   \centering
573 597
   \begin{RTGrid}[width=12cm]{3}{25}
574 598
     \TaskArrDead{3}{0}{20}
@@ -616,6 +640,65 @@ following command:
616 640
   \label{fig:ex4}
617 641
 \end{figure}
618 642
 
643
+
644
+\subsection{Jitter}
645
+
646
+
647
+Jitter is often represented as an interval drawn by an horizontal double-headed arrow. 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-headed arrow 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 702
 \end{document}
620 703
 %%% Local Variables: 
621 704
 %%% mode: latex

+ 75
- 1
rtsched.sty Näytä tiedosto

@@ -28,7 +28,21 @@
28 28
 \usetikzlibrary{shadows, patterns}
29 29
 \RequirePackage{keyval}
30 30
 \newcommand\rtfont{\usefont{T1}{phv}{m}{n}}
31
-
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
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 48
 %% These can be changed at any time
@@ -489,6 +503,57 @@
489 503
 }
490 504
 
491 505
 
506
+%
507
+% TaskInterval : specify an interval with an horizontal double arrow
508
+% par 1: task
509
+% par 2: start time
510
+% par 3: finish time
511
+% par 4: label
512
+
513
+\newcommand{\TaskInterval}[5][nocommand=1]{
514
+\setkeys{RT}{#1}
515
+\@compute@yy{#2}
516
+\@compute@xx{#3}
517
+\@compute@xxx{#4}
518
+\advance \yy by .5\sy
519
+\draw [\RTLineColor, thick, \RTArrowStyle-\RTArrowStyle] (\xx,\yy) -- (\xxx,\yy);
520
+\advance \xx by \xxx \xx = .5\xx
521
+%\advance \yy by .5\RTExecHeight\sy
522
+\draw (\xx,\yy) node[above,font=\rtfont] {\RTTaskLabelSize #5};%
523
+
524
+\@RTExecDefaultValues
525
+
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
+
492 557
 
493 558
 %% %
494 559
 % % par 1: task
@@ -626,6 +691,15 @@
626 691
   \renewcommand<>{\FLine}[5][nocommand=1]{
627 692
     \only#6{\beameroriginal{\FLine}[#1]{#2}{#3}{#4}{#5}}
628 693
   }  
694
+  \renewcommand<>{\TaskInterval}[5][nocommand=1]{
695
+    \only#6{\beameroriginal{\TaskInterval}[#1]{#2}{#3}{#4}{#5}}
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
+  }
629 703
 }
630 704
 {\typeout{beamer not loaded}}
631 705
 

Loading…
Peruuta
Tallenna