Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill surf_parse_get_trace() which were a useless wrapper to tmgr_trace_new
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Jul 2009 15:26:05 +0000 (15:26 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 13 Jul 2009 15:26:05 +0000 (15:26 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6471 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surfxml_parse_private.h
src/surf/cpu.c
src/surf/network.c
src/surf/surf.c
src/surf/surfxml_parse.c
src/surf/trace_mgr.c
src/surf/workstation_ptask_L07.c

index 74193b4..57becf4 100644 (file)
@@ -14,6 +14,5 @@
 #include "surf/surfxml_parse.h"
 #include "surf/trace_mgr.h"
 
 #include "surf/surfxml_parse.h"
 #include "surf/trace_mgr.h"
 
-void surf_parse_get_trace(tmgr_trace_t * trace, const char *string);
 
 #endif
 
 #endif
index a6cfe86..e331a45 100644 (file)
@@ -75,7 +75,7 @@ static void parse_cpu_init(void)
 
   power_scale = get_cpu_power(A_surfxml_host_power);
   surf_parse_get_double(&power_initial, A_surfxml_host_availability);
 
   power_scale = get_cpu_power(A_surfxml_host_power);
   surf_parse_get_double(&power_initial, A_surfxml_host_availability);
-  surf_parse_get_trace(&power_trace, A_surfxml_host_availability_file);
+  power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
@@ -84,7 +84,7 @@ static void parse_cpu_init(void)
     state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
     state_initial = SURF_RESOURCE_OFF;
     state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
     state_initial = SURF_RESOURCE_OFF;
-  surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
+  state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
   current_property_set = xbt_dict_new();
   cpu_new(xbt_strdup(A_surfxml_host_id), power_scale, power_initial,
 
   current_property_set = xbt_dict_new();
   cpu_new(xbt_strdup(A_surfxml_host_id), power_scale, power_initial,
index bb035a8..225a7e7 100644 (file)
@@ -74,9 +74,9 @@ static void parse_link_init(void)
 
   name_link = xbt_strdup(A_surfxml_link_id);
   surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
 
   name_link = xbt_strdup(A_surfxml_link_id);
   surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
-  surf_parse_get_trace(&bw_trace, A_surfxml_link_bandwidth_file);
+  bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
-  surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
+  lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
 
   xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
               || (A_surfxml_link_state ==
 
   xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
               || (A_surfxml_link_state ==
@@ -92,7 +92,7 @@ static void parse_link_init(void)
            A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
            A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
-  surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
+  state_trace = tmgr_trace_new(A_surfxml_link_state_file);
 
   link_new(name_link, bw_initial, bw_trace,
            lat_initial, lat_trace, state_initial_link, state_trace,
 
   link_new(name_link, bw_initial, bw_trace,
            lat_initial, lat_trace, state_initial_link, state_trace,
index 0ac05fb..7ac373f 100644 (file)
@@ -235,6 +235,7 @@ XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange);
 XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange_dichotomy);
 XBT_LOG_EXTERNAL_CATEGORY(surf_maxmin);
 XBT_LOG_EXTERNAL_CATEGORY(surf_network);
 XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange_dichotomy);
 XBT_LOG_EXTERNAL_CATEGORY(surf_maxmin);
 XBT_LOG_EXTERNAL_CATEGORY(surf_network);
+XBT_LOG_EXTERNAL_CATEGORY(surf_trace);
 XBT_LOG_EXTERNAL_CATEGORY(surf_parse);
 XBT_LOG_EXTERNAL_CATEGORY(surf_timer);
 XBT_LOG_EXTERNAL_CATEGORY(surf_workstation);
 XBT_LOG_EXTERNAL_CATEGORY(surf_parse);
 XBT_LOG_EXTERNAL_CATEGORY(surf_timer);
 XBT_LOG_EXTERNAL_CATEGORY(surf_workstation);
@@ -258,6 +259,7 @@ void surf_init(int *argc, char **argv)
   XBT_LOG_CONNECT(surf_lagrange_dichotomy, surf_lagrange);
   XBT_LOG_CONNECT(surf_maxmin, surf);
   XBT_LOG_CONNECT(surf_network, surf);
   XBT_LOG_CONNECT(surf_lagrange_dichotomy, surf_lagrange);
   XBT_LOG_CONNECT(surf_maxmin, surf);
   XBT_LOG_CONNECT(surf_network, surf);
+  XBT_LOG_CONNECT(surf_trace, surf);
   XBT_LOG_CONNECT(surf_parse, surf);
   XBT_LOG_CONNECT(surf_timer, surf);
   XBT_LOG_CONNECT(surf_workstation, surf);
   XBT_LOG_CONNECT(surf_parse, surf);
   XBT_LOG_CONNECT(surf_timer, surf);
   XBT_LOG_CONNECT(surf_workstation, surf);
index e4a04e7..be1a261 100644 (file)
@@ -506,14 +506,6 @@ void surf_parse_get_int(int *value, const char *string)
     surf_parse_error(bprintf("%s is not an integer", string));
 }
 
     surf_parse_error(bprintf("%s is not an integer", string));
 }
 
-void surf_parse_get_trace(tmgr_trace_t * trace, const char *string)
-{
-  if ((!string) || (strcmp(string, "") == 0))
-    *trace = NULL;
-  else
-    *trace = tmgr_trace_new(string);
-}
-
 void parse_properties(void)
 {
   char *value = NULL;
 void parse_properties(void)
 {
   char *value = NULL;
@@ -1222,7 +1214,7 @@ static void parse_trace_finalize(void)
 {
   tmgr_trace_t trace;
   if (!trace_file || strcmp(trace_file, "") != 0) {
 {
   tmgr_trace_t trace;
   if (!trace_file || strcmp(trace_file, "") != 0) {
-    surf_parse_get_trace(&trace, trace_file);
+    trace = tmgr_trace_new(trace_file);
   } else {
     if (strcmp(surfxml_pcdata, "") == 0)
       trace = NULL;
   } else {
     if (strcmp(surfxml_pcdata, "") == 0)
       trace = NULL;
index 6442cb3..57d4dae 100644 (file)
@@ -12,6 +12,8 @@
 #include "trace_mgr_private.h"
 #include "surf_private.h"
 
 #include "trace_mgr_private.h"
 #include "surf_private.h"
 
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_trace, surf,"Surf trace management");
+
 static xbt_dict_t trace_list = NULL;
 static void _tmgr_trace_free(void *trace)
 {
 static xbt_dict_t trace_list = NULL;
 static void _tmgr_trace_free(void *trace)
 {
@@ -107,15 +109,19 @@ tmgr_trace_t tmgr_trace_new(const char *filename)
   s_tmgr_event_t event;
   tmgr_event_t last_event = NULL;
 
   s_tmgr_event_t event;
   tmgr_event_t last_event = NULL;
 
+  if ((!filename) || (strcmp(filename, "") == 0))
+    return NULL;
+
   if (trace_list) {
     trace = xbt_dict_get_or_null(trace_list, filename);
   if (trace_list) {
     trace = xbt_dict_get_or_null(trace_list, filename);
-    if (trace)
+    if (trace) {
+      WARN1("Ignoring redefinition of trace %s",filename);
       return trace;
       return trace;
+    }
   }
 
   }
 
-  if ((f = surf_fopen(filename, "r")) == NULL) {
-    xbt_assert1(0, "Cannot open file '%s'", filename);
-  }
+  f = surf_fopen(filename, "r");
+  xbt_assert1(f!=NULL, "Cannot open file '%s'", filename);
 
   trace = xbt_new0(s_tmgr_trace_t, 1);
   trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
 
   trace = xbt_new0(s_tmgr_trace_t, 1);
   trace->event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
index ac34f93..ba86059 100644 (file)
@@ -629,7 +629,7 @@ static void parse_cpu_init(void)
 
   power_scale = get_cpu_power(A_surfxml_host_power);
   surf_parse_get_double(&power_initial, A_surfxml_host_availability);
 
   power_scale = get_cpu_power(A_surfxml_host_power);
   surf_parse_get_double(&power_initial, A_surfxml_host_availability);
 surf_parse_get_trace(&power_trace, A_surfxml_host_availability_file);
power_trace = tmgr_trace_new(A_surfxml_host_availability_file);
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
 
   xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) ||
               (A_surfxml_host_state == A_surfxml_host_state_OFF),
@@ -638,7 +638,7 @@ static void parse_cpu_init(void)
     state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
     state_initial = SURF_RESOURCE_OFF;
     state_initial = SURF_RESOURCE_ON;
   if (A_surfxml_host_state == A_surfxml_host_state_OFF)
     state_initial = SURF_RESOURCE_OFF;
-  surf_parse_get_trace(&state_trace, A_surfxml_host_state_file);
+  state_trace = tmgr_trace_new(A_surfxml_host_state_file);
 
   current_property_set = xbt_dict_new();
   cpu_new(A_surfxml_host_id, power_scale, power_initial, power_trace,
 
   current_property_set = xbt_dict_new();
   cpu_new(A_surfxml_host_id, power_scale, power_initial, power_trace,
@@ -702,9 +702,9 @@ static void parse_link_init(void)
 
   name_link = xbt_strdup(A_surfxml_link_id);
   surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
 
   name_link = xbt_strdup(A_surfxml_link_id);
   surf_parse_get_double(&bw_initial, A_surfxml_link_bandwidth);
-  surf_parse_get_trace(&bw_trace, A_surfxml_link_bandwidth_file);
+  bw_trace = tmgr_trace_new(A_surfxml_link_bandwidth_file);
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
   surf_parse_get_double(&lat_initial, A_surfxml_link_latency);
-  surf_parse_get_trace(&lat_trace, A_surfxml_link_latency_file);
+  lat_trace = tmgr_trace_new(A_surfxml_link_latency_file);
 
   xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
               || (A_surfxml_link_state ==
 
   xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON)
               || (A_surfxml_link_state ==
@@ -720,7 +720,7 @@ static void parse_link_init(void)
            A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
            A_surfxml_link_sharing_policy_FATPIPE)
     policy_initial_link = SURF_LINK_FATPIPE;
 
-  surf_parse_get_trace(&state_trace, A_surfxml_link_state_file);
+  state_trace = tmgr_trace_new(A_surfxml_link_state_file);
 
   current_property_set = xbt_dict_new();
   link_new(name_link, bw_initial, bw_trace, lat_initial, lat_trace,
 
   current_property_set = xbt_dict_new();
   link_new(name_link, bw_initial, bw_trace, lat_initial, lat_trace,