Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Parser cleanup: simplify structure's fields' names
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Nov 2011 10:42:19 +0000 (11:42 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Nov 2011 10:42:19 +0000 (11:42 +0100)
Damn, my eclipse fail that refactoring! That's manual, pity me...

include/simgrid/platf.h
src/bindings/lua/lua_console.c
src/instr/instr_routing.c
src/surf/cpu.c
src/surf/cpu_im.c
src/surf/cpu_ti.c
src/surf/surf_routing.c
src/surf/surfxml_parse.c
src/surf/workstation_ptask_L07.c

index e67f56d..a10f884 100644 (file)
@@ -31,14 +31,14 @@ typedef enum {
  */
 
 typedef struct {
  */
 
 typedef struct {
-  const char* V_host_id;                          //id
-  double V_host_power_peak;                     //power
-  int V_host_core;                          //core
-  double V_host_power_scale;                      //availability
-  tmgr_trace_t V_host_power_trace;                  //availability file
-  e_surf_resource_state_t V_host_state_initial;           //state
-  tmgr_trace_t V_host_state_trace;                  //state file
-  const char* V_host_coord;
+  const char* id;
+  double power_peak;
+  int core_amount;
+  double power_scale;
+  tmgr_trace_t power_trace;
+  e_surf_resource_state_t initial_state;
+  tmgr_trace_t state_trace;
+  const char* coord;
   xbt_dict_t properties;
 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
 
   xbt_dict_t properties;
 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
 
index afa8a94..6749e65 100644 (file)
@@ -41,32 +41,32 @@ int console_add_host(lua_State *L) {
   // get Id Value
   lua_pushstring(L, "id");
   lua_gettable(L, -2);
   // get Id Value
   lua_pushstring(L, "id");
   lua_gettable(L, -2);
-  host.V_host_id = lua_tostring(L, -1);
+  host.id = lua_tostring(L, -1);
   lua_pop(L, 1);
 
   // get power value
   lua_pushstring(L, "power");
   lua_gettable(L, -2);
   lua_pop(L, 1);
 
   // get power value
   lua_pushstring(L, "power");
   lua_gettable(L, -2);
-  host.V_host_power_peak = lua_tonumber(L, -1);
+  host.power_peak = lua_tonumber(L, -1);
   lua_pop(L, 1);
 
   //get power_scale
   lua_pushstring(L, "power_scale");
   lua_gettable(L, -2);
   lua_pop(L, 1);
 
   //get power_scale
   lua_pushstring(L, "power_scale");
   lua_gettable(L, -2);
-  host.V_host_power_scale = lua_tonumber(L, -1);
+  host.power_scale = lua_tonumber(L, -1);
   lua_pop(L, 1);
 
   //get power_trace
   lua_pushstring(L, "power_trace");
   lua_gettable(L, -2);
   lua_pop(L, 1);
 
   //get power_trace
   lua_pushstring(L, "power_trace");
   lua_gettable(L, -2);
-  host.V_host_power_trace = tmgr_trace_new(lua_tostring(L, -1));
+  host.power_trace = tmgr_trace_new(lua_tostring(L, -1));
   lua_pop(L, 1);
 
   lua_pushstring(L, "core");
   lua_gettable(L, -2);
   lua_pop(L, 1);
 
   lua_pushstring(L, "core");
   lua_gettable(L, -2);
-  host.V_host_core = lua_tonumber(L, -1);
-  if (host.V_host_core == 0)
-    host.V_host_core = 1;
+  host.core_amount = lua_tonumber(L, -1);
+  if (host.core_amount == 0)
+    host.core_amount = 1;
   lua_pop(L, 1);
 
   //get state initial
   lua_pop(L, 1);
 
   //get state initial
@@ -75,14 +75,14 @@ int console_add_host(lua_State *L) {
   state = lua_tonumber(L, -1);
   lua_pop(L, 1);
   if (state)
   state = lua_tonumber(L, -1);
   lua_pop(L, 1);
   if (state)
-    host.V_host_state_initial = SURF_RESOURCE_ON;
+    host.initial_state = SURF_RESOURCE_ON;
   else
   else
-    host.V_host_state_initial = SURF_RESOURCE_OFF;
+    host.initial_state = SURF_RESOURCE_OFF;
 
   //get trace state
   lua_pushstring(L, "state_trace");
   lua_gettable(L, -2);
 
   //get trace state
   lua_pushstring(L, "state_trace");
   lua_gettable(L, -2);
-  host.V_host_state_trace = tmgr_trace_new(lua_tostring(L, -1));
+  host.state_trace = tmgr_trace_new(lua_tostring(L, -1));
   lua_pop(L, 1);
 
   sg_platf_new_host(&host);
   lua_pop(L, 1);
 
   sg_platf_new_host(&host);
index ae62d45..e764a6a 100644 (file)
@@ -228,11 +228,11 @@ static void instr_routing_parse_start_link (sg_platf_link_cbarg_t link)
 static void instr_routing_parse_start_host (sg_platf_host_cbarg_t host)
 {
   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
 static void instr_routing_parse_start_host (sg_platf_host_cbarg_t host)
 {
   container_t father = *(container_t*)xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
-  container_t new = newContainer (host->V_host_id, INSTR_HOST, father);
+  container_t new = newContainer (host->id, INSTR_HOST, father);
 
   if (TRACE_categorized() || TRACE_uncategorized()) {
     type_t power = getVariableType ("power", NULL, new->type);
 
   if (TRACE_categorized() || TRACE_uncategorized()) {
     type_t power = getVariableType ("power", NULL, new->type);
-    new_pajeSetVariable (0, new, power, host->V_host_power_peak);
+    new_pajeSetVariable (0, new, power, host->power_peak);
   }
   if (TRACE_uncategorized()){
     getVariableType ("power_used", "0.5 0.5 0.5", new->type);
   }
   if (TRACE_uncategorized()){
     getVariableType ("power_used", "0.5 0.5 0.5", new->type);
index d08b7e0..3106dbf 100644 (file)
@@ -73,15 +73,15 @@ static void* cpu_create_resource(const char *name, double power_peak,
 
 static void parse_cpu_init(sg_platf_host_cbarg_t host)
 {
 
 static void parse_cpu_init(sg_platf_host_cbarg_t host)
 {
-  if(strcmp(host->V_host_coord,"")) xbt_die("Coordinates not implemented yet!");
-
-  cpu_create_resource(host->V_host_id,
-                 host->V_host_power_peak,
-                 host->V_host_power_scale,
-                 host->V_host_power_trace,
-                 host->V_host_core,
-                 host->V_host_state_initial,
-                 host->V_host_state_trace,
+  if(strcmp(host->coord,"")) xbt_die("Coordinates not implemented yet!");
+
+  cpu_create_resource(host->id,
+                 host->power_peak,
+                 host->power_scale,
+                 host->power_trace,
+                 host->core_amount,
+                 host->initial_state,
+                 host->state_trace,
                  host->properties);
 }
 
                  host->properties);
 }
 
index d1c841e..6adc2bc 100644 (file)
@@ -90,13 +90,13 @@ static void* cpu_im_create_resource(const char *name, double power_peak,
 
 static void parse_cpu_im_init(sg_platf_host_cbarg_t host)
 {
 
 static void parse_cpu_im_init(sg_platf_host_cbarg_t host)
 {
-       cpu_im_create_resource(host->V_host_id,
-                         host->V_host_power_peak,
-                         host->V_host_power_scale,
-                         host->V_host_power_trace,
-                         host->V_host_core,
-                         host->V_host_state_initial,
-                         host->V_host_state_trace,
+       cpu_im_create_resource(host->id,
+                         host->power_peak,
+                         host->power_scale,
+                         host->power_trace,
+                         host->core_amount,
+                         host->initial_state,
+                         host->state_trace,
                          host->properties);
 }
 
                          host->properties);
 }
 
index db57d05..6aabfd2 100644 (file)
@@ -192,13 +192,13 @@ static void* cpu_ti_create_resource(const char *name, double power_peak,
 
 static void parse_cpu_ti_init(sg_platf_host_cbarg_t host)
 {
 
 static void parse_cpu_ti_init(sg_platf_host_cbarg_t host)
 {
-  cpu_ti_create_resource(host->V_host_id,
-                         host->V_host_power_peak,
-                         host->V_host_power_scale,
-                         host->V_host_power_trace,
-                         host->V_host_core,
-                         host->V_host_state_initial,
-                         host->V_host_state_trace,
+  cpu_ti_create_resource(host->id,
+                         host->power_peak,
+                         host->power_scale,
+                         host->power_trace,
+                         host->core_amount,
+                         host->initial_state,
+                         host->state_trace,
                          host->properties);
 
 }
                          host->properties);
 
 }
index cfd09c5..d81bfe5 100644 (file)
@@ -105,22 +105,22 @@ static void parse_S_host(sg_platf_host_cbarg_t host) {
   network_element_info_t info = NULL;
   if (current_routing->hierarchy == SURF_ROUTING_NULL)
     current_routing->hierarchy = SURF_ROUTING_BASE;
   network_element_info_t info = NULL;
   if (current_routing->hierarchy == SURF_ROUTING_NULL)
     current_routing->hierarchy = SURF_ROUTING_BASE;
-  xbt_assert(!xbt_lib_get_or_null(host_lib, host->V_host_id,ROUTING_HOST_LEVEL),
+  xbt_assert(!xbt_lib_get_or_null(host_lib, host->id,ROUTING_HOST_LEVEL),
               "Reading a host, processing unit \"%s\" already exists",
               "Reading a host, processing unit \"%s\" already exists",
-              host->V_host_id);
+              host->id);
   xbt_assert(current_routing->set_processing_unit,
               "no defined method \"set_processing_unit\" in \"%s\"",
               current_routing->name);
   xbt_assert(current_routing->set_processing_unit,
               "no defined method \"set_processing_unit\" in \"%s\"",
               current_routing->name);
-  (*(current_routing->set_processing_unit)) (current_routing, host->V_host_id);
+  (*(current_routing->set_processing_unit)) (current_routing, host->id);
   info = xbt_new0(s_network_element_info_t, 1);
   info->rc_component = current_routing;
   info->rc_type = SURF_NETWORK_ELEMENT_HOST;
   info = xbt_new0(s_network_element_info_t, 1);
   info->rc_component = current_routing;
   info->rc_type = SURF_NETWORK_ELEMENT_HOST;
-  xbt_lib_set(host_lib,host->V_host_id,ROUTING_HOST_LEVEL,(void *) info);
-  if (host->V_host_coord && strcmp(host->V_host_coord,"")) {
+  xbt_lib_set(host_lib,host->id,ROUTING_HOST_LEVEL,(void *) info);
+  if (host->coord && strcmp(host->coord,"")) {
     if(!COORD_HOST_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'");
     if(!COORD_HOST_LEVEL) xbt_die("To use coordinates, you must set configuration 'coordinates' to 'yes'");
-    xbt_dynar_t ctn = xbt_str_split_str(host->V_host_coord, " ");
+    xbt_dynar_t ctn = xbt_str_split_str(host->coord, " ");
     xbt_dynar_shrink(ctn, 0);
     xbt_dynar_shrink(ctn, 0);
-    xbt_lib_set(host_lib,host->V_host_id,COORD_HOST_LEVEL,(void *) ctn);
+    xbt_lib_set(host_lib,host->id,COORD_HOST_LEVEL,(void *) ctn);
   }
 }
 
   }
 }
 
@@ -1425,13 +1425,13 @@ void routing_parse_Scluster(void)
                link_id = bprintf("%s_link_%d", struct_cluster->V_cluster_id, start);
 
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
                link_id = bprintf("%s_link_%d", struct_cluster->V_cluster_id, start);
 
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
-               host.V_host_id = host_id;
+               host.id = host_id;
                if(strcmp(struct_cluster->V_cluster_availability_file,"")){
                  xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free);
                  char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
                if(strcmp(struct_cluster->V_cluster_availability_file,"")){
                  xbt_dict_set(patterns, "radical", bprintf("%d", start), xbt_free);
                  char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
-                 host.V_host_power_trace = tmgr_trace_new(tmp_availability_file);
+                 host.power_trace = tmgr_trace_new(tmp_availability_file);
                  xbt_free(tmp_availability_file);
                }
                else
                  xbt_free(tmp_availability_file);
                }
                else
@@ -1442,7 +1442,7 @@ void routing_parse_Scluster(void)
                  char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
                  char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
-                 host.V_host_state_trace = tmgr_trace_new(tmp_state_file);
+                 host.state_trace = tmgr_trace_new(tmp_state_file);
                  xbt_free(tmp_state_file);
                }
                else
                  xbt_free(tmp_state_file);
                }
                else
@@ -1450,11 +1450,11 @@ void routing_parse_Scluster(void)
                  XBT_DEBUG("\tstate_file=\"\"");
                }
 
                  XBT_DEBUG("\tstate_file=\"\"");
                }
 
-               host.V_host_power_peak = struct_cluster->S_cluster_power;
-               host.V_host_power_scale = 1.0;
-               host.V_host_core = struct_cluster->S_cluster_core;
-               host.V_host_state_initial = SURF_RESOURCE_ON;
-               host.V_host_coord = "";
+               host.power_peak = struct_cluster->S_cluster_power;
+               host.power_scale = 1.0;
+               host.core_amount = struct_cluster->S_cluster_core;
+               host.initial_state = SURF_RESOURCE_ON;
+               host.coord = "";
                sg_platf_new_host(&host);
                XBT_DEBUG("</host>");
 
                sg_platf_new_host(&host);
                XBT_DEBUG("</host>");
 
@@ -1523,13 +1523,13 @@ void routing_parse_Scluster(void)
                A_surfxml_host_state = A_surfxml_host_state_ON;
 
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
                A_surfxml_host_state = A_surfxml_host_state_ON;
 
                XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id, struct_cluster->S_cluster_power);
-               host.V_host_id = host_id;
+               host.id = host_id;
                if(strcmp(struct_cluster->V_cluster_availability_file,"")){
                  xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
                  char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
                if(strcmp(struct_cluster->V_cluster_availability_file,"")){
                  xbt_dict_set(patterns, "radical", bprintf("%d", i), xbt_free);
                  char* tmp_availability_file = xbt_strdup(struct_cluster->V_cluster_availability_file);
                  xbt_str_varsubst(tmp_availability_file,patterns);
                  XBT_DEBUG("\tavailability_file=\"%s\"",tmp_availability_file);
-                 host.V_host_power_trace = tmgr_trace_new(tmp_availability_file);
+                 host.power_trace = tmgr_trace_new(tmp_availability_file);
                  xbt_free(tmp_availability_file);
                }
                else
                  xbt_free(tmp_availability_file);
                }
                else
@@ -1540,7 +1540,7 @@ void routing_parse_Scluster(void)
                  char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
                  char *tmp_state_file = xbt_strdup(struct_cluster->V_cluster_state_file);
                  xbt_str_varsubst(tmp_state_file,patterns);
                  XBT_DEBUG("\tstate_file=\"%s\"",tmp_state_file);
-                 host.V_host_state_trace = tmgr_trace_new(tmp_state_file);
+                 host.state_trace = tmgr_trace_new(tmp_state_file);
                  xbt_free(tmp_state_file);
                }
                else
                  xbt_free(tmp_state_file);
                }
                else
@@ -1548,11 +1548,11 @@ void routing_parse_Scluster(void)
                  XBT_DEBUG("\tstate_file=\"\"");
                }
 
                  XBT_DEBUG("\tstate_file=\"\"");
                }
 
-               host.V_host_power_peak = struct_cluster->S_cluster_power;
-               host.V_host_power_scale = 1.0;
-               host.V_host_core = struct_cluster->S_cluster_core;
-               host.V_host_state_initial = SURF_RESOURCE_ON;
-               host.V_host_coord = "";
+               host.power_peak = struct_cluster->S_cluster_power;
+               host.power_scale = 1.0;
+               host.core_amount = struct_cluster->S_cluster_core;
+               host.initial_state = SURF_RESOURCE_ON;
+               host.coord = "";
                sg_platf_new_host(&host);
                XBT_DEBUG("</host>");
 
                sg_platf_new_host(&host);
                XBT_DEBUG("</host>");
 
index e18e079..1f110ec 100644 (file)
@@ -277,19 +277,19 @@ void STag_surfxml_host(void){
   xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
   host.properties = current_property_set = xbt_dict_new();
 
   xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
   host.properties = current_property_set = xbt_dict_new();
 
-       host.V_host_id = A_surfxml_host_id;
-       host.V_host_power_peak = get_cpu_power(A_surfxml_host_power);
-       host.V_host_power_scale = surf_parse_get_double( A_surfxml_host_availability);
-       host.V_host_core = surf_parse_get_int(A_surfxml_host_core);
-       host.V_host_power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
-       host.V_host_state_trace = tmgr_trace_new(A_surfxml_host_state_file);
+       host.id = A_surfxml_host_id;
+       host.power_peak = get_cpu_power(A_surfxml_host_power);
+       host.power_scale = surf_parse_get_double( A_surfxml_host_availability);
+       host.core_amount = surf_parse_get_int(A_surfxml_host_core);
+       host.power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
+       host.state_trace = tmgr_trace_new(A_surfxml_host_state_file);
        xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
                          (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state");
        if (A_surfxml_host_state == A_surfxml_host_state_ON)
        xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) ||
                          (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state");
        if (A_surfxml_host_state == A_surfxml_host_state_ON)
-               host.V_host_state_initial = SURF_RESOURCE_ON;
+               host.initial_state = SURF_RESOURCE_ON;
        if (A_surfxml_host_state == A_surfxml_host_state_OFF)
        if (A_surfxml_host_state == A_surfxml_host_state_OFF)
-               host.V_host_state_initial = SURF_RESOURCE_OFF;
-       host.V_host_coord = A_surfxml_host_coordinates;
+               host.initial_state = SURF_RESOURCE_OFF;
+       host.coord = A_surfxml_host_coordinates;
 
        sg_platf_new_host(&host);
 }
 
        sg_platf_new_host(&host);
 }
index 86f3e7a..cf5ca30 100644 (file)
@@ -657,12 +657,12 @@ static void* ptask_cpu_create_resource(const char *name, double power_scale,
 static void ptask_parse_cpu_init(sg_platf_host_cbarg_t host)
 {
   ptask_cpu_create_resource(
 static void ptask_parse_cpu_init(sg_platf_host_cbarg_t host)
 {
   ptask_cpu_create_resource(
-                 host->V_host_id,
-                 host->V_host_power_peak,
-                 host->V_host_power_scale,
-                 host->V_host_power_trace,
-                 host->V_host_state_initial,
-                 host->V_host_state_trace,
+                 host->id,
+                 host->power_peak,
+                 host->power_scale,
+                 host->power_trace,
+                 host->initial_state,
+                 host->state_trace,
                  host->properties);
 }
 
                  host->properties);
 }