From: thiery Date: Tue, 8 Feb 2011 17:37:22 +0000 (+0000) Subject: Chord: display the number of messages created X-Git-Tag: v3.6_beta2~337 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5a918cbd59f64eddf384ac657201057ac311633a Chord: display the number of messages created git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9592 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index 2ca3ac68c8..307d519eea 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -27,6 +27,8 @@ static int periodic_fix_fingers_delay = 120; static int periodic_check_predecessor_delay = 120; static int periodic_lookup_delay = 10; +extern long int smx_total_comms; + /** * Finger element. */ @@ -390,6 +392,7 @@ int node(int argc, char *argv[]) // stop the simulation xbt_free(node.fingers); + INFO1("Messages created: %lu", smx_total_comms); return 0; } @@ -502,6 +505,11 @@ static int join(node_t node, int known_id) INFO2("Joining the ring with id %d, knowing node %d", node->id, known_id); set_predecessor(node, -1); // no predecessor (yet) + int i; + for (i = 0; i < nb_bits; i++) { + set_finger(node, i, known_id); + } + int successor_id = remote_find_successor(node, known_id, node->id); if (successor_id == -1) { INFO0("Cannot join the ring."); @@ -921,7 +929,7 @@ int main(int argc, char *argv[]) MSG_launch_application(application_file); MSG_error_t res = MSG_main(); - INFO1("Simulation time: %g", MSG_get_clock()); + INFO1("Simulated time: %g", MSG_get_clock()); MSG_clean(); diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 0fe6778674..d5dba6a0e9 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -13,6 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "Logging specific to SIMIX (network)"); static xbt_dict_t rdv_points = NULL; +unsigned long int smx_total_comms = 0; static XBT_INLINE void SIMIX_comm_start(smx_action_t action); static void SIMIX_comm_finish(smx_action_t action); @@ -182,6 +183,7 @@ smx_action_t SIMIX_comm_new(e_smx_comm_type_t type) #endif DEBUG1("Create communicate action %p", act); + ++smx_total_comms; return act; }