diff options
Diffstat (limited to 'sources')
| -rw-r--r-- | sources/thibaut/README | 124 | ||||
| -rw-r--r-- | sources/thibaut/README.pdf | bin | 0 -> 82855 bytes |
2 files changed, 124 insertions, 0 deletions
diff --git a/sources/thibaut/README b/sources/thibaut/README new file mode 100644 index 0000000..98727e3 --- /dev/null +++ b/sources/thibaut/README @@ -0,0 +1,124 @@ +* Simulator + +** Build intructions +Inside this directory do: +#+BEGIN_SRC sh +make depend +make +#+END_SRC + +This will generate three binaries in the ~build/~ subdirectory: + * ~gentrace~: trace generator + * ~simulator~: simulator to run the pacemaker protocol on a given trace + * ~tracestats~: small tool to analyse a trace file + +You can execute any of these tools with the ~--help~ option to get the usage +line and accepted options. + +** Usage + +Classical workflow: +#+BEGIN_SRC sh +gentrace 10 10000 10x1000.trace +simulator 10x1000.trace +#+END_SRC +Generates a trace file named ~10x1000.trace~ for 1000 peers over 10 days, then +simulates Pacemaker on this trace file. + +** Traces + +At the beginning, general information with + * number of peers, number of days + * list of peers with availability and initial state (On or Off) + +A sequence of round, each starting with a ~Round~ line with round number, +followed by a sequence of connection/deconnection events + +#+BEGIN_EXAMPLE +Peers <number of peers> +Days <number of days> +Peer 0 <availability> <initial state> +Peer 1 <availability> <initial state> +... +Peer n <availability> <initial state> +Round 0 +On <peer id> +Off <peer id> +Round 1 +Off <peer id> +On <peer id> +... +#+END_EXAMPLE + +A trace round simulates one minute of real time. + +The module ~Trace~ (file ~trace.ml~) returns for a given trace file a function +simulating the connection and disconnection of peers during the trace rounds. + +The module ~Compattrace~ gives the same function for a slightly different Trace +syntax (previous version of the simulator). + +** Code structure +Other modules + * ~Globals~: global types definitions, in particular, definitions of messages used by the + protocol, peer type, SlotArray module + * ~Pacemaker~: the protocole in itself, the function ~do_peeer~ simulates the actions made + by one peer during one simulator round + * ~Mesh~: mesh construction and maintenance, by direct peer interaction (no message-passing). + the function ~do_peer~ is called for each peer during each round of the simulator + * ~Graph~: mesh analysis (breadth first search) on a peer array + +The ~simulator.ml~ pulls everything together: + * simulates the trace events every minute + * calls the ~Mesh.do_peer~ and ~Pacemaker.do_peer~ functions during each round. Peers + are executed in a random order + +** Logging +General data is exported during the simulation to the directory specified by the ~--datadir~ +option. The format of those files is specified in the header line (starting with a # sign): + * ~rounds.data~: one line per round, number of connected peers, messages exchanged + * ~mesh.data~: one line per round, repartitions of peers according to the distance + * ~simul_sessions.data~: each time a peer disconnects, print the duration of his session + and the number of proofs received + * ~proofs.data~: each time a peer receives a proof, print the peer id and round number + * ~sum.data~: at the end of the simulation, prints one line per peer, containing the real + availability and total number of proofs received + +To log more data, it suffices to add log instructions on various events: + * protocol events: in the ~process_message~ function in module ~Pacemaker~ + * connexion/deconnexion: ~read_round~ function in ~Trace~ + * mesh events: ~do_peer~ function in module ~Mesh~ + +* Pacemaker client +All the client code files are prefixed with ~client~. + +** Build instruction +#+BEGIN_SRC sh +make client +#+END_SRC +will generate a binary ~client~ in the ~build/~ subdirectory. +The ~--help~ option lists available options. + +** Usage +The client first needs to generates a unique id: +#+BEGIN_SRC sh +client --genid +#+END_SRC +will creates a file ~id.conf~ containing the unique id. + +The client also needs a configuration file containing +two lines: + * server ip address + * server listening port +By default, the client will look for the file ~client.conf~ in +current dir. + +To launch the client as a server, just add the ~--server~ flag. + +** Code structure + +** Logging +The client prints pretty much everything that is happening on the +standard output. + +* Plots diff --git a/sources/thibaut/README.pdf b/sources/thibaut/README.pdf Binary files differnew file mode 100644 index 0000000..e4f208d --- /dev/null +++ b/sources/thibaut/README.pdf |
