Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the create_resource entry point in resource model APIs
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 20 Dec 2012 08:33:36 +0000 (09:33 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 20 Dec 2012 08:33:36 +0000 (09:33 +0100)
That's a leftover from ancient times that is not used anymore.
Instead, these functions are registered by each model as callbacks
within the sg_platf mechanism, which is now the unique way to create
resources (we had up to 3 different ways to create resources in the
code base :)

src/include/surf/surf.h
src/surf/cpu_cas01.c
src/surf/cpu_ti.c
src/surf/network.c
src/surf/storage.c
src/surf/workstation_ptask_L07.c

index 591de8d..6100dfa 100644 (file)
@@ -197,13 +197,6 @@ typedef struct surf_cpu_model_extension_public {
   e_surf_resource_state_t(*get_state) (void *cpu);
   double (*get_speed) (void *cpu, double load);
   double (*get_available_speed) (void *cpu);
   e_surf_resource_state_t(*get_state) (void *cpu);
   double (*get_speed) (void *cpu, double load);
   double (*get_available_speed) (void *cpu);
-  void* (*create_resource) (const char *name, double power_peak,
-                           double power_scale,
-                           tmgr_trace_t power_trace,
-                           int core,
-                           e_surf_resource_state_t state_initial,
-                           tmgr_trace_t state_trace,
-                           xbt_dict_t cpu_properties);
   void (*add_traces) (void);
 } s_surf_model_extension_cpu_t;
 
   void (*add_traces) (void);
 } s_surf_model_extension_cpu_t;
 
@@ -223,16 +216,6 @@ typedef struct surf_network_model_extension_public {
   double (*get_link_latency) (const void *link);
   int (*link_shared) (const void *link);
   void (*add_traces) (void);
   double (*get_link_latency) (const void *link);
   int (*link_shared) (const void *link);
   void (*add_traces) (void);
-  void* (*create_resource) (const char *name,
-                           double bw_initial,
-                           tmgr_trace_t bw_trace,
-                           double lat_initial,
-                           tmgr_trace_t lat_trace,
-                           e_surf_resource_state_t
-                           state_initial,
-                           tmgr_trace_t state_trace,
-                           e_surf_link_sharing_policy_t policy,
-                           xbt_dict_t properties);
 } s_surf_model_extension_network_t;
 
 /* Storage model */
 } s_surf_model_extension_network_t;
 
 /* Storage model */
@@ -251,7 +234,6 @@ typedef struct surf_storage_model_extension_public {
   surf_action_t(*stat) (void *storage, surf_file_t stream);
   surf_action_t(*unlink) (void *storage, surf_file_t stream);
   surf_action_t(*ls) (void *storage, const char *path);
   surf_action_t(*stat) (void *storage, surf_file_t stream);
   surf_action_t(*unlink) (void *storage, surf_file_t stream);
   surf_action_t(*ls) (void *storage, const char *path);
-  void* (*create_resource) (const char* id, const char* model, const char* type_id, const char *content);
 } s_surf_model_extension_storage_t;
 
      /** \ingroup SURF_models
 } s_surf_model_extension_storage_t;
 
      /** \ingroup SURF_models
@@ -289,22 +271,6 @@ typedef struct surf_workstation_model_extension_public {
 
   int (*link_shared) (const void *link);
    xbt_dict_t(*get_properties) (const void *resource);
 
   int (*link_shared) (const void *link);
    xbt_dict_t(*get_properties) (const void *resource);
-  void* (*link_create_resource) (const char *name,
-                                double bw_initial,
-                                tmgr_trace_t bw_trace,
-                                double lat_initial,
-                                tmgr_trace_t lat_trace,
-                                e_surf_resource_state_t
-                                state_initial,
-                                tmgr_trace_t state_trace,
-                                e_surf_link_sharing_policy_t
-                                policy, xbt_dict_t properties);
-  void* (*cpu_create_resource) (const char *name, double power_peak,
-                               double power_scale,
-                               tmgr_trace_t power_trace,
-                               e_surf_resource_state_t state_initial,
-                               tmgr_trace_t state_trace,
-                               xbt_dict_t cpu_properties);
   void (*add_traces) (void);
 
 } s_surf_model_extension_workstation_t;
   void (*add_traces) (void);
 
 } s_surf_model_extension_workstation_t;
index 10332f9..79bbc86 100644 (file)
@@ -43,6 +43,7 @@ static xbt_swag_t
     cpu_running_action_set_that_does_not_need_being_checked = NULL;
 
 
     cpu_running_action_set_that_does_not_need_being_checked = NULL;
 
 
+/* This function is registered as a callback to sg_platf_new_host() and never called directly */
 static void *cpu_create_resource(const char *name, double power_peak,
                                  double power_scale,
                                  tmgr_trace_t power_trace,
 static void *cpu_create_resource(const char *name, double power_peak,
                                  double power_scale,
                                  tmgr_trace_t power_trace,
@@ -392,7 +393,6 @@ static void surf_cpu_model_init_internal()
   surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
   surf_cpu_model->extension.cpu.get_available_speed =
       cpu_get_available_speed;
   surf_cpu_model->extension.cpu.get_speed = cpu_get_speed;
   surf_cpu_model->extension.cpu.get_available_speed =
       cpu_get_available_speed;
-  surf_cpu_model->extension.cpu.create_resource = cpu_create_resource;
   surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
 
   if (!surf_cpu_model->model_private->maxmin_system) {
   surf_cpu_model->extension.cpu.add_traces = cpu_add_traces_cpu;
 
   if (!surf_cpu_model->model_private->maxmin_system) {
index a4e40b9..30d23f8 100644 (file)
@@ -795,7 +795,6 @@ static void surf_cpu_ti_model_init_internal(void)
   surf_cpu_model->extension.cpu.get_speed = cpu_ti_get_speed;
   surf_cpu_model->extension.cpu.get_available_speed =
       cpu_ti_get_available_speed;
   surf_cpu_model->extension.cpu.get_speed = cpu_ti_get_speed;
   surf_cpu_model->extension.cpu.get_available_speed =
       cpu_ti_get_available_speed;
-  surf_cpu_model->extension.cpu.create_resource = cpu_ti_create_resource;
   surf_cpu_model->extension.cpu.add_traces = add_traces_cpu_ti;
 
   cpu_ti_action_heap = xbt_heap_new(8, NULL);
   surf_cpu_model->extension.cpu.add_traces = add_traces_cpu_ti;
 
   cpu_ti_action_heap = xbt_heap_new(8, NULL);
index 4b6d925..b83aeee 100644 (file)
@@ -806,8 +806,6 @@ static void surf_network_model_init_internal(void)
       net_get_link_latency;
   surf_network_model->extension.network.link_shared = net_link_shared;
   surf_network_model->extension.network.add_traces = net_add_traces;
       net_get_link_latency;
   surf_network_model->extension.network.link_shared = net_link_shared;
   surf_network_model->extension.network.add_traces = net_add_traces;
-  surf_network_model->extension.network.create_resource =
-      net_create_resource;
 
   if (!surf_network_model->model_private->maxmin_system)
     surf_network_model->model_private->maxmin_system = lmm_system_new(surf_network_model->model_private->selective_update);
 
   if (!surf_network_model->model_private->maxmin_system)
     surf_network_model->model_private->maxmin_system = lmm_system_new(surf_network_model->model_private->selective_update);
index 5dd92c0..4d82cd3 100644 (file)
@@ -518,7 +518,6 @@ static void surf_storage_model_init_internal(void)
   surf_storage_model->extension.storage.stat = storage_action_stat;
   surf_storage_model->extension.storage.unlink = storage_action_unlink;
   surf_storage_model->extension.storage.ls = storage_action_ls;
   surf_storage_model->extension.storage.stat = storage_action_stat;
   surf_storage_model->extension.storage.unlink = storage_action_unlink;
   surf_storage_model->extension.storage.ls = storage_action_ls;
-  surf_storage_model->extension.storage.create_resource = storage_create_resource;
 
   if (!storage_maxmin_system) {
     storage_maxmin_system = lmm_system_new(storage_selective_update);
 
   if (!storage_maxmin_system) {
     storage_maxmin_system = lmm_system_new(storage_selective_update);
index b6460e0..662b384 100644 (file)
@@ -890,10 +890,6 @@ static void ptask_model_init_internal(void)
       ptask_link_shared;
   surf_workstation_model->extension.workstation.get_properties =
       surf_resource_properties;
       ptask_link_shared;
   surf_workstation_model->extension.workstation.get_properties =
       surf_resource_properties;
-  surf_workstation_model->extension.workstation.link_create_resource =
-      ptask_link_create_resource;
-  surf_workstation_model->extension.workstation.cpu_create_resource =
-      ptask_cpu_create_resource;
   surf_workstation_model->extension.workstation.add_traces =
       ptask_add_traces;
 
   surf_workstation_model->extension.workstation.add_traces =
       ptask_add_traces;
 
@@ -914,7 +910,6 @@ static void ptask_model_init_internal(void)
   surf_network_model->extension.network.get_link_latency = ptask_get_link_latency;
   surf_network_model->extension.network.link_shared = ptask_link_shared;
   surf_network_model->extension.network.add_traces = NULL;
   surf_network_model->extension.network.get_link_latency = ptask_get_link_latency;
   surf_network_model->extension.network.link_shared = ptask_link_shared;
   surf_network_model->extension.network.add_traces = NULL;
-  surf_network_model->extension.network.create_resource = NULL;
 }
 
 /**************************************/
 }
 
 /**************************************/