summaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorthibauth <thibauth@30fcff6e-8de6-41c7-acce-77ff6d1dd07b>2011-07-11 22:02:27 +0000
committerthibauth <thibauth@30fcff6e-8de6-41c7-acce-77ff6d1dd07b>2011-07-11 22:02:27 +0000
commit0c363a757aa0ccb142930fb930349ea3719d0900 (patch)
tree11894e986bbcfccef03066fa0fd5a9adb2ea0d76 /sources
parentf155dc8631380f8c9a8e8c3758d4ff27da06e528 (diff)
downloadpacemaker-0c363a757aa0ccb142930fb930349ea3719d0900.tar.gz
Print more stats, new graph.
Less flushes in the dumping. git-svn-id: https://scm.gforge.inria.fr/svn/pacemaker@40 30fcff6e-8de6-41c7-acce-77ff6d1dd07b
Diffstat (limited to 'sources')
-rw-r--r--sources/thibaut/globals.ml4
-rw-r--r--sources/thibaut/plot.py17
-rw-r--r--sources/thibaut/simulator.ml27
-rw-r--r--sources/thibaut/trace.ml15
4 files changed, 41 insertions, 22 deletions
diff --git a/sources/thibaut/globals.ml b/sources/thibaut/globals.ml
index f798a08..5015f96 100644
--- a/sources/thibaut/globals.ml
+++ b/sources/thibaut/globals.ml
@@ -245,7 +245,9 @@ type peer = {
mutable history : (int * (int HashMap.t list)) RoundMap.t; (* seed, branch *)
mutable distance : int;
mutable connection_time : int;
- mutable nproofs : int
+ mutable nproofs : int;
+ mutable real_avail : int;
+ mutable proofs : int
}
and slot = peer SlotArray.slot
diff --git a/sources/thibaut/plot.py b/sources/thibaut/plot.py
index f696822..aefa5ab 100644
--- a/sources/thibaut/plot.py
+++ b/sources/thibaut/plot.py
@@ -24,15 +24,12 @@ plt.hist(a, bins=100,range=(0,1))
plt.savefig(os.path.join(dirname, "avail.png"))
plt.cla()
-simul_sessions = os.path.join(dirname, "simul_sessions.data")
-duration, proofs = np.loadtxt(simul_sessions, unpack = True, usecols=(1,2))
-nsessions = 0
-result = 0
-for i in range(len(duration)):
- if duration[i] >= 20:
- nsessions = nsessions + 1
- if proofs[i] >= math.floor(duration[i]/10) -1:
- result = result + 1
+ss = os.path.join(dirname, "
+simul_sessions = os.path.join(dirname, "sum.data")
+a,b = np.loadtxt(simul_sessions, unpack=True, usecols=(1,2))
+plt.plot(a)
+plt.plot(b*10)
+plt.show()
+#for i in xrange(len(duration)):
-print float(result)/nsessions
diff --git a/sources/thibaut/simulator.ml b/sources/thibaut/simulator.ml
index 8f1ad44..69990d5 100644
--- a/sources/thibaut/simulator.ml
+++ b/sources/thibaut/simulator.ml
@@ -70,6 +70,7 @@ let oc = open_out (Filename.concat !outputdir "rounds.data")
let mesh_oc = open_out (Filename.concat !outputdir "mesh.data")
let sessions_oc = open_out (Filename.concat !outputdir "simul_sessions.data")
let proofs_oc = open_out (Filename.concat !outputdir "proofs.data")
+let sum_oc = open_out (Filename.concat !outputdir "sum.data")
let npeers, days = Trace.read_info ic
@@ -84,7 +85,9 @@ let peers = Array.init npeers
history = RoundMap.empty;
distance = -1;
connection_time = 0;
- nproofs = 0
+ nproofs = 0;
+ real_avail = 0;
+ proofs = 0
} in
p )
@@ -99,9 +102,9 @@ let round = ref 0
let connected = ref 0
let _ =
- Printf.fprintf oc "#minute connected messages asks askroots\n%!";
- Printf.fprintf mesh_oc "#minute connected old repart\n%!";
- Printf.fprintf sessions_oc "#id duration nproofs\n%!";
+ Printf.fprintf oc "#minute connected messages asks askroots\n";
+ Printf.fprintf mesh_oc "#minute connected old repart\n";
+ Printf.fprintf sessions_oc "#id duration nproofs\n";
Printf.fprintf proofs_oc "#id round\n%!";
for i = 0 to (nticks-1) do
@@ -146,7 +149,7 @@ let _ =
update_distances peers tracking_array;
if i mod !tpm = 0 then begin
- Printf.fprintf oc "%d %d %d %d %d\n%!"
+ Printf.fprintf oc "%d %d %d %d %d\n"
(i/(!tpm))
!connected
!Pacemaker.messages
@@ -157,12 +160,24 @@ let _ =
for i = 0 to Array.length rep - 1 do
Printf.fprintf mesh_oc "%d " rep.(i)
done;
- Printf.fprintf mesh_oc "\n%!";
+ Printf.fprintf mesh_oc "\n";
Mesh.ask := 0;
Mesh.askroot := 0;
end
done;
+ let comp p q = compare p.real_avail q.real_avail in
+ Array.sort comp peers;
+ for i = 0 to npeers-1 do
+ let p = peers.(i) in
+ Printf.fprintf sum_oc "%d %d %d\n" p.id p.real_avail p.proofs
+ done;
+ close_in ic;
+ close_out oc;
+ close_out mesh_oc;
+ close_out sessions_oc;
+ close_out proofs_oc;
+ close_out sum_oc;
print_newline ();
diff --git a/sources/thibaut/trace.ml b/sources/thibaut/trace.ml
index 1d1cbf3..e7a6e06 100644
--- a/sources/thibaut/trace.ml
+++ b/sources/thibaut/trace.ml
@@ -59,11 +59,16 @@ let read_info ic =
let disconnect oc round peer =
SlotArray.clear peer.Globals.slots;
let duration = round - peer.connection_time in
- if duration > 0 then
- Printf.fprintf oc "%d %d %d\n%!" peer.Globals.id duration peer.nproofs;
- peer.con_state <- OFF;
- peer.distance <- -1;
- peer.nproofs <- 0
+ if duration > 0 then
+ Printf.fprintf oc "%d %d %d\n" peer.Globals.id duration peer.nproofs;
+ if duration > 20 then begin
+ peer.real_avail <- peer.real_avail + duration - 5;
+ peer.proofs <- peer.proofs + peer.nproofs;
+ end;
+ peer.con_state <- OFF;
+ peer.distance <- -1;
+ peer.nproofs <- 0
+
let read oc ic tracking peers =
let npeers = Array.length peers in