git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6471
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
#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);
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),
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,
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 ==
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,
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);
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);
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;
{
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;
#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)
{
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) {
+ WARN1("Ignoring redefinition of trace %s",filename);
- 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);
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),
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,
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 ==
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,