\newcommand{\machinetimewaste}[3][0]{
	\begin{subfigure}{\ifnum#1=1 0.5\textwidth \else 0.24\textwidth \fi}
	\vspace{0.5cm}
	%\ifnum#1=1 \hspace{0.25\textwidth} \fi
	\begin{minipage}[c]{\textwidth}%
	\includegraphics[width=1\textwidth]{figures/machine_time_waste/#3}
	\end{minipage}
	%\hfill
	\caption{#2}
	\end{subfigure}}

\newcommand{\machinetimewastelegend}{
\begin{subfigure}{0.5\textwidth}
\vspace{0.5cm}
\centering
\begin{tabular}{cc}
\toprule
\textbf{Color} & \textbf{Execution phase} \\
\midrule
	{\color{blue}Blue} & Queued \\
	{\color{orange}Orange} & Ended \\
	{\color{teal}Green} & Ready \\
	{\color{red}Red} & Running \\
	{\color{violet}Violet} & Evicted \\
	{\color{brown}Brown} & Unknown \\
\bottomrule
\end{tabular}
\caption{Execution state legend for the graphs}
\end{subfigure}
\hfill}

\begin{figure}
\machinetimewastelegend
\machinetimewaste[1]{All clusters}{output_9_16.png}
\machinetimewaste{Cluster A}{output_9_0.png}
\machinetimewaste{Cluster B}{output_9_2.png}
\machinetimewaste{Cluster C}{output_9_4.png}
\machinetimewaste{Cluster D}{output_9_6.png}
\machinetimewaste{Cluster E}{output_9_8.png}
\machinetimewaste{Cluster F}{output_9_10.png}
\machinetimewaste{Cluster G}{output_9_12.png}
\machinetimewaste{Cluster H}{output_9_14.png}
	\caption{Total task time (in milliseconds) spent in each execution phase w.r.t. task termination.}
\end{figure}

\begin{figure}
\machinetimewastelegend
\machinetimewaste[1]{All clusters}{output_9_17.png}
\machinetimewaste{Cluster A}{output_9_1.png}
\machinetimewaste{Cluster B}{output_9_3.png}
\machinetimewaste{Cluster C}{output_9_5.png}
\machinetimewaste{Cluster D}{output_9_7.png}
\machinetimewaste{Cluster E}{output_9_9.png}
\machinetimewaste{Cluster F}{output_9_11.png}
\machinetimewaste{Cluster G}{output_9_13.png}
\machinetimewaste{Cluster H}{output_9_15.png}
	\caption{Relative task time (in milliseconds) spent in each execution phase w.r.t. task termination.}
\end{figure}
