Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] instrumenting network lazy updates
[simgrid.git] / src / surf / network.c
index d325f8a..85b0f83 100644 (file)
@@ -611,6 +611,23 @@ static void net_update_actions_state_lazy(double now, double delta)
     action = xbt_heap_pop(net_action_heap);
     XBT_DEBUG("Action %p: finish", action);
     GENERIC_ACTION(action).finish = surf_get_clock();
+#ifdef HAVE_TRACING
+    if (TRACE_is_enabled()) {
+      int n = lmm_get_number_of_cnst_from_var(network_maxmin_system, GENERIC_LMM_ACTION(action).variable);
+      unsigned int i;
+      for (i = 0; i < n; i++){
+        lmm_constraint_t constraint = lmm_get_cnst_from_var(network_maxmin_system,
+                                                            GENERIC_LMM_ACTION(action).variable,
+                                                            i);
+        link_CM02_t link = lmm_constraint_id(constraint);
+        TRACE_surf_link_set_utilization(link->lmm_resource.generic_resource.name,
+                                        ((surf_action_t)action)->category,
+                                        lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable),
+                                        GENERIC_LMM_ACTION(action).last_update,
+                                        now - GENERIC_LMM_ACTION(action).last_update);
+      }
+    }
+#endif
 
     // if I am wearing a latency hat
     if (GENERIC_LMM_ACTION(action).hat == LATENCY) {
@@ -1109,10 +1126,6 @@ static void surf_network_model_init_internal(void)
 
 static void set_update_mechanism(void)
 {
-#ifdef HAVE_TRACING
-  TRACE_set_network_update_mechanism();
-#endif
-
   char *optim = xbt_cfg_get_string(_surf_cfg_set, "network/optim");
   int select =
       xbt_cfg_get_int(_surf_cfg_set, "network/maxmin_selective_update");