Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
refine code around model types and objects
authorTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Fri, 15 Feb 2013 11:51:53 +0000 (12:51 +0100)
committerTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Fri, 15 Feb 2013 12:59:04 +0000 (13:59 +0100)
The model_type member of an action object is renamed model_obj. This
change makes it clear that this member points to a surf model objet, not
the type of a model.

The model type member is added to a surf model object. This allows us to
know what type a model object is and what extension field is accessible.

18 files changed:
src/include/surf/surf.h
src/simix/smx_io.c
src/simix/smx_network.c
src/simix/smx_new_api.c
src/simix/smx_process.c
src/simix/smx_synchro.c
src/surf/cpu_cas01.c
src/surf/cpu_ti.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/network_ns3.c
src/surf/new_model.c
src/surf/storage.c
src/surf/surf_action.c
src/surf/vm_workstation.c
src/surf/workstation.c
src/surf/workstation_ptask_L07.c
testsuite/surf/surf_usage.c

index 41aa027..51435bd 100644 (file)
@@ -107,7 +107,12 @@ typedef struct surf_action {
          * and fluctuates until the task is completed */
   void *data;                   /**< for your convenience */
   int refcount;
-  surf_model_t model_type;
+
+  /* The previous name was model_type. For VM support, we have to distinguish a
+   * model type and its model object. Thus, we use model_obj here. The type of
+   * a model object is available through a macro. */
+  surf_model_t model_obj;       /**< the surf model object */
+
 #ifdef HAVE_TRACING
   char *category;               /**< tracing category for categorized resource utilization monitoring */
 #endif
@@ -289,6 +294,23 @@ typedef struct surf_vm_workstation_model_extension_public {
   void (*destroy) (void *ind_vm_workstation); // will be vm_ws_destroy(), which destroies the vm-workstation-specific data
 } s_surf_model_extension_vm_workstation_t;
 
+/** \ingroup SURF_models
+ *  \brief Model types
+ *
+ *  The type of the model object. For example, we will have two model objects
+ *  of the surf cpu model. One is for physical machines, and the other is for
+ *  virtual machines.
+ *
+ */
+typedef enum {
+  SURF_MODEL_TYPE_CPU = 0,
+  SURF_MODEL_TYPE_NETWORK,
+  SURF_MODEL_TYPE_STORAGE,
+  SURF_MODEL_TYPE_WORKSTATION,
+  SURF_MODEL_TYPE_VM_WORKSTATION,
+  SURF_MODEL_TYPE_NEW_MODEL
+} e_surf_model_type_t;
+
 /** \ingroup SURF_models
  *  \brief Model datatype
  *
@@ -299,7 +321,9 @@ typedef struct surf_model {
   const char *name;     /**< Name of this model */
   s_surf_action_state_t states;      /**< Any living action on this model */
 
-   e_surf_action_state_t(*action_state_get) (surf_action_t action);
+  e_surf_model_type_t type; /**< See e_surf_model_type_t */
+
+  e_surf_action_state_t(*action_state_get) (surf_action_t action);
                                                                        /**< Return the state of an action */
   void (*action_state_set) (surf_action_t action,
                             e_surf_action_state_t state);
index f261620..dfb8554 100644 (file)
@@ -356,7 +356,7 @@ void SIMIX_io_destroy(smx_action_t action)
 {
   XBT_DEBUG("Destroy action %p", action);
   if (action->io.surf_io)
-    action->io.surf_io->model_type->action_unref(action->io.surf_io);
+    action->io.surf_io->model_obj->action_unref(action->io.surf_io);
   xbt_mallocator_release(simix_global->action_mallocator, action);
 }
 
index 48c05f3..2e4b1b1 100644 (file)
@@ -337,17 +337,17 @@ void SIMIX_comm_destroy_internal_actions(smx_action_t action)
 #ifdef HAVE_LATENCY_BOUND_TRACKING
     action->latency_limited = SIMIX_comm_is_latency_bounded(action);
 #endif
-    action->comm.surf_comm->model_type->action_unref(action->comm.surf_comm);
+    action->comm.surf_comm->model_obj->action_unref(action->comm.surf_comm);
     action->comm.surf_comm = NULL;
   }
 
   if (action->comm.src_timeout){
-    action->comm.src_timeout->model_type->action_unref(action->comm.src_timeout);
+    action->comm.src_timeout->model_obj->action_unref(action->comm.src_timeout);
     action->comm.src_timeout = NULL;
   }
 
   if (action->comm.dst_timeout){
-    action->comm.dst_timeout->model_type->action_unref(action->comm.dst_timeout);
+    action->comm.dst_timeout->model_obj->action_unref(action->comm.dst_timeout);
     action->comm.dst_timeout = NULL;
   }
 }
index acafb0e..5f7fcc6 100644 (file)
@@ -93,7 +93,7 @@ void SIMIX_new_api_destroy(smx_action_t action)
 {
   XBT_DEBUG("Destroy action %p", action);
   if (action->new_api.surf_new_api)
-    action->new_api.surf_new_api->model_type->action_unref(action->new_api.surf_new_api);
+    action->new_api.surf_new_api->model_obj->action_unref(action->new_api.surf_new_api);
   xbt_mallocator_release(simix_global->action_mallocator, action);
 }
 
index ff48a35..a845ba2 100644 (file)
@@ -747,7 +747,7 @@ void SIMIX_process_sleep_destroy(smx_action_t action)
 {
   XBT_DEBUG("Destroy action %p", action);
   if (action->sleep.surf_sleep)
-    action->sleep.surf_sleep->model_type->action_unref(action->sleep.surf_sleep);
+    action->sleep.surf_sleep->model_obj->action_unref(action->sleep.surf_sleep);
   xbt_mallocator_release(simix_global->action_mallocator, action);
 }
 
index 414b927..4a3d094 100644 (file)
@@ -70,7 +70,7 @@ void SIMIX_synchro_destroy(smx_action_t action)
 {
   XBT_IN("(%p)",action);
   XBT_DEBUG("Destroying synchro %p", action);
-  action->synchro.sleep->model_type->action_unref(action->synchro.sleep);
+  action->synchro.sleep->model_obj->action_unref(action->synchro.sleep);
   xbt_free(action->name);
   xbt_mallocator_release(simix_global->action_mallocator, action);
   XBT_OUT();
index bc48ba5..0a98541 100644 (file)
@@ -363,6 +363,7 @@ static void surf_cpu_model_init_internal(surf_model_t cpu_model)
       xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   cpu_model->name = "cpu";
+  cpu_model->type = SURF_MODEL_TYPE_CPU;
 
   cpu_model->action_unref = surf_action_unref;
   cpu_model->action_cancel = surf_action_cancel;
index 3436e80..8849fd0 100644 (file)
@@ -691,7 +691,7 @@ static void cpu_ti_action_set_priority(surf_action_t action,
 
 static double cpu_ti_action_get_remains(surf_action_t action)
 {
-  surf_model_t cpu_model = action->model_type;
+  surf_model_t cpu_model = action->model_obj;
   XBT_IN("(%p)", action);
 
   cpu_ti_update_remaining_amount(cpu_model, (cpu_ti_t) ((surf_action_cpu_ti_t) action)->cpu,
@@ -784,6 +784,7 @@ static void surf_cpu_ti_model_init_internal(surf_model_t cpu_model)
       xbt_swag_new(xbt_swag_offset(cpu, modified_cpu_hookup));
 
   cpu_model->name = "cpu_ti";
+  cpu_model->type = SURF_MODEL_TYPE_CPU;
 
   cpu_model->action_unref = cpu_ti_action_unref;
   cpu_model->action_cancel = cpu_ti_action_cancel;
index aca670c..2366019 100644 (file)
@@ -763,6 +763,7 @@ static void surf_network_model_init_internal(void)
   set_update_mechanism();
 
   surf_network_model->name = "network";
+  surf_network_model->type = SURF_MODEL_TYPE_NETWORK;
   surf_network_model->action_unref = surf_action_unref;
   surf_network_model->action_cancel = surf_action_cancel;
   surf_network_model->action_recycle = net_action_recycle;
index d557573..0de24aa 100644 (file)
@@ -410,6 +410,7 @@ static void surf_network_model_init_internal(void)
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network GTNetS";
+  surf_network_model->type = SURF_MODEL_TYPE_NETWORK;
   surf_network_model->action_unref = action_unref;
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
index dd48b10..8ec660d 100644 (file)
@@ -342,6 +342,7 @@ void surf_network_model_init_NS3()
 
   surf_network_model = surf_model_init();
   surf_network_model->name = "network NS3";
+  surf_network_model->type = SURF_MODEL_TYPE_NETWORK;
   surf_network_model->extension.network.get_link_latency = ns3_get_link_latency;
   surf_network_model->extension.network.get_link_bandwidth = ns3_get_link_bandwidth;
   surf_network_model->extension.network.get_route = ns3_get_route;
index 76ed586..dce13e2 100644 (file)
@@ -148,6 +148,7 @@ static void surf_new_model_init_internal(void)
       xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_new_model->name = "New Model";
+  surf_new_model->type = SURF_MODEL_TYPE_NEW_MODEL;
   surf_new_model->action_unref = new_model_action_unref;
   surf_new_model->action_cancel = new_model_action_cancel;
   surf_new_model->action_state_set = new_model_action_state_set;
index 12f8c56..ecfcccb 100644 (file)
@@ -495,6 +495,7 @@ static void surf_storage_model_init_internal(void)
       xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
   surf_storage_model->name = "Storage";
+  surf_storage_model->type = SURF_MODEL_TYPE_STORAGE;
   surf_storage_model->action_unref = storage_action_unref;
   surf_storage_model->action_cancel = storage_action_cancel;
   surf_storage_model->action_state_set = storage_action_state_set;
index 59e775f..0e582d2 100644 (file)
@@ -74,7 +74,7 @@ void *surf_action_new(size_t size, double cost, surf_model_t model,
   action->max_duration = NO_MAX_DURATION;
   action->start = surf_get_clock();
   action->finish = -1.0;
-  action->model_type = model;
+  action->model_obj = model;
 #ifdef HAVE_TRACING
   action->category = NULL;
 #endif
@@ -91,7 +91,7 @@ void *surf_action_new(size_t size, double cost, surf_model_t model,
 
 e_surf_action_state_t surf_action_state_get(surf_action_t action)
 {
-  surf_action_state_t action_state = &(action->model_type->states);
+  surf_action_state_t action_state = &(action->model_obj->states);
 
   if (action->state_set == action_state->ready_action_set)
     return SURF_ACTION_READY;
@@ -124,7 +124,7 @@ XBT_INLINE void surf_action_free(surf_action_t * action)
 void surf_action_state_set(surf_action_t action,
                            e_surf_action_state_t state)
 {
-  surf_action_state_t action_state = &(action->model_type->states);
+  surf_action_state_t action_state = &(action->model_obj->states);
   XBT_IN("(%p,%s)", action, surf_action_state_names[state]);
   xbt_swag_remove(action, action->state_set);
 
@@ -187,7 +187,7 @@ void surf_action_lmm_heap_remove(xbt_heap_t heap, surf_action_lmm_t action)
 
 void surf_action_cancel(surf_action_t action)
 {
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   surf_action_state_set(action, SURF_ACTION_FAILED);
   if (model->model_private->update_mechanism == UM_LAZY) {
     xbt_swag_remove(action, model->model_private->modified_set);
@@ -198,7 +198,7 @@ void surf_action_cancel(surf_action_t action)
 
 int surf_action_unref(surf_action_t action)
 {
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   action->refcount--;
   if (!action->refcount) {
     xbt_swag_remove(action, action->state_set);
@@ -221,7 +221,7 @@ int surf_action_unref(surf_action_t action)
 
 void surf_action_suspend(surf_action_t action)
 {
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   XBT_IN("(%p)", action);
   if (((surf_action_lmm_t) action)->suspended != 2) {
     lmm_update_variable_weight(model->model_private->maxmin_system,
@@ -236,7 +236,7 @@ void surf_action_suspend(surf_action_t action)
 
 void surf_action_resume(surf_action_t action)
 {
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   XBT_IN("(%p)", action);
   if (((surf_action_lmm_t) action)->suspended != 2) {
     lmm_update_variable_weight(model->model_private->maxmin_system,
@@ -256,7 +256,7 @@ int surf_action_is_suspended(surf_action_t action)
 
 void surf_action_set_max_duration(surf_action_t action, double duration)
 {
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   XBT_IN("(%p,%g)", action, duration);
   action->max_duration = duration;
   if (model->model_private->update_mechanism == UM_LAZY)      // remove action from the heap
@@ -266,7 +266,7 @@ void surf_action_set_max_duration(surf_action_t action, double duration)
 
 void surf_action_set_priority(surf_action_t action, double priority)
 {
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   XBT_IN("(%p,%g)", action, priority);
   action->priority = priority;
   lmm_update_variable_weight(model->model_private->maxmin_system,
@@ -291,7 +291,7 @@ void surf_action_set_category(surf_action_t action,
 void generic_update_action_remaining_lazy( surf_action_lmm_t action, double now)
 {
   double delta = 0.0;
-  surf_model_t model = action->generic_action.model_type;
+  surf_model_t model = action->generic_action.model_obj;
 
   if(model == surf_network_model)
   {
@@ -316,7 +316,7 @@ void generic_update_action_remaining_lazy( surf_action_lmm_t action, double now)
         action->last_value * delta);
 
 #ifdef HAVE_TRACING
-    if (model == surf_cpu_model && TRACE_is_enabled()) {
+    if (model->type == SURF_MODEL_TYPE_CPU && TRACE_is_enabled()) {
       surf_resource_t cpu =
           lmm_constraint_id(lmm_get_cnst_from_var
               (model->model_private->maxmin_system,
@@ -360,7 +360,7 @@ void generic_update_action_remaining_lazy( surf_action_lmm_t action, double now)
 double surf_action_get_remains(surf_action_t action)
 {
   XBT_IN("(%p)", action);
-  surf_model_t model = action->model_type;
+  surf_model_t model = action->model_obj;
   /* update remains before return it */
   if (model->model_private->update_mechanism == UM_LAZY)      /* update remains before return it */
     generic_update_action_remaining_lazy((surf_action_lmm_t)action, surf_get_clock());
@@ -377,7 +377,7 @@ void generic_update_actions_state_lazy(double now, double delta, surf_model_t mo
     XBT_DEBUG("Something happened to action %p", action);
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
-      if(model == surf_cpu_model){
+      if(model->type == SURF_MODEL_TYPE_CPU){
       surf_resource_t cpu =
           lmm_constraint_id(lmm_get_cnst_from_var
                             (model->model_private->maxmin_system,
@@ -409,7 +409,7 @@ void generic_update_actions_state_lazy(double now, double delta, surf_model_t mo
     }
 #endif
 
-    if(model == surf_cpu_model){
+    if(model->type == SURF_MODEL_TYPE_CPU){
       action->generic_action.finish = surf_get_clock();
       XBT_DEBUG("Action %p finished", action);
 
@@ -446,7 +446,7 @@ void generic_update_actions_state_lazy(double now, double delta, surf_model_t mo
     }
   }
 #ifdef HAVE_TRACING
-  if (TRACE_is_enabled() && model == surf_cpu_model) {
+  if (TRACE_is_enabled() && model->type == SURF_MODEL_TYPE_CPU) {
     //defining the last timestamp that we can safely dump to trace file
     //without losing the event ascending order (considering all CPU's)
     double smaller = -1;
index 826fe6d..5ab5731 100644 (file)
@@ -135,6 +135,7 @@ static void surf_vm_workstation_model_init_internal(void)
   surf_vm_workstation_model = surf_model_init();
 
   surf_vm_workstation_model->name = "Virtual Workstation";
+  surf_vm_workstation_model->type = SURF_MODEL_TYPE_VM_WORKSTATION;
 
   surf_vm_workstation_model->extension.vm_workstation.create = vm_ws_create;
   surf_vm_workstation_model->extension.vm_workstation.set_state = vm_ws_set_state;
index 24eadc7..f627c89 100644 (file)
@@ -52,13 +52,13 @@ static int ws_parallel_action_free(surf_action_t action)
 
 static int ws_action_unref(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     return surf_network_model->action_unref(action);
-  else if (action->model_type == surf_cpu_model)
-    return action->model_type->action_unref(action);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    return action->model_obj->action_unref(action);
       // previously was: Adrien/Arnaud 6 feb
          // surf_cpu_model->action_unref(action);
-  else if (action->model_type == surf_workstation_model)
+  else if (action->model_obj->type == SURF_MODEL_TYPE_WORKSTATION)
     return ws_parallel_action_free(action);
   else
     DIE_IMPOSSIBLE;
@@ -67,11 +67,11 @@ static int ws_action_unref(surf_action_t action)
 
 static void ws_action_cancel(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->action_cancel(action);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->action_cancel(action);
-  else if (action->model_type == surf_workstation_model)
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->action_cancel(action);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_WORKSTATION)
     ws_parallel_action_cancel(action);
   else
     DIE_IMPOSSIBLE;
@@ -81,11 +81,11 @@ static void ws_action_cancel(surf_action_t action)
 static void ws_action_state_set(surf_action_t action,
                                 e_surf_action_state_t state)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->action_state_set(action, state);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->action_state_set(action, state);
-  else if (action->model_type == surf_workstation_model)
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->action_state_set(action, state);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_WORKSTATION)
     surf_action_state_set(action, state);
   else
     DIE_IMPOSSIBLE;
@@ -124,30 +124,30 @@ static surf_action_t ws_action_sleep(void *workstation, double duration)
 
 static void ws_action_suspend(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->suspend(action);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->suspend(action);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->suspend(action);
   else
     DIE_IMPOSSIBLE;
 }
 
 static void ws_action_resume(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->resume(action);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->resume(action);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->resume(action);
   else
     DIE_IMPOSSIBLE;
 }
 
 static int ws_action_is_suspended(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     return surf_network_model->is_suspended(action);
-  if (action->model_type == surf_cpu_model)
-    return action->model_type->is_suspended(action);
+  if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    return action->model_obj->is_suspended(action);
   DIE_IMPOSSIBLE;
   return -1;
 }
@@ -155,20 +155,20 @@ static int ws_action_is_suspended(surf_action_t action)
 static void ws_action_set_max_duration(surf_action_t action,
                                        double duration)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->set_max_duration(action, duration);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->set_max_duration(action, duration);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->set_max_duration(action, duration);
   else
     DIE_IMPOSSIBLE;
 }
 
 static void ws_action_set_priority(surf_action_t action, double priority)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->set_priority(action, priority);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->set_priority(action, priority);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->set_priority(action, priority);
   else
     DIE_IMPOSSIBLE;
 }
@@ -176,10 +176,10 @@ static void ws_action_set_priority(surf_action_t action, double priority)
 #ifdef HAVE_TRACING
 static void ws_action_set_category(surf_action_t action, const char *category)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     surf_network_model->set_category(action, category);
-  else if (action->model_type == surf_cpu_model)
-    action->model_type->set_category(action, category);
+  else if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    action->model_obj->set_category(action, category);
   else
     DIE_IMPOSSIBLE;
 }
@@ -188,7 +188,7 @@ static void ws_action_set_category(surf_action_t action, const char *category)
 #ifdef HAVE_LATENCY_BOUND_TRACKING
 static int ws_get_latency_limited(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     return surf_network_model->get_latency_limited(action);
   else
     return 0;
@@ -197,10 +197,10 @@ static int ws_get_latency_limited(surf_action_t action)
 
 static double ws_action_get_remains(surf_action_t action)
 {
-  if (action->model_type == surf_network_model)
+  if (action->model_obj->type == SURF_MODEL_TYPE_NETWORK)
     return surf_network_model->get_remains(action);
-  if (action->model_type == surf_cpu_model)
-    return action->model_type->get_remains(action);
+  if (action->model_obj->type == SURF_MODEL_TYPE_CPU)
+    return action->model_obj->get_remains(action);
   DIE_IMPOSSIBLE;
   return -1.0;
 }
@@ -389,6 +389,7 @@ static void surf_workstation_model_init_internal(void)
 
   // TODO  surf_workstation_model->extension.cpu=cpu_model_cas01(0);
   surf_workstation_model->name = "Workstation";
+  surf_workstation_model->type = SURF_MODEL_TYPE_WORKSTATION;
   surf_workstation_model->action_unref = ws_action_unref;
   surf_workstation_model->action_cancel = ws_action_cancel;
   surf_workstation_model->action_state_set = ws_action_state_set;
index 17a53b1..9c89c30 100644 (file)
@@ -856,6 +856,7 @@ static void ptask_model_init_internal(void)
   surf_workstation_model->set_priority = ptask_action_set_priority;
   surf_workstation_model->get_remains = ptask_action_get_remains;
   surf_workstation_model->name = "Workstation ptask_L07";
+  surf_workstation_model->type = SURF_MODEL_TYPE_WORKSTATION;
 
   surf_workstation_model->model_private->resource_used =
       ptask_resource_used;
index 37be59e..851043d 100644 (file)
@@ -73,7 +73,7 @@ void test(char *platform)
 
   /* Use whatever calling style you want... */
   stateActionA = surf_cpu_model_pm->action_state_get(actionA);     /* When you know actionA model type */
-  stateActionB = actionB->model_type->action_state_get(actionB);        /* If you're unsure about it's model type */
+  stateActionB = actionB->model_obj->action_state_get(actionB);        /* If you're unsure about it's model type */
   stateActionC = surf_cpu_model_pm->action_state_get(actionC);     /* When you know actionA model type */
 
   /* And just look at the state of these tasks */
@@ -103,25 +103,25 @@ void test(char *platform)
     while ((action =
             xbt_swag_extract(surf_cpu_model_pm->states.failed_action_set))) {
       XBT_DEBUG("\t * Failed : %p", action);
-      action->model_type->action_unref(action);
+      action->model_obj->action_unref(action);
     }
     while ((action =
             xbt_swag_extract(surf_cpu_model_pm->states.done_action_set))) {
       XBT_DEBUG("\t * Done : %p", action);
-      action->model_type->action_unref(action);
+      action->model_obj->action_unref(action);
     }
     XBT_DEBUG("\t Network actions");
     while ((action =
             xbt_swag_extract(surf_network_model->states.
                              failed_action_set))) {
       XBT_DEBUG("\t * Failed : %p", action);
-      action->model_type->action_unref(action);
+      action->model_obj->action_unref(action);
     }
     while ((action =
             xbt_swag_extract(surf_network_model->states.
                              done_action_set))) {
       XBT_DEBUG("\t * Done : %p", action);
-      action->model_type->action_unref(action);
+      action->model_obj->action_unref(action);
     }
 
   } while ((xbt_swag_size(surf_network_model->states.running_action_set) ||