-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_appendix.tex
More file actions
357 lines (240 loc) · 16.5 KB
/
code_appendix.tex
File metadata and controls
357 lines (240 loc) · 16.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
\part{Source Code Appendix}
\chapter{Grammar} \label{app:grammar}
This is the grammar for the ANTLR4 parser.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/parser/DQGrammar.g4}
\chapter{C++ Source Files}
\section{Root folder}
\subsection{main.cpp}
This is the main file of the project.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/main.cpp}
\subsection{Application.cpp}
This is a singleton that handles the global state of the application.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/Application.cpp}
\section{Dashboard}
This folder contains the widgets that compose the dashboard.
\subsection{ColorRegistry.cpp} \label{code:coder}
\sloppy This class stores all the colors for all the QtSeries, moreover, it generates HSV colors based on the algorithm taken from \url{https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/}.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/ColorRegistry.cpp}
\subsection{CustomLegendEntry.cpp} \label{code:cle}
This class represents an entry in the plot legend.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/CustomLegendEntry.cpp}
\subsection{CustomLegendPanel.cpp} \label{code:clp}
This widget represents the legend panel for a plot, with entries corresponding to each series.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/CustomLegendPanel.cpp}
\subsection{DQPlotController.cpp} \label{code:dqpc}
This class is the controller of DeltaQPlot, based on the MVC design pattern.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DQPlotController.cpp}
\subsection{DQPlotList.cpp} \label{code:dqpl}
This widget handles the adding and removing of probes series from a plot.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DQPlotList.cpp}
\subsection{DelaySettingsWidget.cpp} \label{code:dsw}
This widget represent the slider widget to modify the parameters $dMax$, $\Delta$t and N.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DelaySettingsWidget.cpp}
\subsection{DeltaQPlot.cpp} \label{code:dqp}
This widget is the widget containing a plot and its legend.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DeltaQPlot.cpp}
\subsection{MainWindow.cpp} \label{code:mw}
This widget is the main window of the application, it has a tab to the side where the widgets to control the oscilloscope are. To the left, the panel where all plots are shown.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/MainWindow.cpp}
\subsection{NewPlotList.cpp} \label{code:npl}
This widget is the widget to add a new plot to the plots panel.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/NewPlotList.cpp}
\subsection{ObservableSettings.cpp} \label{code:os}
This widget is a tab that contains the settings for the probes (Setting a QTA, setting $dMax$).
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/ObservableSettings.cpp}
\subsection{SamplingRateWidget.cpp} \label{code:srw}
This widget allows the sampling rate to be changed via a slider.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/SamplingRateWidget.cpp}
\subsection{QTAInputWidget.cpp} \label{code:qiw}
This widget allows the QTA to be set for a probe
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/QTAInputWidget.cpp}
\subsection{Sidebar.cpp} \label{code:side}
This widget is a tab where the user can handle the system, add/remove plots and change the sampling rate.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/Sidebar.cpp}
\subsection{SnapshotViewerWindow.cpp} \label{code:svw}
This is a window to observe a snapshot from the triggers tab.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/SnapshotViewerWindow.cpp}
\subsection{StubControlWidget.cpp} \label{code:scw}
This widget allows to open the server on the IP and Port defined by the user and to connect to the adapter on the IP and port specified by the user.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/StubControlWidget.cpp}
\subsection{SystemCreationWidget.cpp} \label{code:syscw}
This widget allows the creation/update of a system, loading an already existing one or saving one.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/SystemCreationWidget.cpp}
\subsection{TriggersTab.cpp} \label{code:tt}
This tab holds the widgets to set/remove triggers and view fired ones.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/TriggersTab.cpp}
\section{Outcome diagram}
The "diagram" folder contains everything related to outcome diagrams. Due to time related issues, there are some issues with the names. We will explain what each class represents, but it differs from the definitions which are explained in the thesis.
\subsection{Observable.cpp} \label{code:obs}
The observable class represents a generic "observable" element of the outcome diagram, it is the base class for probes, outcome and operators. In this class one can calculate the observed $\Delta$Q, store the outcome instances (samples), set the parameters, set a QTA, add/remove triggers and get a snapshot. It is what we described throughout the whole paper as a probe.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Observable.cpp}
\subsection{Operator.cpp} \label{code:op}
This class represent a generic operator, it can be either an FTF, ATF or PC. It allows calculating the "calculated $\Delta$Q".
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Operator.cpp}
\subsection{Outcome.cpp} \label{code:outc}
This class represents a simple outcome.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Outcome.cpp}
\subsection{Probe.cpp} \label{code:probe}
This class represents what we described as "sub-outcome diagram". As the operator class, it allows calculating the "calculated $\Delta$Q".
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Probe.cpp}
\subsection{System.cpp} \label{code:sys}
This class represents the system, the whole outcome diagram. It coordinates the various parts of the outcome diagram.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/System.cpp}
\section{$\Delta$Q (maths)}
The "maths" folder represents all the classes related to $\Delta$Q, where mathematical operations are being done (hence the "maths" name).
\subsection{ConfidenceInterval.cpp} \label{code:ci}
This class represents the confidence bounds described earlier.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/ConfidenceInterval.cpp}
\subsection{DeltaQ.cpp} \label{code:dq}
This class represents a $\Delta$Q. It supports calculating a $\Delta$Q given multiple samples, calculating the quartiles of a $\Delta$Q, it supports various arithmetical transformations.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/DeltaQ.cpp}
\subsection{DeltaQOperations.cpp} \label{code:dqop}
This file contains the definition of all the operations that can be done on a $\Delta$Q or on $\Delta$Qs, specified in the implementation chapter. Convolution (naive, FFT), FTF, ATF, PC operators, rebinning.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/DeltaQOperations.cpp}
\subsection{Snapshot.cpp} \label{code:snaps}
This class represents a single snapshot of a probe. It contains the QTA, observable $\Delta$Q and calculated $\Delta$Q at time t.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/Snapshot.cpp}
\subsection{TriggerManager.cpp} \label{code:trigman}
This class is the manager of triggers for a probe. It can add/remove/evaluate triggers.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/TriggerManager.cpp}
\subsection{Triggers.cpp} \label{code:trigg}
This class contains the conditions of the triggers selected by the user. The trigger manager evaluates the conditions at runtime. The Actions namespace is WIP.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/Triggers.cpp}
\section{parser}
\subsection{SystemBuilder.cpp} \label{code:sysb}
This class builds a new outcome diagram (system class) given an AST built when parsing.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/parser/SystemBuilder.cpp}
\subsection{SystemParserInterface.cpp} \label{code:syspi}
This files contains functions to be called by the dashboard to avoid communicating directly to ANTLR. It throws errors which are caught by the caller if the parsing was unsuccessful.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/parser/SystemParserInterface.cpp}
\section{server}
\subsection{Server.cpp} \label{code:serv}
This class represents the server which receives and sends messages from Erlang.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/server/Server.cpp}
\chapter{C++ Header Files}
\section{Root}
\subsection{Application.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/Application.h}
\section{dashboard}
\subsection{ColorRegistry.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/ColorRegistry.h}
\subsection{CustomLegendEntry.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/CustomLegendEntry.h}
\subsection{CustomLegendPanel.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/CustomLegendPanel.h}
\subsection{DQPlotController.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DQPlotController.h}
\subsection{DQPlotList.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DQPlotList.h}
\subsection{DelaySettingsWidget.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DelaySettingsWidget.h}
\subsection{DeltaQPlot.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/DeltaQPlot.h}
\subsection{MainWindow.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/MainWindow.h}
\subsection{NewPlotList.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/NewPlotList.h}
\subsection{ObservableSettings.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/ObservableSettings.h}
\subsection{SamplingRateWidget.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/SamplingRateWidget.h}
\subsection{QTAInputWidget.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/QTAInputWidget.h}
\subsection{Sidebar.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/Sidebar.h}
\subsection{SnapshotViewerWindow.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/SnapshotViewerWindow.h}
\subsection{StubControlWidget.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/StubControlWidget.h}
\subsection{SystemCreationWidget.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/SystemCreationWidget.h}
\subsection{TriggersTab.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/dashboard/TriggersTab.h}
\section{diagram}
\subsection{Observable.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Observable.h}
\subsection{Operator.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Operator.h}
\subsection{OperatorType.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/OperatorType.h}
\subsection{Outcome.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Outcome.h}
\subsection{Probe.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Probe.h}
\subsection{Sample.h}
This struct represents an outcome instance.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/Sample.h}
\subsection{System.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/diagram/System.h}
\section{$\Delta$Q (maths)}
\subsection{ConfidenceInterval.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/ConfidenceInterval.h}
\subsection{DeltaQ.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/DeltaQ.h}
\subsection{DeltaQOperations.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/DeltaQOperations.h}
\subsection{DeltaQRepr.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/DeltaQRepr.h}
\subsection{QTA.h}
This class represent a sample QTA.
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/QTA.h}
\subsection{Snapshot.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/Snapshot.h}
\subsection{TriggerManager.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/TriggerManager.h}
\subsection{TriggerTypes.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/TriggerTypes.h}
\subsection{Triggers.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/maths/Triggers.h}
\section{parser}
\subsection{SystemBuilder.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/parser/SystemBuilder.h}
\subsection{SystemErrorListener.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/parser/SystemErrorListener.h}
\subsection{SystemParserInterface.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/parser/SystemParserInterface.h}
\section{server}
\subsection{Server.h}
\lstinputlisting[style=mystyle, language=C++]{../RealTimeDeltaQSD/src/server/Server.h}
\chapter{Build Configuration Files}
\section{src/CMakeLists.txt}
\lstinputlisting[style=mystyle, ]{../RealTimeDeltaQSD/src/CMakeLists.txt}
\section{dashboard/CMakeLists.txt}
\lstinputlisting[style=mystyle, ]{../RealTimeDeltaQSD/src/dashboard/CMakeLists.txt}
\section{diagram/CMakeLists.txt}
\lstinputlisting[style=mystyle, ]{../RealTimeDeltaQSD/src/diagram/CMakeLists.txt}
\section{maths/CMakeLists.txt}
\lstinputlisting[style=mystyle, ]{../RealTimeDeltaQSD/src/maths/CMakeLists.txt}
\section{parser/CMakeLists.txt}
\lstinputlisting[style=mystyle, ]{../RealTimeDeltaQSD/src/parser/CMakeLists.txt}
\section{server/CMakeLists.txt}
\lstinputlisting[style=mystyle, ]{../RealTimeDeltaQSD/src/server/CMakeLists.txt}
\chapter{Erlang Source Files}
\section{Root}
\subsection{dqsd\_otel.erl}
The $\Delta$Q adapter, it can start, fail, end spans and start and end with\_spans, communicates to the TCP client to send outcome instances to the oscilloscope.
\lstinputlisting[style=mystyle, language=erlang]{../dqsd_otel/src/dqsd_otel.erl}
\subsection{dqsd\_otel\_app.erl}
\lstinputlisting[style=mystyle, language=erlang]{../dqsd_otel/src/dqsd_otel_app.erl}
\subsection{dqsd\_otel\_sup.erl}
The supervisor of the adapter. It start the TCP server, client and adapter.
\lstinputlisting[style=mystyle, language=erlang]{../dqsd_otel/src/dqsd_otel_sup.erl}
\subsection{dqsd\_otel\_tcp\_client.erl}
The TCP client, it can send outcome instances to the oscilloscope.
\lstinputlisting[style=mystyle, language=erlang]{../dqsd_otel/src/dqsd_otel_tcp_client.erl}
\subsection{dqsd\_otel\_tcp\_server.erl}
The TCP server accepts messages from the oscilloscope and forwards them to the adapter to set the various settings.
\lstinputlisting[style=mystyle, language=erlang]{../dqsd_otel/src/dqsd_otel_tcp_server.erl}
\chapter{Erlang Application Files}
\section{Root}
\subsection{dqsd\_otel.app.src}
The app.src file of the adapter.
\lstinputlisting[style=mystyle, language=erlang]{../dqsd_otel/src/dqsd_otel.app.src}
\chapter{Synthetic Applications}
\section{Synthetic applications} \label{app:synte}
\subsection{M/M/1/K queue application} \label{app:mm1k}
\lstinputlisting[style=mystyle, language=erlang]{../RealTimeDeltaQSD/otel_getting_started/apps/otel_getting_started/src/mm1k.erl}
\subsection{First to finish application} \label{app:ftf}
\lstinputlisting[style=mystyle, language=erlang]{../RealTimeDeltaQSD/otel_getting_started/apps/otel_getting_started/src/ftf.erl}
\subsection{All to finish application} \label{app:atf}
\lstinputlisting[style=mystyle, language=erlang]{../RealTimeDeltaQSD/otel_getting_started/apps/otel_getting_started/src/atf.erl}