A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
typo
[simgrid.git]
/
examples
/
amok
/
saturate
/
saturate.c
diff --git
a/examples/amok/saturate/saturate.c
b/examples/amok/saturate/saturate.c
index 355c2ab575cb5a5c651c25df9a37ae8d1e8c7009..6734088cf98005d35b69a6f0207fd5802d0d1455 100644
(file)
--- a/
examples/amok/saturate/saturate.c
+++ b/
examples/amok/saturate/saturate.c
@@
-12,6
+12,7
@@
#include <signal.h>
#include <time.h>
#include <signal.h>
#include <time.h>
+#include "xbt/peer.h"
#include "gras.h"
#include "amok/bandwidth.h"
#include "amok/peermanagement.h"
#include "gras.h"
#include "amok/bandwidth.h"
#include "amok/peermanagement.h"
@@
-38,7
+39,7
@@
int sensor (int argc,char *argv[]) {
gras_os_sleep(2); /* let the master get ready */
master = gras_socket_client_from_string(argv[1]);
gras_os_sleep(2); /* let the master get ready */
master = gras_socket_client_from_string(argv[1]);
- amok_pm_group_join(master,"saturate");
+ amok_pm_group_join(master,"saturate"
,-1
);
amok_pm_mainloop(600);
gras_socket_close(mysock);
amok_pm_mainloop(600);
gras_socket_close(mysock);
@@
-96,7
+97,7
@@
static double XP(const char *bw1, const char *bw2,
static void kill_buddy(char *name,int port){
gras_socket_t sock=gras_socket_client(name,port);
static void kill_buddy(char *name,int port){
gras_socket_t sock=gras_socket_client(name,port);
- gras_msg_send(sock,
gras_msgtype_by_name("kill")
,NULL);
+ gras_msg_send(sock,
"kill"
,NULL);
gras_socket_close(sock);
}
static void kill_buddy_dynar(void *b) {
gras_socket_close(sock);
}
static void kill_buddy_dynar(void *b) {
@@
-124,21
+125,35
@@
static void simple_saturation(int argc, char*argv[]) {
/* wait for dudes */
gras_msg_handleall(5);
/* wait for dudes */
gras_msg_handleall(5);
+ /* Stop all sensors but two of them */
+ while (xbt_dynar_length(peers) > 2) {
+ xbt_dynar_pop(peers,&h1);
+ amok_pm_kill_hp(h1->name,h1->port);
+ xbt_peer_free(h1);
+ }
+
/* get 2 friends */
xbt_dynar_get_cpy(peers,0,&h1);
xbt_dynar_get_cpy(peers,1,&h2);
/* Start saturation */
/* get 2 friends */
xbt_dynar_get_cpy(peers,0,&h1);
xbt_dynar_get_cpy(peers,1,&h2);
/* Start saturation */
+ INFO4("Start saturation between %s:%d and %s:%d",
+ h1->name,h1->port,
+ h2->name,h2->port);
+
amok_bw_saturate_start(h1->name,h1->port,
h2->name,h2->port,
0, /* Be a nice boy, compute msg_size yourself */
30 /* 5 sec timeout */);
/* Stop it after a while */
amok_bw_saturate_start(h1->name,h1->port,
h2->name,h2->port,
0, /* Be a nice boy, compute msg_size yourself */
30 /* 5 sec timeout */);
/* Stop it after a while */
+ INFO0("Have a rest");
gras_os_sleep(1);
TRY {
gras_os_sleep(1);
TRY {
+ INFO0("Stop the saturation");
amok_bw_saturate_stop(h1->name,h1->port, &duration,&bw);
} CATCH(e) {
amok_bw_saturate_stop(h1->name,h1->port, &duration,&bw);
} CATCH(e) {
+ INFO0("Ooops, stoping the saturation raised an exception");
xbt_ex_free(e);
}
INFO2("Saturation took %.2fsec, achieving %fb/s",duration,bw);
xbt_ex_free(e);
}
INFO2("Saturation took %.2fsec, achieving %fb/s",duration,bw);
@@
-163,7
+178,7
@@
static void full_fledged_saturation(int argc, char*argv[]) {
double *bw_sat;
/* iterators */
double *bw_sat;
/* iterators */
- int i,j,k,l;
+
unsigned
int i,j,k,l;
xbt_peer_t h1,h2,h3,h4;
/* Init the group */
xbt_peer_t h1,h2,h3,h4;
/* Init the group */
@@
-184,7
+199,7
@@
static void full_fledged_saturation(int argc, char*argv[]) {
bw=amok_bw_matrix(peers,buf_size,msg_size,msg_amount,min_duration);
INFO2("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
bw=amok_bw_matrix(peers,buf_size,msg_size,msg_amount,min_duration);
INFO2("Did all BW tests in %ld sec (%.2f simulated(?) sec)",
-
time(NULL)-begin
,gras_os_time()-begin_simulated);
+
(long int) (time(NULL)-begin)
,gras_os_time()-begin_simulated);
/* Do the test with saturation */
bw_sat=xbt_new(double,nb_peers*nb_peers);
/* Do the test with saturation */
bw_sat=xbt_new(double,nb_peers*nb_peers);
@@
-228,7
+243,7
@@
static void full_fledged_saturation(int argc, char*argv[]) {
amok_bw_saturate_stop(h1->name,h1->port,&time1,&bw1);
INFO2("Did an iteration on saturation pair in %ld sec (%.2f simulated sec)",
amok_bw_saturate_stop(h1->name,h1->port,&time1,&bw1);
INFO2("Did an iteration on saturation pair in %ld sec (%.2f simulated sec)",
-
time(NULL)-begin
, gras_os_time()-begin_simulated);
+
(long int) (time(NULL)-begin)
, gras_os_time()-begin_simulated);
INFO2("the duration of the experiment >>>>> %.3f sec (%.3f bandwidth)",time1,bw1);
}
}
INFO2("the duration of the experiment >>>>> %.3f sec (%.3f bandwidth)",time1,bw1);
}
}