File: code_design.rst

package info (click to toggle)
sbws 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,084 kB
  • sloc: python: 10,432; sh: 146; makefile: 38
file content (62 lines) | stat: -rw-r--r-- 1,375 bytes parent folder | download | duplicates (3)
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
.. _code_design:

Code design
===========

.. todo::
   - Link to refactor proposal.
   - Change this page when refactoring is implemented.

UML classes diagram
--------------------

.. image:: images/classes_original.*
   :alt: UML classes diagram

`classes_original.svg <./_images/classes_original.svg>`_

Packages diagram
-----------------

.. image:: ./images/packages_sbws.*
   :alt: packages diagram

`packages_sbws.svg <./_images/packages_sbws.svg>`_

scanner threads
----------------

- `TorEventListener`: the thread that runs Tor and listens for events.
- ResultDump: the thread that get the measurement results from a queue
  every second.
- `multiprocessing.ThreadPool` starts 3 independent threads:
  - workers_thread
  - tasks_thread
  - results_thread
- measurement threads: they execute :func:`sbws.core.scanner.measure_relay`
  There'll be a maximum of 3 by default.

.. image:: images/threads.*
   :alt: scanner threads

Critical sections
-----------------

Data types that are read or wrote from the threads.

.. image:: images/critical_sections.*
   :alt: scanner critical sections
   :height: 400px
   :align: center

Call graph
--------------

Initialization calls to the moment where the measurement threads start.

.. image:: images/pycallgraph.png
   :alt: call graph
   :height: 400px
   :align: center

`callgraph.png <./_images/pycallgraph.png>`_