Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename model methods action_use/free to action_ref/unref
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 1 Jul 2009 11:04:28 +0000 (11:04 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 1 Jul 2009 11:04:28 +0000 (11:04 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6425 48e7efb5-ca39-0410-a469-dd3cf9ba447f

14 files changed:
ChangeLog
src/include/surf/surf.h
src/simdag/sd_global.c
src/simdag/sd_task.c
src/simix/smx_action.c
src/surf/cpu.c
src/surf/network.c
src/surf/network_constant.c
src/surf/network_gtnets.c
src/surf/surf_model.c
src/surf/workstation.c
src/surf/workstation_ptask_L07.c
testsuite/surf/surf_usage.c
testsuite/surf/surf_usage2.c

index 69fa05c..d6bb2fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,11 @@ SimGrid (3.3.2-svn) unstable; urgency=low
      use the model field of their ancestor. 
     But hell, we wont fight for 8 bytes per host, will we?
     TODO: integrate the properties into that ancestor
      use the model field of their ancestor. 
     But hell, we wont fight for 8 bytes per host, will we?
     TODO: integrate the properties into that ancestor
+  * Rename model methods:
+    action_free -> action_unref
+    action_use  -> action_ref
+    action_change_state -> action_state_set
+    action_get_state    -> action_state_get
     
  XBT:
   * Add xbt_set_get_by_name_or_null() [Silas De Munck]
     
  XBT:
   * Add xbt_set_get_by_name_or_null() [Silas De Munck]
index c4c501b..12bcb41 100644 (file)
@@ -217,8 +217,8 @@ XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table,
 
        double (*action_get_start_time) (surf_action_t action);/**< Return the start time of an action */
        double (*action_get_finish_time) (surf_action_t action);/**< Return the finish time of an action */
 
        double (*action_get_start_time) (surf_action_t action);/**< Return the start time of an action */
        double (*action_get_finish_time) (surf_action_t action);/**< Return the finish time of an action */
-       void (*action_use) (surf_action_t action);/**< Set an action used */
-       int (*action_free) (surf_action_t action);/**< Free an action */
+       void (*action_ref) (surf_action_t action);/**< Specify that we use that action */
+       int (*action_unref) (surf_action_t action);/**< Specify that we don't use that action anymore */
        void (*action_cancel) (surf_action_t action);/**< Cancel a running action */
        void (*action_recycle) (surf_action_t action);/**< Recycle an action */
        void (*action_data_set) (surf_action_t action, void *data);/**< Set the user data of an action */
        void (*action_cancel) (surf_action_t action);/**< Cancel a running action */
        void (*action_recycle) (surf_action_t action);/**< Recycle an action */
        void (*action_data_set) (surf_action_t action, void *data);/**< Set the user data of an action */
index 932c915..c927951 100644 (file)
@@ -274,7 +274,7 @@ SD_task_t *SD_simulate(double how_long)
         task = action->data;
         INFO1("Task '%s' failed", SD_task_get_name(task));
         __SD_task_set_state(task, SD_FAILED);
         task = action->data;
         INFO1("Task '%s' failed", SD_task_get_name(task));
         __SD_task_set_state(task, SD_FAILED);
-        surf_workstation_model->action_free(action);
+        surf_workstation_model->action_unref(action);
         task->surf_action = NULL;
 
         if (!xbt_dynar_member(changed_tasks, &task))
         task->surf_action = NULL;
 
         if (!xbt_dynar_member(changed_tasks, &task))
index 48cd3e8..3ce7e5b 100644 (file)
@@ -841,7 +841,7 @@ void __SD_task_just_done(SD_task_t task)
   candidates = xbt_new(SD_task_t, 8);
 
   __SD_task_set_state(task, SD_DONE);
   candidates = xbt_new(SD_task_t, 8);
 
   __SD_task_set_state(task, SD_DONE);
-  surf_workstation_model->action_free(task->surf_action);
+  surf_workstation_model->action_unref(task->surf_action);
   task->surf_action = NULL;
 
   DEBUG0("Looking for candidates");
   task->surf_action = NULL;
 
   DEBUG0("Looking for candidates");
@@ -1047,7 +1047,7 @@ void SD_task_destroy(SD_task_t task)
     xbt_free(task->name);
 
   if (task->surf_action != NULL)
     xbt_free(task->name);
 
   if (task->surf_action != NULL)
-    surf_workstation_model->action_free(task->surf_action);
+    surf_workstation_model->action_unref(task->surf_action);
 
   if (task->workstation_list != NULL)
     xbt_free(task->workstation_list);
 
   if (task->workstation_list != NULL)
     xbt_free(task->workstation_list);
index d588ae9..310cad8 100644 (file)
@@ -205,7 +205,7 @@ int SIMIX_action_destroy(smx_action_t action)
   xbt_fifo_free(action->cond_list);
 
   if (action->simdata->surf_action)
   xbt_fifo_free(action->cond_list);
 
   if (action->simdata->surf_action)
-    action->simdata->surf_action->model_type->action_free(action->
+    action->simdata->surf_action->model_type->action_unref(action->
                                                           simdata->surf_action);
 
   xbt_free(action->simdata);
                                                           simdata->surf_action);
 
   xbt_free(action->simdata);
index dd23290..ea6af9f 100644 (file)
@@ -134,7 +134,7 @@ static int resource_used(void *resource_id)
                              ((cpu_Cas01_t) resource_id)->constraint);
 }
 
                              ((cpu_Cas01_t) resource_id)->constraint);
 }
 
-static int action_free(surf_action_t action)
+static int action_unref(surf_action_t action)
 {
   action->refcount--;
   if (!action->refcount) {
 {
   action->refcount--;
   if (!action->refcount) {
@@ -148,7 +148,7 @@ static int action_free(surf_action_t action)
   return 0;
 }
 
   return 0;
 }
 
-static void action_use(surf_action_t action)
+static void action_ref(surf_action_t action)
 {
   action->refcount++;
 }
 {
   action->refcount++;
 }
@@ -401,8 +401,8 @@ static void surf_cpu_model_init_internal(void)
 
   surf_cpu_model->name = "CPU";
 
 
   surf_cpu_model->name = "CPU";
 
-  surf_cpu_model->action_free = action_free;
-  surf_cpu_model->action_use = action_use;
+  surf_cpu_model->action_unref = action_unref;
+  surf_cpu_model->action_ref = action_ref;
   surf_cpu_model->action_cancel = action_cancel;
   surf_cpu_model->action_state_set = cpu_action_state_set;
 
   surf_cpu_model->action_cancel = action_cancel;
   surf_cpu_model->action_state_set = cpu_action_state_set;
 
index e0e2eae..f0c5e32 100644 (file)
@@ -300,7 +300,7 @@ static int resource_used(void *resource_id)
                              ((link_CM02_t) resource_id)->constraint);
 }
 
                              ((link_CM02_t) resource_id)->constraint);
 }
 
-static int action_free(surf_action_t action)
+static int action_unref(surf_action_t action)
 {
   action->refcount--;
   if (!action->refcount) {
 {
   action->refcount--;
   if (!action->refcount) {
@@ -314,7 +314,7 @@ static int action_free(surf_action_t action)
   return 0;
 }
 
   return 0;
 }
 
-static void action_use(surf_action_t action)
+static void action_ref(surf_action_t action)
 {
   action->refcount++;
 }
 {
   action->refcount++;
 }
@@ -667,8 +667,8 @@ static void surf_network_model_init_internal(void)
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network";
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network";
-  surf_network_model->action_free = action_free;
-  surf_network_model->action_use = action_use;
+  surf_network_model->action_unref = action_unref;
+  surf_network_model->action_ref = action_ref;
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
 
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
 
index 96b3485..2c91cc3 100644 (file)
@@ -85,7 +85,7 @@ static int resource_used(void *resource_id)
   return 0;
 }
 
   return 0;
 }
 
-static int action_free(surf_action_t action)
+static int action_unref(surf_action_t action)
 {
   action->refcount--;
   if (!action->refcount) {
 {
   action->refcount--;
   if (!action->refcount) {
@@ -96,7 +96,7 @@ static int action_free(surf_action_t action)
   return 0;
 }
 
   return 0;
 }
 
-static void action_use(surf_action_t action)
+static void action_ref(surf_action_t action)
 {
   action->refcount++;
 }
 {
   action->refcount++;
 }
@@ -273,8 +273,8 @@ static void surf_network_model_init_internal(void)
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network constant";
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network constant";
-  surf_network_model->action_free = action_free;
-  surf_network_model->action_use = action_use;
+  surf_network_model->action_unref = action_unref;
+  surf_network_model->action_ref = action_ref;
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
 
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
 
index 75df16a..6ed902d 100644 (file)
@@ -313,7 +313,7 @@ static int resource_used(void *resource_id)
   return 0;                     /* We don't care */
 }
 
   return 0;                     /* We don't care */
 }
 
-static int action_free(surf_action_t action)
+static int action_unref(surf_action_t action)
 {
   action->refcount--;
   if (!action->refcount) {
 {
   action->refcount--;
   if (!action->refcount) {
@@ -325,7 +325,7 @@ static int action_free(surf_action_t action)
   return 0;
 }
 
   return 0;
 }
 
-static void action_use(surf_action_t action)
+static void action_ref(surf_action_t action)
 {
   action->refcount++;
 }
 {
   action->refcount++;
 }
@@ -530,8 +530,8 @@ static void surf_network_model_init_internal(void)
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network GTNetS";
   surf_network_model = surf_model_init();
 
   surf_network_model->name = "network GTNetS";
-  surf_network_model->action_use = action_use;
-  surf_network_model->action_free = action_free;
+  surf_network_model->action_ref = action_ref;
+  surf_network_model->action_unref = action_unref;
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
   surf_network_model->action_change_state = action_change_state;
   surf_network_model->action_cancel = action_cancel;
   surf_network_model->action_recycle = action_recycle;
   surf_network_model->action_change_state = action_change_state;
index 6013ce1..2e9700e 100644 (file)
@@ -35,7 +35,7 @@ surf_model_t surf_model_init(void)
     xbt_swag_new(xbt_swag_offset(action, state_hookup));
   model->resource_set = xbt_dict_new();
 
     xbt_swag_new(xbt_swag_offset(action, state_hookup));
   model->resource_set = xbt_dict_new();
 
-  model->action_free = int_die_impossible_paction;
+  model->action_unref = int_die_impossible_paction;
   model->action_cancel = void_die_impossible_paction;
   model->action_recycle = void_die_impossible_paction;
 
   model->action_cancel = void_die_impossible_paction;
   model->action_recycle = void_die_impossible_paction;
 
index bedebf2..54f40fa 100644 (file)
@@ -68,12 +68,12 @@ static void parallel_action_use(surf_action_t action)
   THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
 }
 
   THROW_UNIMPLEMENTED;          /* This model does not implement parallel tasks */
 }
 
-static int action_free(surf_action_t action)
+static int action_unref(surf_action_t action)
 {
   if (action->model_type == surf_network_model)
 {
   if (action->model_type == surf_network_model)
-    return surf_network_model->action_free(action);
+    return surf_network_model->action_unref(action);
   else if (action->model_type == surf_cpu_model)
   else if (action->model_type == surf_cpu_model)
-    return surf_cpu_model->action_free(action);
+    return surf_cpu_model->action_unref(action);
   else if (action->model_type == surf_workstation_model)
     return parallel_action_free(action);
   else
   else if (action->model_type == surf_workstation_model)
     return parallel_action_free(action);
   else
@@ -81,12 +81,12 @@ static int action_free(surf_action_t action)
   return 0;
 }
 
   return 0;
 }
 
-static void action_use(surf_action_t action)
+static void action_ref(surf_action_t action)
 {
   if (action->model_type == surf_network_model)
 {
   if (action->model_type == surf_network_model)
-    surf_network_model->action_use(action);
+    surf_network_model->action_ref(action);
   else if (action->model_type == surf_cpu_model)
   else if (action->model_type == surf_cpu_model)
-    surf_cpu_model->action_use(action);
+    surf_cpu_model->action_ref(action);
   else if (action->model_type == surf_workstation_model)
     parallel_action_use(action);
   else
   else if (action->model_type == surf_workstation_model)
     parallel_action_use(action);
   else
@@ -290,8 +290,8 @@ static void surf_workstation_model_init_internal(void)
   surf_workstation_model = surf_model_init();
 
   surf_workstation_model->name = "Workstation";
   surf_workstation_model = surf_model_init();
 
   surf_workstation_model->name = "Workstation";
-  surf_workstation_model->action_free = action_free;
-  surf_workstation_model->action_use = action_use;
+  surf_workstation_model->action_unref = action_unref;
+  surf_workstation_model->action_ref = action_ref;
   surf_workstation_model->action_cancel = action_cancel;
   surf_workstation_model->action_state_set = ws_action_state_set;
 
   surf_workstation_model->action_cancel = action_cancel;
   surf_workstation_model->action_state_set = ws_action_state_set;
 
index 62e5d2d..0b81b79 100644 (file)
@@ -129,13 +129,13 @@ static xbt_dict_t get_properties(void *r)
 
 /* action_get_state is inherited from the surf module */
 
 
 /* action_get_state is inherited from the surf module */
 
-static void action_use(surf_action_t action)
+static void action_ref(surf_action_t action)
 {
   action->refcount++;
   return;
 }
 
 {
   action->refcount++;
   return;
 }
 
-static int action_free(surf_action_t action)
+static int action_unref(surf_action_t action)
 {
   action->refcount--;
 
 {
   action->refcount--;
 
@@ -985,8 +985,8 @@ static void model_init_internal(void)
 {
   surf_workstation_model = surf_model_init();
 
 {
   surf_workstation_model = surf_model_init();
 
-  surf_workstation_model->action_use = action_use;
-  surf_workstation_model->action_free = action_free;
+  surf_workstation_model->action_ref = action_ref;
+  surf_workstation_model->action_unref = action_unref;
   surf_workstation_model->action_cancel = action_cancel;
   surf_workstation_model->action_state_set = surf_action_state_set;
   surf_workstation_model->suspend = action_suspend;
   surf_workstation_model->action_cancel = action_cancel;
   surf_workstation_model->action_state_set = surf_action_state_set;
   surf_workstation_model->suspend = action_suspend;
index 6399cf1..a4d5877 100644 (file)
@@ -109,26 +109,26 @@ void test(char *platform)
             xbt_swag_extract(surf_cpu_model->common_public->
                              states.failed_action_set))) {
       DEBUG1("\t * Failed : %p", action);
             xbt_swag_extract(surf_cpu_model->common_public->
                              states.failed_action_set))) {
       DEBUG1("\t * Failed : %p", action);
-      action->model_type->common_public->action_free(action);
+      action->model_type->common_public->action_unref(action);
     }
     while ((action =
             xbt_swag_extract(surf_cpu_model->common_public->
                              states.done_action_set))) {
       DEBUG1("\t * Done : %p", action);
     }
     while ((action =
             xbt_swag_extract(surf_cpu_model->common_public->
                              states.done_action_set))) {
       DEBUG1("\t * Done : %p", action);
-      action->model_type->common_public->action_free(action);
+      action->model_type->common_public->action_unref(action);
     }
     DEBUG0("\t Network actions");
     while ((action =
             xbt_swag_extract(surf_network_model->common_public->
                              states.failed_action_set))) {
       DEBUG1("\t * Failed : %p", action);
     }
     DEBUG0("\t Network actions");
     while ((action =
             xbt_swag_extract(surf_network_model->common_public->
                              states.failed_action_set))) {
       DEBUG1("\t * Failed : %p", action);
-      action->model_type->common_public->action_free(action);
+      action->model_type->common_public->action_unref(action);
     }
     while ((action =
             xbt_swag_extract(surf_network_model->common_public->
                              states.done_action_set))) {
       DEBUG1("\t * Done : %p", action);
     }
     while ((action =
             xbt_swag_extract(surf_network_model->common_public->
                              states.done_action_set))) {
       DEBUG1("\t * Done : %p", action);
-      action->model_type->common_public->action_free(action);
+      action->model_type->common_public->action_unref(action);
     }
 
   } while (surf_solve() >= 0.0);
     }
 
   } while (surf_solve() >= 0.0);
index 8ffdc0e..8201a45 100644 (file)
@@ -95,13 +95,13 @@ void test(char *platform)
               xbt_swag_extract(model->common_public->
                                states.failed_action_set))) {
         DEBUG1("\t * Failed : %p", action);
               xbt_swag_extract(model->common_public->
                                states.failed_action_set))) {
         DEBUG1("\t * Failed : %p", action);
-        model->common_public->action_free(action);
+        model->common_public->action_unref(action);
       }
       while ((action =
               xbt_swag_extract(model->common_public->
                                states.done_action_set))) {
         DEBUG1("\t * Done : %p", action);
       }
       while ((action =
               xbt_swag_extract(model->common_public->
                                states.done_action_set))) {
         DEBUG1("\t * Done : %p", action);
-        model->common_public->action_free(action);
+        model->common_public->action_unref(action);
       }
     }
   } while (surf_solve() >= 0.0);
       }
     }
   } while (surf_solve() >= 0.0);