Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Let's be really verbose about what gets copied on the socket
[simgrid.git] / src / gras / DataDesc / ddt_exchange.c
index c1e6d5d..effcd84 100644 (file)
@@ -13,7 +13,7 @@
 #include "gras/DataDesc/datadesc_private.h"
 #include "gras/Transport/transport_interface.h" /* gras_trp_send/recv */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_exchange,datadesc,
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_exchange,gras_ddt,
                                 "Sending data over the network");
 const char *gras_datadesc_cat_names[9] = { 
   "undefined", 
@@ -122,8 +122,8 @@ gras_datadesc_copy_rec(gras_cbps_t           state,
 
   VERB4("Copy a %s (%s) from %p to %p", 
        type->name, gras_datadesc_cat_names[type->category_code],
-       src,dst);
-
+       src,dst);       
+   
   if (type->send) {
     type->send(type,state,src);
   }
@@ -157,6 +157,22 @@ gras_datadesc_copy_rec(gras_cbps_t           state,
       VERB1("Copy field %s",field->name);
       count += gras_datadesc_copy_rec(state,refs,sub_type, field_src, field_dst, 0,
                                      detect_cycle || sub_type->cycle);
+       
+       if (XBT_LOG_ISENABLED(gras_ddt_exchange,xbt_log_priority_debug)) {
+         if (sub_type == gras_datadesc_by_name("unsigned int")) {
+            DEBUG2("Copied value for field %s: %d (type: unsigned int)",field->name, *(unsigned int*)field_dst);
+         } else if (sub_type == gras_datadesc_by_name("int")) {
+            DEBUG2("Copied value for field %s: %d (type: int)",field->name, *(int*)field_dst);
+            
+         } else if (sub_type == gras_datadesc_by_name("unsigned long int")) {
+            DEBUG2("Copied value for field %s: %ld (type: unsigned long int)",field->name, *(unsigned long int*)field_dst);
+         } else if (sub_type == gras_datadesc_by_name("long int")) {
+            DEBUG2("Copied value for field %s: %ld (type: long int)",field->name, *(long int*)field_dst);
+
+         } else if (sub_type == gras_datadesc_by_name("string")) {
+            DEBUG2("Copied value for field %s: '%s' (type: string)", field->name, *(char**)field_dst);  
+         }
+       }
       
     }
     VERB1("<< Copied all fields of the structure %s", type->name);
@@ -338,6 +354,7 @@ gras_datadesc_copy_rec(gras_cbps_t           state,
   default:
     xbt_assert0(0, "Invalid type");
   }
+   
   return count;
 }
 /**
@@ -390,8 +407,12 @@ gras_datadesc_send_rec(gras_socket_t         sock,
   VERB2("Send a %s (%s)", 
        type->name, gras_datadesc_cat_names[type->category_code]);
 
+  if (!strcmp(type->name,"string"))
+    VERB1("value: '%s'",*(char**)data);
+
   if (type->send) {
     type->send(type,state,data);
+    DEBUG0("Run the emission callback");
   }
 
   switch (type->category_code) {
@@ -415,8 +436,10 @@ gras_datadesc_send_rec(gras_socket_t         sock,
       
       sub_type = field->type;
       
-      if (field->send)
+      if (field->send) {
+       DEBUG1("Run the emission callback of field %s", field->name);
        field->send(type,state,field_data);
+      }
       
       VERB1("Send field %s",field->name);
       gras_datadesc_send_rec(sock,state,refs,sub_type, field_data, 
@@ -669,8 +692,10 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
                             field_data,-1, 
                             detect_cycle || sub_type->cycle);
        
-      if (field->recv)
+      if (field->recv) {
+       DEBUG1("Run the reception callback of field %s", field->name);
         field->recv(type,state,(void*)l_data);
+      }
     
     }
     VERB1("<< Received all fields of the structure %s", type->name);
@@ -897,6 +922,9 @@ gras_datadesc_recv_rec(gras_socket_t         sock,
   if (type->recv)
     type->recv(type,state,l_data);
 
+  if (!strcmp(type->name,"string"))
+    VERB1("value: '%s'",*(char**)l_data);
+
 }
 
 /**