Style file for drawing timing diagrams in LaTeX, forked from https://github.com/glipari/rtsched
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rtsched.sty 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. %% rtsched.sty
  2. %% Copyright 2005 Giuseppe Lipari
  3. %% Copyright 2015 Antoine Bertout <bertout.antoine@gmail.com> Transition from PSTricks to TikZ/PGF.
  4. % This work may be distributed and/or modified under the
  5. % conditions of the LaTeX Project Public License, either version 1.3
  6. % of this license or (at your option) any later version.
  7. % The latest version of this license is in
  8. % http://www.latex-project.org/lppl.txt
  9. % and version 1.3 or later is part of all distributions of LaTeX
  10. % version 2005/12/01 or later.
  11. %
  12. % This work has the LPPL maintenance status `maintained'.
  13. %
  14. % The Current Maintainer of this work is Giuseppe Lipari
  15. %
  16. % This work consists of the file rtsched.sty.
  17. \NeedsTeXFormat{LaTeX2e}[1995/12/01]
  18. \ProvidesPackage{rtsched}[2015/05/01]
  19. \typeout{'rtsched' style for Latex and TikZ/PGF}
  20. \typeout{Easily draw real-time schedules in TeX/Latex.}
  21. \typeout{(c) 2005, Giuseppe Lipari, Pisa, Italy (g.lipari@sssup.it)}
  22. \typeout{(c) 2015, Antoine Bertout (bertout.antoine@gmail.com)}
  23. \typeout{Version 2.0}
  24. \RequirePackage{tikz}
  25. \usetikzlibrary{shadows, patterns}
  26. \RequirePackage{keyval}
  27. \newcommand\rtfont{\usefont{T1}{phv}{m}{n}}
  28. %%
  29. %% These can be changed at any time
  30. %%
  31. \def\RTWindowLength{10cm} % window length
  32. \def\RTWindowHeight{0} % window height
  33. \def\RTNullWindowHeight{0} % nullwindow height
  34. \def\RTTaskLabelSize{\normalsize} % font size the task label
  35. \def\RTNumberLabelSize{\normalsize} % font size of the number labels
  36. \def\RTDefTaskSymbol{\tau}
  37. \def\RTDefNumberOffset{0}
  38. \def\RTDefTaskFill{solid}
  39. \def\RTDefTaskColor{gray}
  40. \def\RTDefLineColor{black}
  41. \def\RTDefXScale{1}
  42. \def\RTDefWriteSymbols{0}
  43. \def\RTDefGridInvisible{0}
  44. \def\RTDefNumbersInvisible{0}
  45. \def\RTDefRowLabelOffset{0pt}
  46. \def\RTDefAxisInvisible{0}
  47. \def\RTDefLineWidth{1pt}
  48. \def\RTDefLineStyle{solid}
  49. \def\RTDefExecHeight{1}
  50. \def\RTArrowStyle{stealth} %arrow style for deadlines, arrivals and horizontal axes
  51. % -{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)
  52. %-stealth is a predefined more classical arrow style
  53. \def\RTExecLabel{\ }
  54. \def\RTTaskSymbol{\RTDefTaskSymbol}
  55. \def\RTTaskFill{\RTDefTaskFill}
  56. \def\RTTaskColor{\RTDefTaskColor}
  57. \def\RTLineColor{\RTDefLineColor}
  58. \def\RTXScale{\RTDefXScale}
  59. \def\RTWriteSymbols{\RTDefWriteSymbols}
  60. \def\RTNumberOffset{\RTDefNumberOffset}
  61. \def\RTGridInvisible{\RTDefGridInvisible}
  62. \def\RTNumbersInvisible{\RTDefNumbersInvisible}
  63. \def\RTAxisInvisible{\RTDefAxisInvisible}
  64. \def\RTRowLabelOffset{\RTDefRowLabelOffset}
  65. \def\RTLineWidth{\RTDefLineWidth}
  66. \def\RTLineStyle{\RTDefLineStyle}
  67. \def\RTExecHeight{\RTDefExecHeight}
  68. \define@key{RT}{height}[\RTNullWindowHeight]{\def\RTWindowHeight{#1}}
  69. \define@key{RT}{width}[10]{\def\RTWindowLength{#1}}
  70. \define@key{RT}{labelsize}[\normalsize]{\def\RTTaskLabelSize{#1}}
  71. \define@key{RT}{numbersize}[\normalsize]{\def\RTNumberLabelSize{#1}}
  72. \define@key{RT}{color}[\RTDefTaskColor]{\def\RTTaskColor{#1}}
  73. \define@key{RT}{linecolor}[\RTDefLineColor]{\def\RTLineColor{#1}}
  74. \define@key{RT}{execlabel}[\ ]{\def\RTExecLabel{#1}}
  75. \define@key{RT}{fillstyle}[\RTDefTaskFill]{\def\RTTaskFill{#1}}
  76. \define@key{RT}{nocommand}{}
  77. \define@key{RT}{xscale}[\RTDefXScale]{\def\RTXScale{#1}}
  78. \define@key{RT}{symbol}[{\tau}]{\def\RTTaskSymbol{#1}}
  79. \define@key{RT}{nosymbols}[\RTDefWriteSymbols]{\def\RTWriteSymbols{#1}}
  80. \define@key{RT}{numoffset}[\RTDefNumberOffset]{\def\RTNumberOffset{#1}}
  81. \define@key{RT}{nogrid}[\RTDefGridInvisible]{\def\RTGridInvisible{#1}}
  82. \define@key{RT}{nonumbers}[\RTDefNumbersInvisible]{\def\RTNumbersInvisible{#1}}
  83. \define@key{RT}{labeloffset}[\RTDefRowLabelOffset]{\def\RTRowLabelOffset{#1}}
  84. \define@key{RT}{axis}[\RTDefAxisInvisible]{\def\RTAxisInvisible{#1}}
  85. \define@key{RT}{lw}[\RTDefLineWidth]{\def\RTLineWidth{#1}}
  86. \define@key{RT}{style}[\RTDefLineStyle]{\def\RTLineStyle{#1}}
  87. \define@key{RT}{exeheight}[\RTDefExecHeight]{\def\RTExecHeight{#1}}
  88. %%
  89. %% temporaries
  90. \newdimen\sx % slot length
  91. \newdimen\sy % slot height
  92. \newdimen\hy % frame height
  93. \newdimen\xx % x position
  94. \newdimen\yy % y position
  95. \newdimen\xxx % x position
  96. \newdimen\yyy % y position
  97. \newcount\nsx % number of horizontal slots
  98. \newcount\nsy % number of vertical slots
  99. \newcount\nhl % number of horizontal lines
  100. \newcount\nvl % number of vertical lines
  101. \newcount\ntasks % number of tasks
  102. \newcount\ntaskslessone %number of tasks less one
  103. \newcount\tmp % temp
  104. \newcounter{myLabel}
  105. \def\RTGrid{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
  106. \def\RTGridBegin{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
  107. \def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
  108. %% get the number of tasks
  109. \ntasks = #2
  110. \ntaskslessone = \ntasks
  111. \advance \ntaskslessone by -1
  112. %% number of horizontal steps in the grid
  113. \nsx = #3 \advance \nsx by 2 %
  114. %% real length of the window (approx)
  115. \nvl = \nsx \advance \nvl by 1 %
  116. %% compute length of a step
  117. \sx = \RTWindowLength \divide \sx by \nsx %
  118. %% number of vertical steps in the grid
  119. \nsy = #2 \multiply \nsy by 3 \advance \nsy by 1 %
  120. %% compute length of a vertical step (if height is null, \sy is the
  121. %% same as \sx)
  122. \ifx\RTWindowHeight\RTNullWindowHeight%
  123. \sy = \sx%
  124. \hy = \sy \multiply \hy by \nsy %\advance \hy by \sy%
  125. \else
  126. \sy = \RTWindowHeight \divide \sy by \nsy %
  127. \hy = \RTWindowHeight %\advance \hy by \sy %
  128. \fi
  129. %% compute real height
  130. \nhl = \nsy \advance \nhl by 1 %
  131. \advance \nsy by -1 \advance \nsx by -1
  132. %% the picture
  133. \pgfdeclarelayer{foreground}
  134. \pgfsetlayers{main,foreground}
  135. \begin{tikzpicture}
  136. %% draw grid (if not invisible)
  137. \if\RTGridInvisible\RTDefGridInvisible
  138. \draw[lightgray, semithick] (0,0) grid[xstep = \sx,ystep=\sy ] (\RTWindowLength,\hy);
  139. %% draw border grid
  140. \draw [black, thick] (0,0) rectangle (\RTWindowLength,\hy);
  141. \else\relax
  142. \fi
  143. %% draw numbers (if not invisible)
  144. \if\RTNumbersInvisible\RTDefNumbersInvisible
  145. \foreach \i [evaluate = \i as \j using \i*\sx] in {0,...,#3}{
  146. \ifodd \i
  147. \else
  148. \pgfmathsetmacro\nbwithoffset{\i + \RTNumberOffset};
  149. \node[below, font=\RTNumberLabelSize \rtfont] at (\j +\sx , 0) {\pgfmathprintnumber[int trunc,/pgf/number format/assume math mode=true]{\nbwithoffset }};
  150. \fi
  151. }
  152. \else
  153. \relax
  154. \fi
  155. %% Task Names
  156. \if\RTWriteSymbols\RTDefWriteSymbols
  157. \foreach \i [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\ntaskslessone}{
  158. \pgfmathsetmacro\task{\i + 1};
  159. \node[below, font=\rtfont] at (-\sx , \j-\sy) {\RTTaskLabelSize $\RTTaskSymbol_{\pgfmathprintnumber[int trunc]{\task}}$};
  160. }
  161. \else\relax
  162. \fi
  163. %% Horizontal axes
  164. \if\RTAxisInvisible\RTDefAxisInvisible
  165. \begin{pgfonlayer}{foreground}
  166. \foreach \i [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\ntaskslessone}{
  167. \draw [very thick,-\RTArrowStyle] (\sx,\j-3*\sy) -- (\RTWindowLength - \sx,\j-3*\sy);
  168. }
  169. \end{pgfonlayer}
  170. \fi
  171. }
  172. \def\@RTDefaultValues{%
  173. \setkeys{RT}{height}%
  174. \setkeys{RT}{width}%
  175. \setkeys{RT}{labelsize}%
  176. \setkeys{RT}{numbersize}%
  177. \setkeys{RT}{symbol}%
  178. \setkeys{RT}{fillstyle}%
  179. \setkeys{RT}{color}
  180. \setkeys{RT}{linecolor}%
  181. \setkeys{RT}{xscale}%
  182. \setkeys{RT}{nosymbols}%
  183. }
  184. \def\@RTExecDefaultValues{
  185. \setkeys{RT}{color}%
  186. \setkeys{RT}{execlabel}%
  187. \setkeys{RT}{linecolor}%
  188. }
  189. \def\RTGridEnd{
  190. \end{tikzpicture}%
  191. \@RTDefaultValues%
  192. }
  193. \def\endRTGrid{
  194. \end{tikzpicture}%
  195. \@RTDefaultValues%
  196. }
  197. \newcommand{\RTSet}[1]{
  198. \setkeys{RT}{#1}
  199. }
  200. \newcommand{\RTSetDefault}{
  201. \@RTDefaultValues
  202. }
  203. %% internal
  204. \newcommand{\@compute@xx}[1]{
  205. \xx = #1\sx
  206. \divide \xx by \RTXScale
  207. \advance \xx by \sx
  208. }
  209. \newcommand{\@compute@xxx}[1]{
  210. \xxx = #1\sx
  211. \divide \xxx by \RTXScale
  212. \advance \xxx by \sx
  213. }
  214. \newcommand{\@compute@yy}[1]{
  215. \yy = -3\sy \multiply \yy by #1
  216. \advance \yy by \hy
  217. }
  218. \newcommand{\DrawTaskAxis}[2][nocommand=1]{%
  219. \setkeys{RT}{#1}%
  220. \@compute@yy{#2}
  221. \@compute@xx{0}
  222. \xxx = \RTWindowLength \advance \xxx by -\sx
  223. \draw [\RTLineColor,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  224. \@RTExecDefaultValues%
  225. }
  226. \newcommand{\DrawXYAxis}[3][nocommand=1]{%
  227. \setkeys{RT}{#1}%
  228. \@compute@yy{#2}
  229. \@compute@xx{0}
  230. \xxx = \RTWindowLength \advance \xxx by -\sx
  231. \draw [\RTLineColor,-\RTArrowStyle] (\xx,\yy) -- (\xxx,\yy);
  232. \yyy = 3\sy \multiply \yyy by #3 \advance \yyy by \yy
  233. \advance \yyy by -\sy
  234. \draw [\RTLineColor,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  235. \@RTExecDefaultValues%
  236. }
  237. \newcommand{\FLine}[5][nocommand=1]{%
  238. \setkeys{RT}{#1}%
  239. \@compute@xx{#2}
  240. \@compute@xxx{#4}
  241. \yy = #3\sy \advance \yy by 2\sy
  242. \yyy = #5\sy \advance \yyy by 2\sy
  243. \draw [\RTLineColor, line width=\RTLineWidth,\RTLineStyle] (\xx,\yy) -- (\xxx,\yyy);
  244. \@RTExecDefaultValues%
  245. }
  246. %
  247. % TaskArrival
  248. % Task arrival: draws an up arrow at the specified slot
  249. % par 1 : task number from 1 to n
  250. % par 2 : slot number from 0 to l-1
  251. \newcommand{\TaskArrival}[3][nocommand=1]{%
  252. \setkeys{RT}{#1}%
  253. \@compute@yy{#2}
  254. \@compute@xx{#3}
  255. \yyy = \yy \advance \yyy by 2\sy%
  256. \begin{pgfonlayer}{foreground}
  257. \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  258. \end{pgfonlayer}
  259. \@RTExecDefaultValues%
  260. }
  261. %
  262. % TaskNArrival
  263. % Task arrivals: draws periodically up arrows from the specified slot
  264. % par 1 : task number from 1 to n
  265. % par 2 : slot number from 0 to l-1
  266. % par 3 : period
  267. % par 4 : number of instances
  268. \newcommand{\TaskNArrival}[5][nocommand=1]{%
  269. \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
  270. \TaskArrival{#2}{\activation}{#4}
  271. }
  272. }
  273. %
  274. % TaskArrDead
  275. % Task arrival and deadline: draws an up arrow and a down arrow at the specified slots
  276. % par 1 : task number from 1 to n
  277. % par 2 : slot number from 0 to l-1
  278. % par 3 : relative deadline
  279. \newcommand{\TaskArrDead}[4][nocommand=1]{
  280. \setkeys{RT}{#1}%
  281. \@compute@yy{#2}
  282. \@compute@xx{#3}
  283. \yyy = \yy \advance \yyy by 2\sy
  284. \begin{pgfonlayer}{foreground}
  285. \draw [\RTLineColor, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  286. \end{pgfonlayer}
  287. \advance \xx by #4\sx
  288. \begin{pgfonlayer}{foreground}
  289. \draw [\RTLineColor, thick, -\RTArrowStyle] (\xx,\yyy) -- (\xx,\yy);
  290. \end{pgfonlayer}
  291. \@RTExecDefaultValues
  292. }
  293. %
  294. % TaskNArrDead
  295. % Task arrivals and deadlines: draws periodically up arrows and down arrows from the specified slots
  296. % par 1 : task number from 1 to n
  297. % par 2 : slot number from 0 to l-1
  298. % par 3 : relative deadline
  299. % par 4 : period
  300. % par 5 : number of instances
  301. \newcommand{\TaskNArrDead}[6][nocommand=1]{
  302. \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #5)] in {0,...,\numexpr #6-1}{
  303. \TaskArrDead{#2}{\activation}{#4}
  304. }
  305. }
  306. %
  307. % TaskDeadline
  308. % Task deadline: draws a down arrow at the specified slot
  309. % par 1 : task number from 1 to n
  310. % par 2 : slot number from 0 to l-1
  311. \newcommand{\TaskDeadline}[3][nocommand=1]{
  312. \setkeys{RT}{#1}%
  313. \@compute@yy{#2}
  314. \@compute@xx{#3}
  315. \yyy = \yy \advance \yyy by 2\sy
  316. \begin{pgfonlayer}{foreground}
  317. \draw [\RTLineColor, thick, \RTArrowStyle-] (\xx,\yy) -- (\xx,\yyy);
  318. \end{pgfonlayer}
  319. \@RTExecDefaultValues
  320. }
  321. %
  322. % TaskNDeadline
  323. % periodic task deadlines: draws periodically down arrows from the specified slot
  324. % par 1 : task number from 1 to n
  325. % par 2 : slot number from 0 to l-1
  326. % par 3 : period
  327. % par 4 : number of instances
  328. \newcommand{\TaskNDeadline}[5][nocommand=1]{%
  329. \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #4)] in {0,...,\numexpr #5-1}{
  330. \TaskDeadline{#2}{\activation}{#4}
  331. }
  332. }
  333. %
  334. % TaskExecution
  335. % Task execution: draws an execution from start time to finish time
  336. % par 1: task
  337. % par 2: start time
  338. % par 3: finish time
  339. \newcommand{\TaskExecution}[4][nocommand=1]{
  340. \setkeys{RT}{#1}%
  341. \@compute@yy{#2}
  342. \@compute@xx{#3}
  343. \yyy = \yy \advance \yyy by \RTExecHeight\sy
  344. \@compute@xxx{#4}
  345. \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
  346. \advance \xx by \xxx \xx = .5\xx
  347. \advance \yy by .5\RTExecHeight\sy
  348. \draw (\xx,\yy) node[font=\rtfont] {\RTNumberLabelSize \RTExecLabel};%\RTNumberLabelSize
  349. \@RTExecDefaultValues
  350. }
  351. %
  352. % Task Lock
  353. % par 1: task
  354. % par 2: time
  355. % par 3: resource
  356. %
  357. \newcommand{\TaskLock}[4][nocommand=1]{
  358. \setkeys{RT}{#1}%
  359. \@compute@yy{#2}
  360. \@compute@xx{#3}
  361. \yyy = \yy \advance \yyy by \sy
  362. \advance \yyy by .5\sy
  363. \node[font=\rtfont] at (\xx , \yyy) {\RTNumberLabelSize L(#4)}; %\RTNumberLabelSize
  364. \@RTExecDefaultValues
  365. }
  366. %
  367. % TaskUnlock
  368. % par 1: task
  369. % par 2: time
  370. % par 3: resource
  371. %
  372. \newcommand{\TaskUnlock}[4][nocommand=1]{
  373. \setkeys{RT}{#1}%
  374. \@compute@yy{#2}
  375. \@compute@xx{#3}
  376. \yyy = \yy \advance \yyy by \sy
  377. \advance \yyy by .5\sy
  378. \node[font=\rtfont] at (\xx , \yyy) {\RTNumberLabelSize U(#4)}; %\RTNumberLabelSize
  379. \@RTExecDefaultValues
  380. }
  381. %
  382. % Label
  383. % par 1: number of vertical slot
  384. % par 2: time
  385. % par 3: label
  386. %
  387. \newcommand{\Label}[4][nocommand=1]{
  388. \setkeys{RT}{#1}%
  389. %\@compute@yy{#2}
  390. \@compute@xx{#3}
  391. \yy = -\sy \multiply \yy by #2
  392. \advance \yy by \hy
  393. \yyy = \yy \advance \yyy by 2\sy %\yyy = \yy \advance \yyy by \sy
  394. \node[font=\rtfont, fill = white, draw=\RTLineColor, thin, drop shadow = {color = black}] at (\xx , \yyy) {\RTNumberLabelSize #4}; %\RTNumberLabelSize
  395. \@RTExecDefaultValues
  396. }
  397. %
  398. % Inherit
  399. % par 1: higher priority task (from)
  400. % par 2: lower priority task (to)
  401. % par 3: time
  402. %
  403. \newcommand{\Inherit}[4][nocommand=1]{
  404. \setkeys{RT}{#1}%
  405. \@compute@yy{#2}
  406. \@compute@xx{#4}
  407. \yyy = -3\sy \multiply \yyy by #3 \advance \yyy by \sy
  408. \advance \yyy by \hy \advance \yyy by -\sy % \RTWindowHeight
  409. \begin{pgfonlayer}{foreground}
  410. \draw [dashed, thick,-\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
  411. \end{pgfonlayer}
  412. \@RTExecDefaultValues
  413. }
  414. %
  415. % Activation
  416. % par 1: activating task (from)
  417. % par 2: signal start time
  418. % par 3: activated task (to)
  419. % par 4: signal arrival time
  420. \newcommand{\Activation}[5][nocommand=1]{
  421. \setkeys{RT}{#1}%
  422. \@compute@yy{#2}
  423. \@compute@xx{#3}
  424. \yyy = -3\sy \multiply \yyy by #4 %\advance \yyy by \sy
  425. \advance \yyy by \hy %\advance \yyy by -\sy %\RTWindowHeight
  426. \xxx = #5\sx \advance \xxx by \sx
  427. \begin{pgfonlayer}{foreground}
  428. \draw [dashed, thick,-\RTArrowStyle] (\xx,\yy) -- (\xxx,\yyy);
  429. \end{pgfonlayer}
  430. }
  431. %
  432. % RTBox
  433. % par 1: time1
  434. % par 2: time2
  435. %
  436. \newcommand{\RTBox}[3][nocommand=1]{
  437. \setkeys{RT}{#1}%
  438. \yy = 0cm
  439. \advance \yy by \hy
  440. \yyy = 0cm % \yyy = \sy
  441. \@compute@xx{#2}
  442. \@compute@xxx{#3}
  443. \draw [pattern color=lightgray, draw=\RTLineColor, pattern=crosshatch, rounded corners, thin](\xx,\yy) rectangle (\xxx,\yyy);
  444. \@RTExecDefaultValues
  445. }
  446. %% %
  447. % % par 1: task
  448. % % par 2: first instant (arrival)
  449. % % par 3: second instant (deadline)
  450. % %
  451. % \newcommand{\Interval}[4][nocommand=1]{
  452. % \setkeys{RT}{#1}%
  453. % \@compute@yy{#2}
  454. % \advance \yy by 2.5\sy
  455. % \@compute@xx{#3}
  456. % \@compute@xxx{#4}
  457. % % da cambiare con psarc
  458. % \pscurve*[linecolor=\RTLineColor]{-}(\xx,\yy)(\xxx,\yy)
  459. % \@RTExecDefaultValues
  460. % }
  461. %
  462. %
  463. % RowLabel
  464. % par 1: task
  465. % par 2: label
  466. %
  467. \newcommand{\RowLabel}[3][nocommand=1]{
  468. \setkeys{RT}{#1}%
  469. \@compute@yy{#2}
  470. \advance \yy by 2\sy
  471. \xx = \RTRowLabelOffset %\advance \xx by \sx
  472. \node[below left,font=\rtfont] at (-\xx , \yy) {\RTTaskLabelSize #3};%\RTTaskLabelSize
  473. }
  474. %
  475. % TaskExecDelta
  476. % Task execution delta: draws an execution from start time during delta time
  477. % par 1: task
  478. % par 2: start time
  479. % par 3: delta
  480. %
  481. \newcommand{\TaskExecDelta}[4][nocommand=1]{
  482. \setkeys{RT}{#1}%
  483. \@compute@yy{#2}
  484. \@compute@xx{#3}
  485. \yyy = \yy \advance \yyy by \RTExecHeight \sy
  486. %\@compute@xxx{#4}
  487. \xxx = \xx \advance \xxx by #4\sx
  488. \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
  489. \advance \xx by \xxx \xx = .5\xx
  490. \draw (\xx,\yy) node[above, font=\rtfont] {\RTTaskLabelSize \RTExecLabel}; %\RTNumberLabelSize
  491. \@RTExecDefaultValues
  492. }
  493. %
  494. % TaskNExecDelta
  495. % Task execution deltas: draws periodically executions from start time during delta time
  496. % par 1: task
  497. % par 2: start time
  498. % par 3: delta
  499. % par 4: period
  500. % par 5: number of instances
  501. \newcommand{\TaskNExecDelta}[6][nocommand=1]{
  502. \foreach \instance [evaluate = \instance as \activation using (#3 + \instance * #5)] in {0,...,\numexpr #6-1}{
  503. \TaskExecDelta{#2}{\activation}{#4}
  504. }
  505. }
  506. %
  507. % TaskRespTime
  508. % par 1: task
  509. % par 2: start time
  510. % par 3: finish time
  511. %
  512. \newcommand{\TaskRespTime}[4][nocommand=1]{
  513. \setkeys{RT}{#1}
  514. \@compute@yy{#2}
  515. \@compute@xx{#3}
  516. \yyy = \yy \advance \yyy by \sy
  517. \xxx = \xx \advance \xxx by #4\sx
  518. \draw [pattern color=\RTTaskColor,draw=\RTLineColor, pattern=crosshatch, thin] (\xx,\yy) rectangle (\xxx,\yyy);
  519. \@RTExecDefaultValues
  520. }
  521. \@ifclassloaded{beamer}{
  522. \renewcommand<>{\TaskArrival}[3][nocommand=1]{
  523. \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
  524. }
  525. \renewcommand<>{\TaskNArrival}[5][nocommand=1]{
  526. \only#6{\beameroriginal{\TaskNArrival}[#1]{#2}{#3}{#4}{#5}}
  527. }
  528. \renewcommand<>{\TaskArrDead}[4][nocommand=1]{
  529. \only#5{\beameroriginal{\TaskArrDead}[#1]{#2}{#3}{#4}}
  530. }
  531. \renewcommand<>{\TaskNArrDead}[6][nocommand=1]{
  532. \only#7{\beameroriginal{\TaskNArrDead}[#1]{#2}{#3}{#4}{#5}{#6}}
  533. }
  534. \renewcommand<>{\TaskDeadline}[3][nocommand=1]{
  535. \only#4{\beameroriginal{\TaskDeadline}[#1]{#2}{#3}}
  536. }
  537. \renewcommand<>{\TaskNDeadline}[5][nocommand=1]{
  538. \only#6{\beameroriginal{\TaskNDeadline}[#1]{#2}{#3}{#4}{#5}}
  539. }
  540. \renewcommand<>{\TaskExecution}[4][nocommand=1]{
  541. \only#5{\beameroriginal{\TaskExecution}[#1]{#2}{#3}{#4}}
  542. }
  543. \renewcommand<>{\TaskExecDelta}[4][nocommand=1]{
  544. \only#5{\beameroriginal{\TaskExecDelta}[#1]{#2}{#3}{#4}}
  545. }
  546. \renewcommand<>{\TaskNExecDelta}[6][nocommand=1]{
  547. \only#7{\beameroriginal{\TaskNExecDelta}[#1]{#2}{#3}{#4}{#5}{#6}}
  548. }
  549. \renewcommand<>{\TaskRespTime}[4][nocommand=1]{
  550. \only#5{\beameroriginal{\TaskRespTime}[#1]{#2}{#3}{#4}}
  551. }
  552. \renewcommand<>{\TaskLock}[4][nocommand=1]{
  553. \only#5{\beameroriginal{\TaskLock}[#1]{#2}{#3}{#4}}
  554. }
  555. \renewcommand<>{\TaskUnlock}[4][nocommand=1]{
  556. \only#5{\beameroriginal{\TaskUnlock}[#1]{#2}{#3}{#4}}
  557. }
  558. \renewcommand<>{\Label}[4][nocommand=1]{
  559. \only#5{\beameroriginal{\Label}[#1]{#2}{#3}{#4}}
  560. }
  561. \renewcommand<>{\Inherit}[4][nocommand=1]{
  562. \only#5{\beameroriginal{\Inherit}[#1]{#2}{#3}{#4}}
  563. }
  564. \renewcommand<>{\Activation}[5][nocommand=1]{
  565. \only#6{\beameroriginal{\Activation}[#1]{#2}{#3}{#4}{#5}}
  566. }
  567. \renewcommand<>{\RTBox}[3][nocommand=1]{
  568. \only#4{\beameroriginal{\RTBox}[#1]{#2}{#3}}
  569. }
  570. \renewcommand<>{\FLine}[5][nocommand=1]{
  571. \only#6{\beameroriginal{\FLine}[#1]{#2}{#3}{#4}{#5}}
  572. }
  573. }
  574. {\typeout{beamer not loaded}}
  575. \endinput