Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Chord: display the number of messages created
authorthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 8 Feb 2011 17:37:22 +0000 (17:37 +0000)
committerthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 8 Feb 2011 17:37:22 +0000 (17:37 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9592 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/chord/chord.c
src/simix/smx_network.c

index 2ca3ac6..307d519 100644 (file)
@@ -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();
 
index 0fe6778..d5dba6a 100644 (file)
@@ -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;
 }