Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a model object to the arguments of callbacks
authorTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Thu, 14 Feb 2013 16:49:55 +0000 (17:49 +0100)
committerTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Thu, 14 Feb 2013 16:49:55 +0000 (17:49 +0100)
For VM support, we have multiple cpu model objects on the system. The
object of a surf model may not be only one on the system. Thus, we have
to modify the code that assumes the system has only one global object of
each surf model.

We add a model object to the first argument of the callbacks of struct
surf_model_private; i.e., share_resources(), update_actions_state(), and
finalize(). In each callbacks, we delete the use of the global model
object.

13 files changed:
src/surf/cpu_cas01.c
src/surf/cpu_ti.c
src/surf/network.c
src/surf/network_constant.c
src/surf/network_gtnets.c
src/surf/network_ns3.c
src/surf/new_model.c
src/surf/storage.c
src/surf/surf.c
src/surf/surf_private.h
src/surf/vm_workstation.c
src/surf/workstation.c
src/surf/workstation_ptask_L07.c

index 7b28931..01e5d1d 100644 (file)
@@ -139,30 +139,30 @@ static int cpu_resource_used(void *resource)
                              ((cpu_Cas01_t) resource)->constraint);
 }
 
-static double cpu_share_resources_lazy(double now)
+static double cpu_share_resources_lazy(surf_model_t cpu_model, double now)
 {
-  return generic_share_resources_lazy(now, surf_cpu_model);
+  return generic_share_resources_lazy(now, cpu_model);
 }
 
-static double cpu_share_resources_full(double now)
+static double cpu_share_resources_full(surf_model_t cpu_model, double now)
 {
   s_surf_action_cpu_Cas01_t action;
-  return generic_maxmin_share_resources(surf_cpu_model->states.
+  return generic_maxmin_share_resources(cpu_model->states.
                                         running_action_set,
                                         xbt_swag_offset(action,
                                                         generic_lmm_action.
                                                         variable),
-                                        surf_cpu_model->model_private->maxmin_system, lmm_solve);
+                                        cpu_model->model_private->maxmin_system, lmm_solve);
 }
 
-static void cpu_update_actions_state_lazy(double now, double delta)
+static void cpu_update_actions_state_lazy(surf_model_t cpu_model, double now, double delta)
 {
-  generic_update_actions_state_lazy(now, delta, surf_cpu_model);
+  generic_update_actions_state_lazy(now, delta, cpu_model);
 }
 
-static void cpu_update_actions_state_full(double now, double delta)
+static void cpu_update_actions_state_full(surf_model_t cpu_model, double now, double delta)
 {
-  generic_update_actions_state_full(now, delta, surf_cpu_model);
+  generic_update_actions_state_full(now, delta, cpu_model);
 }
 
 static void cpu_update_resource_state(void *id,
@@ -304,17 +304,17 @@ static double cpu_get_available_speed(void *cpu)
   return ((cpu_Cas01_t)surf_cpu_resource_priv(cpu))->power_scale;
 }
 
-static void cpu_finalize(void)
+static void cpu_finalize(surf_model_t cpu_model)
 {
-  lmm_system_free(surf_cpu_model->model_private->maxmin_system);
-  surf_cpu_model->model_private->maxmin_system = NULL;
+  lmm_system_free(cpu_model->model_private->maxmin_system);
+  cpu_model->model_private->maxmin_system = NULL;
 
-  if (surf_cpu_model->model_private->action_heap)
-    xbt_heap_free(surf_cpu_model->model_private->action_heap);
-  xbt_swag_free(surf_cpu_model->model_private->modified_set);
+  if (cpu_model->model_private->action_heap)
+    xbt_heap_free(cpu_model->model_private->action_heap);
+  xbt_swag_free(cpu_model->model_private->modified_set);
 
-  surf_model_exit(surf_cpu_model);
-  surf_cpu_model = NULL;
+  surf_model_exit(cpu_model);
+  cpu_model = NULL;
 
   xbt_swag_free(cpu_running_action_set_that_does_not_need_being_checked);
   cpu_running_action_set_that_does_not_need_being_checked = NULL;
index b44fd4d..5535c64 100644 (file)
@@ -311,7 +311,7 @@ static void cpu_ti_action_state_set(surf_action_t action,
 * \param  cpu    Cpu on which the actions are running
 * \param  now    Current time
 */
-static void cpu_ti_update_remaining_amount(cpu_ti_t cpu, double now)
+static void cpu_ti_update_remaining_amount(surf_model_t cpu_model, cpu_ti_t cpu, double now)
 {
   double area_total;
   surf_action_cpu_ti_t action;
@@ -331,7 +331,7 @@ static void cpu_ti_update_remaining_amount(cpu_ti_t cpu, double now)
     surf_action_t generic = (surf_action_t)action;
     /* action not running, skip it */
     if (generic->state_set !=
-        surf_cpu_model->states.running_action_set)
+        cpu_model->states.running_action_set)
       continue;
 
     /* bogus priority, skip it */
@@ -368,19 +368,19 @@ static void cpu_ti_update_remaining_amount(cpu_ti_t cpu, double now)
 * \param  cpu    Cpu on which the actions are running
 * \param  now    Current time
 */
-static void cpu_ti_update_action_finish_date(cpu_ti_t cpu, double now)
+static void cpu_ti_update_action_finish_date(surf_model_t cpu_model, cpu_ti_t cpu, double now)
 {
 #define GENERIC_ACTION(action) action->generic_action
   surf_action_cpu_ti_t action;
   double sum_priority = 0.0, total_area, min_finish = -1;
 
 /* update remaning amount of actions */
-  cpu_ti_update_remaining_amount(cpu, now);
+  cpu_ti_update_remaining_amount(cpu_model, cpu, now);
 
   xbt_swag_foreach(action, cpu->action_set) {
     /* action not running, skip it */
     if (GENERIC_ACTION(action).state_set !=
-        surf_cpu_model->states.running_action_set)
+        cpu_model->states.running_action_set)
       continue;
 
     /* bogus priority, skip it */
@@ -399,7 +399,7 @@ static void cpu_ti_update_action_finish_date(cpu_ti_t cpu, double now)
     min_finish = -1;
     /* action not running, skip it */
     if (GENERIC_ACTION(action).state_set !=
-        surf_cpu_model->states.running_action_set)
+        cpu_model->states.running_action_set)
       continue;
 
     /* verify if the action is really running on cpu */
@@ -451,14 +451,20 @@ static void cpu_ti_update_action_finish_date(cpu_ti_t cpu, double now)
 #undef GENERIC_ACTION
 }
 
-static double cpu_ti_share_resources(double now)
+static double cpu_ti_share_resources(surf_model_t cpu_model, double now)
 {
   cpu_ti_t cpu, cpu_next;
   double min_action_duration = -1;
 
 /* iterates over modified cpus to update share resources */
   xbt_swag_foreach_safe(cpu, cpu_next, cpu_ti_modified_cpu) {
-    cpu_ti_update_action_finish_date(cpu, now);
+    /* FIXME: cpu_ti_modified_cpu is a global object. But, now we have multiple
+     * cpu_model objects in the system. Do we have to create this
+     * swag for each cpu model object?
+     *
+     * We should revisit here after we know what cpu_ti is.
+     **/
+    cpu_ti_update_action_finish_date(cpu_model, cpu, now);
   }
 /* get the min next event if heap not empty */
   if (xbt_heap_size(cpu_ti_action_heap) > 0)
@@ -469,8 +475,10 @@ static double cpu_ti_share_resources(double now)
   return min_action_duration;
 }
 
-static void cpu_ti_update_actions_state(double now, double delta)
+static void cpu_ti_update_actions_state(surf_model_t cpu_model, double now, double delta)
 {
+  /* FIXME: cpu_ti_action_heap is global. Is this okay for VM support? */
+
 #define GENERIC_ACTION(action) action->generic_action
   surf_action_cpu_ti_t action;
   while ((xbt_heap_size(cpu_ti_action_heap) > 0)
@@ -482,7 +490,7 @@ static void cpu_ti_update_actions_state(double now, double delta)
     GENERIC_ACTION(action).remains = 0;
     cpu_ti_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
     /* update remaining amout of all actions */
-    cpu_ti_update_remaining_amount(surf_cpu_resource_priv(action->cpu), surf_get_clock());
+    cpu_ti_update_remaining_amount(cpu_model, surf_cpu_resource_priv(action->cpu), surf_get_clock());
   }
 #undef GENERIC_ACTION
 }
@@ -729,12 +737,15 @@ static double cpu_ti_get_available_speed(void *cpu)
   return CPU->power_scale;
 }
 
-static void cpu_ti_finalize(void)
+static void cpu_ti_finalize(surf_model_t cpu_model)
 {
   void **cpu;
   xbt_lib_cursor_t cursor;
   char *key;
 
+  /* FIXME: we should update this code for VM support */
+  xbt_abort();
+
   xbt_lib_foreach(host_lib, cursor, key, cpu){
     if(cpu[SURF_CPU_LEVEL])
     {
@@ -744,8 +755,8 @@ static void cpu_ti_finalize(void)
     }
   }
 
-  surf_model_exit(surf_cpu_model);
-  surf_cpu_model = NULL;
+  surf_model_exit(cpu_model);
+  cpu_model = NULL;
 
   xbt_swag_free
       (cpu_ti_running_action_set_that_does_not_need_being_checked);
index b83aeee..b64149b 100644 (file)
@@ -325,18 +325,18 @@ int net_get_link_latency_limited(surf_action_t action)
 }
 #endif
 
-static double net_share_resources_full(double now)
+static double net_share_resources_full(surf_model_t network_model, double now)
 {
   s_surf_action_lmm_t s_action;
   surf_action_network_CM02_t action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->states.running_action_set;
+      network_model->states.running_action_set;
   double min;
 
   min = generic_maxmin_share_resources(running_actions,
                                        xbt_swag_offset(s_action,
                                                        variable),
-                                                       surf_network_model->model_private->maxmin_system,
+                                                       network_model->model_private->maxmin_system,
                                        network_solve);
 
 #define VARIABLE(action) (*((lmm_variable_t*)(((char *) (action)) + xbt_swag_offset(s_action, variable)  )))
@@ -359,19 +359,19 @@ static double net_share_resources_full(double now)
   return min;
 }
 
-static double net_share_resources_lazy(double now)
+static double net_share_resources_lazy(surf_model_t network_model, double now)
 {
-  return generic_share_resources_lazy(now, surf_network_model);
+  return generic_share_resources_lazy(now, network_model);
 }
 
-static void net_update_actions_state_full(double now, double delta)
+static void net_update_actions_state_full(surf_model_t network_model, double now, double delta)
 {
-  generic_update_actions_state_full(now, delta, surf_network_model);
+  generic_update_actions_state_full(now, delta, network_model);
 }
 
-static void net_update_actions_state_lazy(double now, double delta)
+static void net_update_actions_state_lazy(surf_model_t network_model, double now, double delta)
 {
-  generic_update_actions_state_lazy(now, delta, surf_network_model);
+  generic_update_actions_state_lazy(now, delta, network_model);
 }
 
 static void net_update_resource_state(void *id,
@@ -652,18 +652,18 @@ static int net_link_shared(const void *link)
       lmm_constraint_is_shared(((surf_resource_lmm_t) link)->constraint);
 }
 
-static void net_finalize(void)
+static void net_finalize(surf_model_t network_model)
 {
-  lmm_system_free(surf_network_model->model_private->maxmin_system);
-  surf_network_model->model_private->maxmin_system = NULL;
+  lmm_system_free(network_model->model_private->maxmin_system);
+  network_model->model_private->maxmin_system = NULL;
 
-  if (surf_network_model->model_private->update_mechanism == UM_LAZY) {
-    xbt_heap_free(surf_network_model->model_private->action_heap);
-    xbt_swag_free(surf_network_model->model_private->modified_set);
+  if (network_model->model_private->update_mechanism == UM_LAZY) {
+    xbt_heap_free(network_model->model_private->action_heap);
+    xbt_swag_free(network_model->model_private->modified_set);
   }
 
-  surf_model_exit(surf_network_model);
-  surf_network_model = NULL;
+  surf_model_exit(network_model);
+  network_model = NULL;
 
   if (smpi_bw_factor)
     xbt_dynar_free(&smpi_bw_factor);
index 5dcff1b..2abef0e 100644 (file)
@@ -50,11 +50,11 @@ static void netcste_action_cancel(surf_action_t action)
   return;
 }
 
-static double netcste_share_resources(double now)
+static double netcste_share_resources(surf_model_t network_model, double now)
 {
   surf_action_network_Constant_t action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->states.running_action_set;
+      network_model->states.running_action_set;
   double min = -1.0;
 
   xbt_swag_foreach(action, running_actions) {
@@ -69,12 +69,12 @@ static double netcste_share_resources(double now)
   return min;
 }
 
-static void netcste_update_actions_state(double now, double delta)
+static void netcste_update_actions_state(surf_model_t network_model, double now, double delta)
 {
   surf_action_network_Constant_t action = NULL;
   surf_action_network_Constant_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->states.running_action_set;
+      network_model->states.running_action_set;
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
     if (action->latency > 0) {
@@ -91,12 +91,12 @@ static void netcste_update_actions_state(double now, double delta)
 
     if (action->generic_action.remains <= 0) {
       action->generic_action.finish = surf_get_clock();
-      surf_network_model->action_state_set((surf_action_t) action,
+      network_model->action_state_set((surf_action_t) action,
                                            SURF_ACTION_DONE);
     } else if ((action->generic_action.max_duration != NO_MAX_DURATION)
                && (action->generic_action.max_duration <= 0)) {
       action->generic_action.finish = surf_get_clock();
-      surf_network_model->action_state_set((surf_action_t) action,
+      network_model->action_state_set((surf_action_t) action,
                                            SURF_ACTION_DONE);
     }
   }
@@ -181,10 +181,10 @@ static int netcste_action_is_suspended(surf_action_t action)
   return ((surf_action_network_Constant_t) action)->suspended;
 }
 
-static void netcste_finalize(void)
+static void netcste_finalize(surf_model_t network_model)
 {
-  surf_model_exit(surf_network_model);
-  surf_network_model = NULL;
+  surf_model_exit(network_model);
+  network_model = NULL;
 }
 
 
index 8207982..d557573 100644 (file)
@@ -196,7 +196,7 @@ static void action_state_set(surf_action_t action,
   surf_action_state_set(action, state);
 }
 
-static double share_resources(double now)
+static double share_resources(surf_model_t network_model, double now)
 {
   xbt_swag_t running_actions =
       surf_network_model->states.running_action_set;
@@ -216,11 +216,11 @@ static double share_resources(double now)
   return time_to_next_flow_completion;
 }
 
-static void update_actions_state(double now, double delta)
+static void update_actions_state(surf_model_t network_model, double now, double delta)
 {
   surf_action_network_GTNETS_t action = NULL;
   xbt_swag_t running_actions =
-      surf_network_model->states.running_action_set;
+      network_model->states.running_action_set;
 
   /* If there are no running flows, just return */
   if (time_to_next_flow_completion < 0.0) {
@@ -400,7 +400,7 @@ static void gtnets_action_set_category(surf_action_t action, const char *categor
 }
 #endif
 
-static void finalize(void)
+static void finalize(surf_model_t network_model)
 {
   gtnets_finalize();
 }
index e180da0..dd48b10 100644 (file)
@@ -23,9 +23,9 @@ extern xbt_dict_t dict_socket;
 
 static double time_to_next_flow_completion = -1;
 
-static double ns3_share_resources(double min);
-static void ns3_update_actions_state(double now, double delta);
-static void finalize(void);
+static double ns3_share_resources(surf_model_t network_model, double min);
+static void ns3_update_actions_state(surf_model_t network_model, double now, double delta);
+static void finalize(surf_model_t network_model);
 static surf_action_t ns3_communicate(sg_routing_edge_t src_elm,
                                      sg_routing_edge_t dst_elm,
                                      double size, double rate);
@@ -380,19 +380,19 @@ void surf_network_model_init_NS3()
 #endif
 }
 
-static void finalize(void)
+static void finalize(surf_model_t network_model)
 {
   ns3_finalize();
   xbt_dynar_free_container(&IPV4addr);
   xbt_dict_free(&dict_socket);
 }
 
-static double ns3_share_resources(double min)
+static double ns3_share_resources(surf_model_t network_model, double min)
 {
   XBT_DEBUG("ns3_share_resources");
 
   xbt_swag_t running_actions =
-    surf_network_model->states.running_action_set;
+    network_model->states.running_action_set;
 
   //get the first relevant value from the running_actions list
   if (!xbt_swag_size(running_actions) || min == 0.0)
@@ -411,7 +411,7 @@ static double ns3_share_resources(double min)
   return time_to_next_flow_completion;
 }
 
-static void ns3_update_actions_state(double now, double delta)
+static void ns3_update_actions_state(surf_model_t network_model, double now, double delta)
 {
   xbt_dict_cursor_t cursor = NULL;
   char *key;
@@ -422,7 +422,7 @@ static void ns3_update_actions_state(double now, double delta)
 
   surf_action_network_ns3_t action = NULL;
   xbt_swag_t running_actions =
-    surf_network_model->states.running_action_set;
+    network_model->states.running_action_set;
 
   /* If there are no running flows, just return */
   if (!xbt_swag_size(running_actions)) {
index ea2b572..76ed586 100644 (file)
@@ -48,25 +48,25 @@ static void* new_model_create_resource(const char* id, const char* model,const c
   return NULL;
 }
 
-static void new_model_finalize(void)
+static void new_model_finalize(surf_model_t new_model)
 {
   lmm_system_free(new_model_maxmin_system);
   new_model_maxmin_system = NULL;
 
-  surf_model_exit(surf_new_model);
-  surf_new_model = NULL;
+  surf_model_exit(new_model);
+  new_model = NULL;
 
   xbt_swag_free
       (new_model_running_action_set_that_does_not_need_being_checked);
   new_model_running_action_set_that_does_not_need_being_checked = NULL;
 }
 
-static void new_model_update_actions_state(double now, double delta)
+static void new_model_update_actions_state(surf_model_t new_model, double now, double delta)
 {
   return;
 }
 
-static double new_model_share_resources(double NOW)
+static double new_model_share_resources(surf_model_t new_model, double NOW)
 {
   return -1;
 }
index 6c4e2ab..12f8c56 100644 (file)
@@ -269,13 +269,13 @@ static void* storage_create_resource(const char* id, const char* model,const cha
   return storage;
 }
 
-static void storage_finalize(void)
+static void storage_finalize(surf_model_t storage_model)
 {
   lmm_system_free(storage_maxmin_system);
   storage_maxmin_system = NULL;
 
-  surf_model_exit(surf_storage_model);
-  surf_storage_model = NULL;
+  surf_model_exit(storage_model);
+  storage_model = NULL;
 
   if(storage_list)
     xbt_dynar_free(&storage_list);
@@ -285,11 +285,11 @@ static void storage_finalize(void)
   storage_running_action_set_that_does_not_need_being_checked = NULL;
 }
 
-static void storage_update_actions_state(double now, double delta)
+static void storage_update_actions_state(surf_model_t storage_model, double now, double delta)
 {
   surf_action_storage_t action = NULL;
   surf_action_storage_t next_action = NULL;
-  xbt_swag_t running_actions = surf_storage_model->states.running_action_set;
+  xbt_swag_t running_actions = storage_model->states.running_action_set;
 
   // Update the disk usage
   // Update the file size
@@ -333,7 +333,7 @@ static void storage_update_actions_state(double now, double delta)
   return;
 }
 
-static double storage_share_resources(double NOW)
+static double storage_share_resources(surf_model_t storage_model, double NOW)
 {
   XBT_DEBUG("storage_share_resources %f",NOW);
   s_surf_action_storage_t action;
@@ -341,7 +341,7 @@ static double storage_share_resources(double NOW)
   storage_t storage;
   surf_action_storage_t write_action;
 
-  double min_completion = generic_maxmin_share_resources(surf_storage_model->states.running_action_set,
+  double min_completion = generic_maxmin_share_resources(storage_model->states.running_action_set,
       xbt_swag_offset(action, generic_lmm_action.variable),
       storage_maxmin_system, lmm_solve);
 
index f520c98..cf2ea9e 100644 (file)
@@ -474,7 +474,7 @@ void surf_exit(void)
   sg_config_finalize();
 
   xbt_dynar_foreach(model_list, iter, model)
-      model->model_private->finalize();
+      model->model_private->finalize(model);
   xbt_dynar_free(&model_list);
 
   xbt_dynar_free(&model_list_invoke);
@@ -542,7 +542,7 @@ void surf_presolve(void)
 
   /* FIXME: see what is check_update_action_state(). if necessary, use model_list_invoke. */
   xbt_dynar_foreach(model_list, iter, model)
-      model->model_private->update_actions_state(NOW, 0.0);
+      model->model_private->update_actions_state(model, NOW, 0.0);
 }
 
 double surf_solve(double max_date)
@@ -609,7 +609,7 @@ double surf_solve(double max_date)
 
       XBT_DEBUG("Run for network at most %f", min);
       // run until min or next flow
-      model_next_action_end = surf_network_model->model_private->share_resources(min);
+      model_next_action_end = surf_network_model->model_private->share_resources(surf_network_model, min);
 
       XBT_DEBUG("Min for network : %f", model_next_action_end);
       if(model_next_action_end>=0.0)
@@ -688,7 +688,7 @@ static void surf_share_resources(surf_model_t model)
   int i = __sync_fetch_and_add(&surf_min_index, 1);
   if (strcmp(model->name,"network NS3")) {
     XBT_DEBUG("Running for Resource [%s]", model->name);
-    next_action_end = model->model_private->share_resources(NOW);
+    next_action_end = model->model_private->share_resources(model, NOW);
     XBT_DEBUG("Resource [%s] : next action end = %f",
         model->name, next_action_end);
   }
@@ -697,7 +697,7 @@ static void surf_share_resources(surf_model_t model)
 
 static void surf_update_actions_state(surf_model_t model)
 {
-  model->model_private->update_actions_state(NOW, min);
+  model->model_private->update_actions_state(model, NOW, min);
 }
 
 /**
index 4732aa3..cd94f4e 100644 (file)
@@ -31,12 +31,12 @@ typedef struct surf_model_private {
   int (*resource_used) (void *resource_id);
   /* Share the resources to the actions and return in how much time
      the next action may terminate */
-  double (*share_resources) (double now);
+  double (*share_resources) (surf_model_t model, double now);
   /* Update the actions' state */
-  void (*update_actions_state) (double now, double delta);
-  void (*update_resource_state) (void *id, tmgr_trace_event_t event_type,
+  void (*update_actions_state) (surf_model_t model, double now, double delta);
+  void (*update_resource_state) (void *resource, tmgr_trace_event_t event_type,
                                  double value, double time);
-  void (*finalize) (void);
+  void (*finalize) (surf_model_t model);
 
   lmm_system_t maxmin_system;
   e_UM_t update_mechanism;
index 3eec48a..826fe6d 100644 (file)
@@ -101,7 +101,7 @@ static void vm_ws_set_state(void *ind_vm_ws, int state){
 }
 
 
-static double ws_share_resources(double now)
+static double vm_ws_share_resources(surf_model_t workstation_model, double now)
 {
   // Can be obsolete if you right can ensure that ws_model has been code previously
   // invoke ws_share_resources on the physical_lyer: sub_ws->ws_share_resources()
index 9d5a71a..ca2f430 100644 (file)
@@ -92,13 +92,13 @@ static void ws_action_state_set(surf_action_t action,
   return;
 }
 
-static double ws_share_resources(double now)
+static double ws_share_resources(surf_model_t workstation_model, double now)
 {
 // invoke share_resources on CPU and network (layer 0)
   return -1.0;
 }
 
-static void ws_update_actions_state(double now, double delta)
+static void ws_update_actions_state(surf_model_t workstation_model, double now, double delta)
 {
   return;
 }
@@ -295,10 +295,10 @@ static int ws_link_shared(const void *link)
   return surf_network_model->extension.network.link_shared(link);
 }
 
-static void ws_finalize(void)
+static void ws_finalize(surf_model_t workstation_model)
 {
-  surf_model_exit(surf_workstation_model);
-  surf_workstation_model = NULL;
+  surf_model_exit(workstation_model);
+  workstation_model = NULL;
 }
 
 static xbt_dict_t ws_get_properties(const void *ws)
index 183c305..6e0537b 100644 (file)
@@ -216,13 +216,13 @@ static int ptask_resource_used(void *resource_id)
 
 }
 
-static double ptask_share_resources(double now)
+static double ptask_share_resources(surf_model_t workstation_model, double now)
 {
   s_surf_action_workstation_L07_t s_action;
   surf_action_workstation_L07_t action = NULL;
 
   xbt_swag_t running_actions =
-      surf_workstation_model->states.running_action_set;
+      workstation_model->states.running_action_set;
   double min = generic_maxmin_share_resources(running_actions,
                                               xbt_swag_offset(s_action,
                                                               variable),
@@ -248,13 +248,13 @@ static double ptask_share_resources(double now)
   return min;
 }
 
-static void ptask_update_actions_state(double now, double delta)
+static void ptask_update_actions_state(surf_model_t workstation_model, double now, double delta)
 {
   double deltap = 0.0;
   surf_action_workstation_L07_t action = NULL;
   surf_action_workstation_L07_t next_action = NULL;
   xbt_swag_t running_actions =
-      surf_workstation_model->states.running_action_set;
+      workstation_model->states.running_action_set;
 
   xbt_swag_foreach_safe(action, next_action, running_actions) {
     deltap = delta;
@@ -407,12 +407,12 @@ static void ptask_update_resource_state(void *id,
   return;
 }
 
-static void ptask_finalize(void)
+static void ptask_finalize(surf_model_t workstation_model)
 {
   xbt_dict_free(&ptask_parallel_task_link_set);
 
-  surf_model_exit(surf_workstation_model);
-  surf_workstation_model = NULL;
+  surf_model_exit(workstation_model);
+  workstation_model = NULL;
   surf_model_exit(surf_network_model);
   surf_network_model = NULL;