improved the report pdf

This commit is contained in:
paul-loedige 2022-12-26 14:27:57 +09:00
parent ce02078a6c
commit e0c0780748
6 changed files with 85 additions and 11 deletions

View File

@ -32,6 +32,71 @@ Submit the source code and the screen shots of the standard output and the kerne
\section{Code}%
\label{sec:Code}
\subsection{Custom Python Code}%
\label{sub:Custom Python Code}
The following code was written by me with the intend to measure the jitter in a python code.
It uses the \textit{schedtool} program provided with the PREEMPT\_RT patches to schedule itself.
\definecolor{mGreen}{rgb}{0,0.6,0}
\definecolor{mGray}{rgb}{0.5,0.5,0.5}
\definecolor{mPurple}{rgb}{0.58,0,0.82}
\definecolor{backgroundColour}{rgb}{0.95,0.95,0.92}
\lstset{
language=python,
backgroundcolor=\color{backgroundColour},
commentstyle=\color{mGreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{mGray},
stringstyle=\color{mPurple},
basicstyle=\ttfamily\scriptsize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
firstnumber=0,
stepnumber=1,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
literate={~}{{$\mathtt{\sim}$}}1
}
\lstset{literate=%
{Ö}{{\"O}}1
{Ä}{{\"A}}1
{Ü}{{\"U}}1
{ß}{{\ss}}2
{ü}{{\"u}}1
{ä}{{\"a}}1
{ö}{{\"o}}1
}
\lstinputlisting{../test.py}
\clearpage
\subsubsection{Output}%
\label{ssub:Python:Output}
Unfortunately, as can be seen by the following output,
the jitter isn't really affected by the activation or deactivation of the PREEMPT\_RT patches.
\paragraph{with PREEMPT\_RT}%
\label{par:Python:with PREEMPT RT}
\begin{center}
\includegraphics[width = .75\textwidth]{with_preempt_rt.png}
\end{center}
\paragraph{without PREEMPT\_RT}%
\label{par:Python:without PREEMPT RT}
\begin{center}
\includegraphics[width = .75\textwidth]{no_preempt_rt.png}
\end{center}
\clearpage
\subsection{Using Existing Programs}%
\label{sub:Using Existing Programs}
The following code is just a shell script that makes use of two programs provided by the \texttt{rt-tests} package (Arch Linux).
It uses the \texttt{hackbench} program to put stress on the system and then evaluates the maximum latency with the \texttt{cyclictest} program.
This provides a much more reliable method of testing the real-time capabilites of the system than any self-developed code I was able to come up with.
\definecolor{mGreen}{rgb}{0,0.6,0}
\definecolor{mGray}{rgb}{0.5,0.5,0.5}
\definecolor{mPurple}{rgb}{0.58,0,0.82}
@ -67,24 +132,23 @@ Submit the source code and the screen shots of the standard output and the kerne
{ä}{{\"a}}1
{ö}{{\"o}}1
}
The following code is just a shell script that makes use of two programs provided by the \texttt{rt-tests} package (Arch Linux).
It uses the \texttt{hackbench} program to put stress on the system and then evaluates the maximum latency with the \texttt{cyclictest} program.
This provides a much more reliable method of testing the real-time capabilites of the system than any self-developed code I was able to come up with.
\lstinputlisting{../test.sh}
The code is based on the following two sources:\\
\url{https://wiki.archlinux.org/title/Realtime_kernel_patchset}\\
\url{https://shuhaowu.com/blog/2022/02-linux-rt-appdev-part2.html}
\section{Output}%
\label{sec:Output}
\subsubsection{Output}%
\label{ssub:BASH:Output}
The following output shows that while the PREEMPT\_RT patch doesn't really affect the average latency it drastically reduces the maximum latency.
\subsection{with PREEMPT\_RT}%
\label{sub:with PREEMPT RT}
\paragraph{with PREEMPT\_RT}%
\label{par:BASH:with PREEMPT RT}
\mbox{}\\
\includegraphics[width = \textwidth]{with_rt.png}
\subsection{without PREEMPT\_RT}%
\label{sub:without PREEMPT RT}
\paragraph{without PREEMPT\_RT}%
\label{par:BASH:without PREEMPT RT}
\mbox{}\\
\includegraphics[width = \textwidth]{without_rt.png}
\end{document}

BIN
LaTeX/no_preempt_rt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

BIN
LaTeX/with_preempt_rt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

10
test.py
View File

@ -11,17 +11,27 @@ def set_rt_priority():
def rt_task():
new_time = time.time()
jitter_record = []
for i in range(ITERATIONS + 1):
old_time = new_time
new_time = time.time()
print("--------------------------------------------------")
print(f"system time:\t{new_time} s")
print(f"time diff:\t{new_time - old_time} s")
# jitter
jitter = new_time - old_time - ITERATION_DURATION
jitter_record.append(jitter)
print(f"jitter:\t{jitter} s")
# sleep for the rest of one second
time.sleep(new_time + ITERATION_DURATION - time.time())
#remove the first measurement
jitter_record.pop(0)
#plot and store the jitter record
plt.plot(jitter_record)
plt.title(f"Jitter at {ITERATION_DURATION} s interval")
plt.xlabel("Iteration")