\section{Results}
\label{sec:results}

Our goal is to stress our implementation in order to determine if it is
viable in terms of performance. In order to achieve this, we have compared our
results with the \texttt{sendfile} system call. As already stated in Section
\ref{sec:intro}, this function uses a zero-copy mechanism to avoid passing
information from kernel space and back.

\begin{table}
	\begin{center}
	\begin{tabular}{| c | c | c | c | c | c |}
		\hline
		Sent(MB) & \multicolumn{5}{|c|} {Time}  \\
		\cline{2-6}
		& one peer & two peers & tree peers & six peers & eight peers\\
		\hline
		32 & 4 & 10 & 18 & 49 & 61 \\
		\hline
		64 & 10 & 20 & 35 & 80 & 115 \\
		\hline
		128 & 20 & 42 & 58 & 226 & 347\\
		\hline
		256 & 41 & 75 & 129 & 385 & 534 \\
		\hline
	\end{tabular}
	\end{center}
	\caption{Sendfile Results}
	\label{sendfile-results}
\end{table}

Section \ref{sec:testing} largely details the test scenarios we have
performed. Particularly, this is the test where we varied the number of peers
from 1 to 8. The results gathered are displayed in Table \ref{sendfile-results}.
We can easily observe that the time needed to send files of different size grows
almost linearly, with a factor lower than 1. This was expected because for each
peer, we execute at least one more \texttt{sendfile} system call.

For the second test, we used our peer-to-peer kernel protocol for sending
files on with sizes growing from 32MB up to 256MB. The number of peers used in
this test was varied from 1 to 8. The results presented in Table,
\ref{p2pkp-results}, show an almost linear growth of the time needed to send the
files from sender to peers, but with a smaller factor than the one achieved in
case of the \texttt{sendfile} system call. For small number of peers, one, two
or three, \texttt{senfile} has a higher performance rate, but for a greater
number of peers our implementation has better results.

\begin{table}
	\begin{center}
	\begin{tabular}{| c | c | c | c | c | c |}
		\hline
		Sent(MB) & \multicolumn{5}{|c|} {Time}  \\
		\cline{2-6}
		& one peer & two peers & tree peers & six peers & eight peers\\
		\hline
		32 & 13 & 29 & 35 & 45 & 53 \\
		\hline
		64 & 34 & 53 & 67 & 103 &  125 \\
		\hline
		128 & 66 & 118 & 142 & 167 &  197 \\
		\hline
		256 & 121 & 223 & 277 & 378 & 446 \\
		\hline
	\end{tabular}
	\end{center}
	\caption{P2PKP Results}
	\label{p2pkp-results}
\end{table}

We have also compiled a graphic, shown in Figure \ref{fig:comp}, that better
exposes the differences between \texttt{sendfile} and the P2PKP kernel module.
As we can see, while the number of peers increase, our implementation
overcomes the performance of \texttt{sendfile}.

\begin{figure}[h!]
        \centering
        \includegraphics[scale=0.6]{img/comparison.png}
		\caption{\texttt{sendfile} vs P2PKP}
        \label{fig:comp}
\end{figure}

