4 We want to view if our implementation is viable in terms of performances. To do this we compare our results with the results of \texttt{sendfile} system call. The \texttt{sendfile} command (\textbf{ssize\_t sendfile(int} \textit{out\_fd,} \textbf{int} \textit{in\_fd,} \textbf{off\_t *}\textit{offset,} \textbf{size\_t} \textit{count}\textbf{);}) is used to send \texttt{count} bytes from \texttt{in\_fd} to \texttt{out\_fd}.
8 \begin{tabular}{| c | c | c | c | c | c |}
10 Sent(MB) & \multicolumn{5}{|c|} {Time} \\
12 & one peer & two peers & tree peers & six peers & eight peers\\
14 32 & 4 & 10 & 18 & 49 & 61 \\
16 64 & 10 & 20 & 35 & 80 & 115 \\
18 128 & 20 & 42 & 58 & 226 & 347\\
20 256 & 41 & 75 & 129 & 385 & 534 \\
24 \caption{Sendfile Results}
25 \label{sendfile-results}
28 In the first test we sent files of 32, 64, 128 and 256 MB from one node to a different number of peers. We varied the number of peers from 1 to 8. The results can be seen in Table \ref{sendfile-results}. We can see that the time needed to send files of different size grows almost linearly, with a factor smaller than 1. This is expected because for each peer we execute a different sendfile system call.
30 In the second test, we used our peer-to-peer kernel protocol also on files with size growing from 32MB to 256MB. The number of peers used in 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 the sender to peers but with a smaller factor than in the case of \texttt{sendfile}. For small number of peers, one two or three, the results were better in the tests made with sendfile, but for a greater number of peers the results are better when using the p2pkp.
34 \begin{tabular}{| c | c | c | c | c | c |}
36 Sent(MB) & \multicolumn{5}{|c|} {Time} \\
38 & one peer & two peers & tree peers & six peers & eight peers\\
40 32 & 13 & 29 & 35 & 45 & 53 \\
42 64 & 34 & 53 & 67 & 103 & 125 \\
44 128 & 66 & 118 & 142 & 167 & 197 \\
46 256 & 121 & 223 & 277 & 378 & 446 \\
50 \caption{P2PKP Results}
54 We also made a graphic shown in Figure \ref{fig:comp} to view more clearly the differences between sendfile and peer-to-peer kernel protocol. As we can see, with the increase of the number of peers p2pkp become more and more good, and finally overcame the performances of sendfile.
58 \includegraphics[scale=0.6]{img/comparison.png}