Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix copyright headers
[simgrid.git] / src / surf / network.c
index 2ebad7f..de86cc0 100644 (file)
@@ -1,6 +1,5 @@
-/*     $Id$     */
-
-/* Copyright (c) 2004 Arnaud Legrand. All rights reserved.                  */
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -56,6 +55,9 @@ static link_CM02_t net_link_new(char *name,
 
   xbt_dict_set(surf_network_model->resource_set, name, nw_link,
                surf_resource_free);
+#ifdef HAVE_TRACING
+  TRACE_surf_link_declaration (name, bw_initial, lat_initial);
+#endif
 
   return nw_link;
 }
@@ -234,6 +236,17 @@ static void net_update_actions_state(double now, double delta)
    */
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
+
+#ifdef HAVE_TRACING
+    xbt_dynar_t route = used_routing->get_route(action->src, action->dst);
+    link_CM02_t link;
+    unsigned int i;
+    xbt_dynar_foreach(route, i, link) {
+       TRACE_surf_link_set_utilization (link->lmm_resource.generic_resource.name,
+          action->generic_action.data, lmm_variable_getvalue(action->variable), now-delta, delta);
+    }
+#endif
+
     deltap = delta;
     if (action->latency > 0) {
       if (action->latency > deltap) {
@@ -291,6 +304,9 @@ static void net_update_resource_state(void *id,
                                 sg_bandwidth_factor *
                                 (nw_link->lmm_resource.power.peak *
                                  nw_link->lmm_resource.power.scale));
+#ifdef HAVE_TRACING
+    TRACE_surf_link_set_bandwidth (date, nw_link->lmm_resource.generic_resource.name, sg_bandwidth_factor * (nw_link->lmm_resource.power.peak * nw_link->lmm_resource.power.scale));
+#endif
     if (sg_weight_S_parameter > 0) {
       while ((var = lmm_get_var_from_cnst
               (network_maxmin_system, nw_link->lmm_resource.constraint,
@@ -446,6 +462,10 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name,
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 
+  /* saving the src and dst of this communication */
+  action->src = src;
+  action->dst = dst;
+
   XBT_OUT;
 
   return (surf_action_t) action;