Browse Source

Added the key end to \TaskExecution and \TaskExecDelta so to draw a circle

at the end of the rectangle to denote end of the instance.
Giuseppe Lipari 8 years ago
parent
commit
f78bd6c3fe
2 changed files with 44 additions and 12 deletions
  1. 13
    3
      rtsched-doc.tex
  2. 31
    9
      rtsched.sty

+ 13
- 3
rtsched-doc.tex View File

@@ -346,15 +346,25 @@ style. An example is in Figure~\ref{fig:resp-time} that uses command
346 346
   \label{fig:resp-time}
347 347
 \end{figure}
348 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 :
349
+It is sometimes useful to represent the end of a job execution,
350
+especially to distinguish it from preemption. In that case, you can
351
+use the following command :
350 352
 
351 353
 \begin{verbatim}
352 354
 \TaskEnd{i}{t}
353 355
 \end{verbatim}
354 356
 
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
+\noindent and its periodic version detailed in
358
+Table~\ref{tab:periodic_versions} that draw little circle(s) at the
359
+specified date(s). It works in the same way as \verb+\TaskArrival+
360
+command as shown in Figure~\ref{fig:ex1a}. 
361
+Alternatively, you can also add the \texttt{end=1} key to the
362
+\texttt{TaskExecution} command as follows:
357 363
 
364
+\begin{verbatim}
365
+\TaskExecution[end=1]{1}{10}{12}
366
+\TaskExecDelta[end=1]{1}{10}{2}.
367
+\end{verbatim}
358 368
 
359 369
 
360 370
 \subsection{Controlling visualization}

+ 31
- 9
rtsched.sty View File

@@ -66,9 +66,11 @@ Please update pgf to version 2.10 minimum!\MessageBreak
66 66
 \def\RTDefLineWidth{1pt}
67 67
 \def\RTDefLineStyle{solid}
68 68
 \def\RTDefExecHeight{1}
69
-\def\RTArrowStyle{stealth} %arrow style for deadlines, arrivals and horizontal axes
69
+\def\RTArrowStyle{stealth}
70
+%arrow style for deadlines, arrivals and horizontal axes
70 71
 % -{Triangle 45}[length=x] with length is a more modern arrow style but requires arrows.meta tikz library (available on latest texlive but rarely up to date on linux distribution)
71 72
 %-stealth is a predefined more classical arrow style
73
+\def\RTDefEndInstance{0} 
72 74
 
73 75
 \def\RTExecLabel{\ }
74 76
 \def\RTTaskSymbol{\RTDefTaskSymbol}
@@ -85,9 +87,7 @@ Please update pgf to version 2.10 minimum!\MessageBreak
85 87
 \def\RTLineWidth{\RTDefLineWidth}
86 88
 \def\RTLineStyle{\RTDefLineStyle}
87 89
 \def\RTExecHeight{\RTDefExecHeight}
88
-
89
-
90
-
90
+\def\RTEndInstance{\RTDefEndInstance}
91 91
 
92 92
 \define@key{RT}{height}[\RTNullWindowHeight]{\def\RTWindowHeight{#1}}
93 93
 \define@key{RT}{width}[10]{\def\RTWindowLength{#1}}
@@ -109,6 +109,7 @@ Please update pgf to version 2.10 minimum!\MessageBreak
109 109
 \define@key{RT}{lw}[\RTDefLineWidth]{\def\RTLineWidth{#1}}
110 110
 \define@key{RT}{style}[\RTDefLineStyle]{\def\RTLineStyle{#1}}
111 111
 \define@key{RT}{exeheight}[\RTDefExecHeight]{\def\RTExecHeight{#1}}
112
+\define@key{RT}{end}[\RTDefEndInstance]{\def\RTEndInstance{#1}}
112 113
 
113 114
 
114 115
 %%
@@ -121,6 +122,7 @@ Please update pgf to version 2.10 minimum!\MessageBreak
121 122
 \newdimen\yy % y position
122 123
 \newdimen\xxx % x position
123 124
 \newdimen\yyy % y position
125
+\newdimen\xtmp % x position
124 126
 \newcount\nsx % number of horizontal slots
125 127
 \newcount\nsy % number of vertical slots
126 128
 \newcount\nhl % number of horizontal lines
@@ -213,12 +215,14 @@ Please update pgf to version 2.10 minimum!\MessageBreak
213 215
   \setkeys{RT}{linecolor}%
214 216
   \setkeys{RT}{xscale}%
215 217
   \setkeys{RT}{nosymbols}%
218
+  \setkeys{RT}{end}%
216 219
 }
217 220
 
218 221
 \def\@RTExecDefaultValues{
219 222
   \setkeys{RT}{color}%
220 223
   \setkeys{RT}{execlabel}%
221 224
   \setkeys{RT}{linecolor}%
225
+  \setkeys{RT}{end}%
222 226
 }
223 227
 
224 228
 \def\RTGridEnd{
@@ -365,7 +369,7 @@ Please update pgf to version 2.10 minimum!\MessageBreak
365 369
   \@compute@xx{#3}
366 370
   \yyy = \yy \advance \yyy by 2\sy
367 371
   \begin{pgfonlayer}{foreground} 
368
-  \draw [\RTLineColor, thick, \RTArrowStyle-] (\xx,\yy) -- (\xx,\yyy);
372
+  \draw [\RTLineStyle, \RTLineColor, thick, \RTArrowStyle-] (\xx,\yy) -- (\xx,\yyy);
369 373
   \end{pgfonlayer}
370 374
   \@RTExecDefaultValues
371 375
 }
@@ -399,6 +403,14 @@ Please update pgf to version 2.10 minimum!\MessageBreak
399 403
   \advance \xx by \xxx \xx = .5\xx
400 404
   \advance \yy by .5\RTExecHeight\sy
401 405
   \draw (\xx,\yy) node[font=\rtfont] {\RTNumberLabelSize \RTExecLabel};%\RTNumberLabelSize
406
+   \if\RTEndInstance\RTDefEndInstance
407
+     \relax
408
+   \else 
409
+     \begin{pgfonlayer}{foreground} 
410
+       \draw[\RTLineColor, fill] (\xxx,\yyy) circle (1.5pt);
411
+     \end{pgfonlayer}
412
+   \fi
413
+
402 414
   \@RTExecDefaultValues
403 415
 }
404 416
 %
@@ -526,16 +538,17 @@ Please update pgf to version 2.10 minimum!\MessageBreak
526 538
 }
527 539
 
528 540
 % TaskEnd
529
-% Task end: draws a circle when the job terminates
541
+% Task end: draws a circle, typically to indicate job termination
542
+% (see also the end key in \TaskExecDelta and \TaskExecution)
530 543
 % par 1: task number from 1 to n
531 544
 % par 2: slot number from 0 to l-1
532 545
 \newcommand{\TaskEnd}[3][nocommand=1]{%
533 546
   \setkeys{RT}{#1}%
534 547
   \@compute@yy{#2}
535 548
   \@compute@xx{#3}
536
-  \yyy = \yy \advance \yyy by 2\sy%
549
+  \yyy = \yy \advance \yyy by \sy%
537 550
   \begin{pgfonlayer}{foreground} 
538
-  \draw[fill] (\xx,\yy) circle (1.5pt);
551
+  \draw[\RTLineColor, fill=\RTTaskColor] (\xx,\yyy) circle (1.5pt);
539 552
   \end{pgfonlayer}
540 553
   \@RTExecDefaultValues%
541 554
 }
@@ -603,6 +616,13 @@ Please update pgf to version 2.10 minimum!\MessageBreak
603 616
    \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
604 617
   \advance \xx by \xxx \xx = .5\xx
605 618
    \draw (\xx,\yy) node[above, font=\rtfont] {\RTTaskLabelSize \RTExecLabel}; %\RTNumberLabelSize
619
+   \if\RTEndInstance\RTDefEndInstance
620
+     \relax
621
+   \else 
622
+     \begin{pgfonlayer}{foreground} 
623
+       \draw[\RTLineColor, fill] (\xxx,\yyy) circle (1.5pt);
624
+     \end{pgfonlayer}
625
+   \fi
606 626
   \@RTExecDefaultValues
607 627
 }
608 628
 
@@ -622,7 +642,6 @@ Please update pgf to version 2.10 minimum!\MessageBreak
622 642
 }
623 643
 
624 644
 
625
-
626 645
 % 
627 646
 % TaskRespTime
628 647
 % par 1:  task
@@ -664,6 +683,9 @@ Please update pgf to version 2.10 minimum!\MessageBreak
664 683
   \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
665 684
     \only#5{\beameroriginal{\TaskExecDelta}[#1]{#2}{#3}{#4}}
666 685
   }
686
+  \renewcommand<>{\TaskExecDeltaEnd}[4][nocommand=1]{
687
+    \only#5{\beameroriginal{\TaskExecDeltaEnd}[#1]{#2}{#3}{#4}}
688
+  }
667 689
   \renewcommand<>{\TaskNExecDelta}[6][nocommand=1]{
668 690
     \only#7{\beameroriginal{\TaskNExecDelta}[#1]{#2}{#3}{#4}{#5}{#6}}
669 691
   }

Loading…
Cancel
Save