Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
slight change to the dump function
[simgrid.git] / src / simdag / sd_workstation.c
index 1f15df9..79a7099 100644 (file)
@@ -157,6 +157,43 @@ xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation)
 
 }
 
+/** @brief Displays debugging informations about a workstation */
+void SD_workstation_dump(SD_workstation_t ws)
+{
+  xbt_dict_t props;
+  xbt_dict_cursor_t cursor=NULL;
+  char *key,*data;
+  SD_task_t task = NULL;
+  
+  XBT_INFO("Displaying workstation %s", SD_workstation_get_name(ws));
+  XBT_INFO("  - power: %.0f", SD_workstation_get_power(ws));
+  XBT_INFO("  - available power: %.2f", SD_workstation_get_available_power(ws));
+  switch (ws->access_mode){
+  case SD_WORKSTATION_SHARED_ACCESS:
+      XBT_INFO("  - access mode: Space shared");
+      break;
+  case SD_WORKSTATION_SEQUENTIAL_ACCESS:
+      XBT_INFO("  - access mode: Exclusive");
+         task = SD_workstation_get_current_task(ws);
+         if(task)
+           XBT_INFO("    current running task: %s",
+                        SD_task_get_name(task));
+         else
+           XBT_INFO("    no task running");
+      break;
+  default:
+         XBT_INFO("  - (unknown access mode)");
+  }
+  props = SD_workstation_get_properties(ws);
+  
+  if (!xbt_dict_is_empty(props)){
+    XBT_INFO("  - properties:");
+
+    xbt_dict_foreach(props,cursor,key,data) {
+      XBT_INFO("    %s->%s",key,data);
+    }
+  }
+}
 
 /**
  * \brief Returns the route between two workstations
@@ -254,7 +291,7 @@ double SD_workstation_get_computation_time(SD_workstation_t workstation,
 }
 
 /**
- * \brief Returns the latency of the route between two workstations, i.e. the sum of all link latencies
+ * \brief Returns the latency of the route between two workstations, i.e. the sum of all link latencies
  * between the workstations.
  *
  * \param src the first workstation
@@ -283,7 +320,7 @@ double SD_route_get_current_latency(SD_workstation_t src,
 }
 
 /**
- * \brief Returns the bandwidth of the route between two workstations, i.e. the minimum link bandwidth of all
+ * \brief Returns the bandwidth of the route between two workstations, i.e. the minimum link bandwidth of all
  * between the workstations.
  *
  * \param src the first workstation