* \return 0 if everything is ok
*/
int TRACE_start_with_mask(const char *filename, int mask) {
+ FILE *file = NULL;
if (IS_TRACING) { /* what? trace is already active... ignore.. */
THROW0 (tracing_error, TRACE_ERROR_START,
"TRACE_start called, but tracing is already active");
"unknown tracing mask");
}
- FILE *file = fopen(filename, "w");
+ file = fopen(filename, "w");
if (!file) {
THROW1 (tracing_error, TRACE_ERROR_START,
"Tracefile %s could not be opened for writing.", filename);
}
int TRACE_end() {
+ FILE *file = NULL;
if (!IS_TRACING) return 1;
- FILE *file = TRACE_paje_end();
+ file = TRACE_paje_end();
fclose (file);
return 0;
}
int TRACE_category (const char *category)
{
- if (!IS_TRACING) return 1;
static int first_time = 1;
+ if (!IS_TRACING) return 1;
+
if (first_time){
TRACE_define_type ("user_type", "0", 1);
first_time = 0;
void TRACE_define_type (const char *type,
const char *parent_type, int final) {
+ char *val_one = NULL;
if (!IS_TRACING) return;
//check if type is already defined
if (IS_TRACING_TASKS) pajeDefineContainerType ("task", type, "task");
if (IS_TRACING_TASKS) pajeDefineStateType ("task-state", "task", "task-state");
}
- char *val_one = xbt_strdup ("1");
+ val_one = xbt_strdup ("1");
xbt_dict_set (defined_types, type, &val_one, xbt_free);
}
int TRACE_create_category (const char *category,
const char *type, const char *parent_category)
{
+ char state[100];
+ char *val_one = NULL;
if (!IS_TRACING) return 1;
//check if type is defined
pajeCreateContainer(MSG_get_clock(), category, type, parent_category, category);
/* for registering application categories on top of platform */
- char state[100];
+
snprintf (state, 100, "b%s", category);
if (IS_TRACING_PLATFORM) pajeDefineVariableType (state, "LINK", state);
snprintf (state, 100, "p%s", category);
if (IS_TRACING_PLATFORM) pajeDefineVariableType (state, "HOST", state);
- char *val_one = xbt_strdup ("1");
+ val_one = xbt_strdup ("1");
xbt_dict_set (created_categories, category, &val_one, xbt_free);
return 0;
}
void __TRACE_msg_process_location (m_process_t process)
{
+ char name[200], alias[200];
+ m_host_t host = NULL;
if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME)) return;
- char name[200], alias[200];
- m_host_t host = MSG_process_get_host (process);
+ host = MSG_process_get_host (process);
TRACE_process_container (process, name, 200);
TRACE_process_alias_container (process, host, alias, 200);
void __TRACE_msg_process_present (m_process_t process)
{
+ char alias[200];
+ m_host_t host = NULL;
if (!IS_TRACING_PROCESSES) return;
//updating presence state of this process location
- char alias[200];
- m_host_t host = MSG_process_get_host (process);
+ host = MSG_process_get_host (process);
TRACE_process_alias_container (process, host, alias, 200);
pajePushState (MSG_get_clock(), "presence", alias, "presence");
}
*/
void TRACE_msg_set_process_category (m_process_t process, const char *category)
{
+ char name[200];
if (!IS_TRACING) return;
//set process category
__TRACE_msg_process_present (process);
//create container of type "process" to indicate behavior
- char name[200];
TRACE_process_container (process, name, 200);
if (IS_TRACING_PROCESSES) pajeCreateContainer (MSG_get_clock(), name, "process", category, name);
if (IS_TRACING_PROCESSES) pajeSetState (MSG_get_clock(), "process-state", name, "executing");
*/
void TRACE_msg_process_change_host (m_process_t process, m_host_t old_host, m_host_t new_host)
{
+ char alias[200];
if (!(IS_TRACING_PROCESSES || IS_TRACING_VOLUME) || !IS_TRACED(process)) return;
//disabling presence in old_host (__TRACE_msg_process_not_present)
- char alias[200];
TRACE_process_alias_container (process, old_host, alias, 200);
if (IS_TRACING_PROCESSES) pajePopState (MSG_get_clock(), "presence", alias);
void TRACE_msg_process_kill (m_process_t process)
{
+ char name[200];
if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
- char name[200];
TRACE_process_container (process, name, 200);
pajeDestroyContainer (MSG_get_clock(), "process", name);
}
void TRACE_msg_process_suspend (m_process_t process)
-{
+{ char name[200];
if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
- char name[200];
TRACE_process_container (process, name, 200);
pajeSetState (MSG_get_clock(), "process-state", name, "suspend");
}
void TRACE_msg_process_resume (m_process_t process)
{
+ char name[200];
if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
- char name[200];
TRACE_process_container (process, name, 200);
pajeSetState (MSG_get_clock(), "process-state", name, "executing");
}
void TRACE_msg_process_sleep_in (m_process_t process)
{
+ char name[200];
if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
- char name[200];
TRACE_process_container (process, name, 200);
pajeSetState (MSG_get_clock(), "process-state", name, "sleep");
}
void TRACE_msg_process_sleep_out (m_process_t process)
{
+ char name[200];
if (!IS_TRACING_PROCESSES || !IS_TRACED(process)) return;
- char name[200];
TRACE_process_container (process, name, 200);
pajeSetState (MSG_get_clock(), "process-state", name, "executing");
}
void TRACE_msg_process_end (m_process_t process)
{
+ char name[200], alias[200];
+ m_host_t host = NULL;
if (!IS_TRACED(process)) return;
- char name[200], alias[200];
- m_host_t host = MSG_process_get_host (process);
+ host = MSG_process_get_host (process);
TRACE_process_container (process, name, 200);
TRACE_process_alias_container (process, host, alias, 200);
if (IS_TRACING_PROCESSES) pajeDestroyContainer (MSG_get_clock(), "process", name);
void __TRACE_current_category_set (m_task_t task)
{
char processid[100];
+ char *var_cpy = NULL;
snprintf (processid, 100, "%p", SIMIX_process_self());
- char *var_cpy = xbt_strdup (task->category);
+ var_cpy = xbt_strdup (task->category);
xbt_dict_set (current_task_category, processid, var_cpy, xbt_free);
}
void __TRACE_task_location (m_task_t task)
{
+ char container[200];
+ char name[200], alias[200];
+ char *val_one = NULL;
+ m_process_t process = NULL;
+ m_host_t host = NULL;
if (!IS_TRACING_TASKS) return;
- char container[200];
- m_process_t process = MSG_process_self();
- m_host_t host = MSG_process_get_host (process);
+ process = MSG_process_self();
+ host = MSG_process_get_host (process);
//tasks are grouped by host
TRACE_host_container (host, container, 200);
-
- char name[200], alias[200];
TRACE_task_container (task, name, 200);
TRACE_task_alias_container (task, process, host, alias, 200);
//check if task container is already created
if (!xbt_dict_get_or_null (task_containers, alias)){
pajeCreateContainer (MSG_get_clock(), alias, "TASK", container, name);
pajeSetState (MSG_get_clock(), "category", alias, task->category);
- char *val_one = xbt_strdup ("1");
+ val_one = xbt_strdup ("1");
xbt_dict_set (task_containers, alias, val_one, xbt_free);
}
}
void __TRACE_task_location_present (m_task_t task)
{
+ char alias[200];
+ m_process_t process = NULL;
+ m_host_t host = NULL;
if (!IS_TRACING_TASKS) return;
//updating presence state of this task location
- m_process_t process = MSG_process_self();
- m_host_t host = MSG_process_get_host (process);
+ process = MSG_process_self();
+ host = MSG_process_get_host (process);
- char alias[200];
TRACE_task_alias_container (task, process, host, alias, 200);
pajePushState (MSG_get_clock(), "presence", alias, "presence");
}
void __TRACE_task_location_not_present (m_task_t task)
{
+ char alias[200];
+ m_process_t process = NULL;
+ m_host_t host = NULL;
if (!IS_TRACING_TASKS) return;
//updating presence state of this task location
- m_process_t process = MSG_process_self();
- m_host_t host = MSG_process_get_host (process);
+ process = MSG_process_self();
+ host = MSG_process_get_host (process);
- char alias[200];
TRACE_task_alias_container (task, process, host, alias, 200);
pajePopState (MSG_get_clock(), "presence", alias);
}
*/
void TRACE_msg_set_task_category(m_task_t task, const char *category)
{
+ char name[200];
if (!IS_TRACING) return;
//set task category
__TRACE_task_location (task);
__TRACE_task_location_present (task);
- char name[200];
TRACE_task_container (task, name, 200);
//create container of type "task" to indicate behavior
if (IS_TRACING_TASKS) pajeCreateContainer (MSG_get_clock(), name, "task", category, name);
/* MSG_task_execute related functions */
void TRACE_msg_task_execute_start (m_task_t task)
{
+ char name[200];
if (!IS_TRACING || !IS_TRACED(task)) return;
- char name[200];
TRACE_task_container (task, name, 200);
if (IS_TRACING_TASKS) pajePushState (MSG_get_clock(), "task-state", name, "execute");
void TRACE_msg_task_execute_end (m_task_t task)
{
+ char name[200];
if (!IS_TRACING || !IS_TRACED(task)) return;
- char name[200];
TRACE_task_container (task, name, 200);
if (IS_TRACING_TASKS) pajePopState (MSG_get_clock(), "task-state", name);
/* MSG_task_destroy related functions */
void TRACE_msg_task_destroy (m_task_t task)
{
+ char name[200];
if (!IS_TRACING || !IS_TRACED(task)) return;
- char name[200];
TRACE_task_container (task, name, 200);
if (IS_TRACING_TASKS) pajeDestroyContainer (MSG_get_clock(), "task", name);
void TRACE_msg_task_get_end (double start_time, m_task_t task)
{
+ char name[200];
if (!IS_TRACING || !IS_TRACED(task)) return;
- char name[200];
TRACE_task_container (task, name, 200);
if (IS_TRACING_TASKS) pajePopState (MSG_get_clock(), "task-state", name);
/* MSG_task_put related functions */
int TRACE_msg_task_put_start (m_task_t task)
{
+ char name[200];
if (!IS_TRACING || !IS_TRACED(task)) return 0;
- char name[200];
TRACE_task_container (task, name, 200);
if (IS_TRACING_TASKS) pajePopState (MSG_get_clock(), "task-state", name);
if (IS_TRACING_TASKS) pajePushState (MSG_get_clock(), "task-state", name, "communicate");
void __TRACE_msg_volume_start (m_task_t task)
{
+ m_process_t process = NULL;
+ m_host_t host = NULL;
+ char process_name[200], process_alias[200];
+ char task_name[200];
+ double volume = 0;
if (!IS_TRACING_VOLUME) return;
/* check if task is traced */
if (!IS_TRACED(task)) return;
/* check if process is traced */
- m_process_t process = MSG_process_self ();
+ process = MSG_process_self ();
if (!IS_TRACED(process)) return;
- char process_name[200], process_alias[200];
- m_host_t host = MSG_process_get_host (process);
+ host = MSG_process_get_host (process);
TRACE_process_container (process, process_name, 200);
TRACE_process_alias_container (process, host, process_alias, 200);
- char task_name[200];
TRACE_task_container (task, task_name, 200);
- double volume = MSG_task_get_data_size (task);
+ volume = MSG_task_get_data_size (task);
pajeStartLinkWithVolume (MSG_get_clock(), "volume", "0", task->category, process_alias, task_name, volume);
}
void __TRACE_msg_volume_finish (m_task_t task)
{
+ char process_name[200], process_alias[200];
+ char task_name[200];
+ m_process_t process = NULL;
+ m_host_t host = NULL;
if (!IS_TRACING_VOLUME) return;
/* check if task is traced */
if (!IS_TRACED(task)) return;
/* check if process is traced */
- m_process_t process = MSG_process_self ();
+ process = MSG_process_self ();
if (!IS_TRACED(process)) return;
- char process_name[200], process_alias[200];
- m_host_t host = MSG_process_get_host (process);
+ host = MSG_process_get_host (process);
TRACE_process_container (process, process_name, 200);
TRACE_process_alias_container (process, host, process_alias, 200);
- char task_name[200];
TRACE_task_container (task, task_name, 200);
pajeEndLink (MSG_get_clock(), "volume", "0", task->category, process_alias, task_name);
void TRACE_smx_action_execute (smx_action_t act)
{
+ char *category = NULL;
if (!IS_TRACING) return;
act->counter = counter++;
- char *category = __TRACE_current_category_get (SIMIX_process_self());
+ category = __TRACE_current_category_get (SIMIX_process_self());
if (category){
act->category = xbt_new (char, strlen (category)+1);
strncpy (act->category, category, strlen(category)+1);
void TRACE_smx_action_communicate (smx_action_t act, smx_process_t proc)
{
+ char *category = NULL;
if (!IS_TRACING) return;
act->counter = counter++;
- char *category = __TRACE_current_category_get (proc);
+ category = __TRACE_current_category_get (proc);
if (category){
act->category = xbt_strdup (category);
}
static char *strsplit (char *input, int field, char del) //caller should free the returned string
{
+ char *ret = NULL;
int length = strlen(input), i;
int s = 0, e = length+1;
int current_field = 0;
}
}
//copy string from s to e (with length equal to e-s) and return
- char *ret = malloc ((e-s+2)*sizeof(char));
+ ret = malloc ((e-s+2)*sizeof(char));
strncpy (ret, input+s, e-s+1);
ret[e-s+1] = '\0';
return ret;
void __TRACE_surf_finalize (void)
{
+ xbt_dict_cursor_t cursor = NULL;
+ unsigned int cursor_ar = 0;
+ char *key, *value, *res;
+ char *resource;
+ char *aux = NULL;
+ char *var_cpy = NULL;
+ xbt_dynar_t resources = NULL;
if (!IS_TRACING_PLATFORM) return;
if (!xbt_dict_length(last_platform_variables)){
return;
}else{
- xbt_dict_cursor_t cursor = NULL;
- unsigned int cursor_ar = 0;
- char *key, *value, *res;
- char *resource;
-
/* get all resources from last_platform_variables */
- xbt_dynar_t resources = xbt_dynar_new(sizeof(char*), xbt_free);
+ resources = xbt_dynar_new(sizeof(char*), xbt_free);
xbt_dict_foreach(last_platform_variables, cursor, key, value) {
res = strsplit (key, 0, VARIABLE_SEPARATOR);
- char *aux = strsplit (key, 1, VARIABLE_SEPARATOR);
+ aux = strsplit (key, 1, VARIABLE_SEPARATOR);
if (strcmp (aux, "Time") == 0){ //only need to add one of three
- char *var_cpy = xbt_strdup (res);
+ var_cpy = xbt_strdup (res);
xbt_dynar_push (resources, &var_cpy);
}
free (aux);
/* iterate through resources array */
xbt_dynar_foreach (resources, cursor_ar, resource) {
char timekey[100], valuekey[100], variablekey[100];
+ char *time = NULL;
+ char *value = NULL;
+ char *variable = NULL;
snprintf (timekey, 100, "%s%cTime", resource, VARIABLE_SEPARATOR);
snprintf (valuekey, 100, "%s%cValue", resource, VARIABLE_SEPARATOR);
snprintf (variablekey, 100, "%s%cVariable", resource, VARIABLE_SEPARATOR);
- char *time = xbt_dict_get_or_null (last_platform_variables, timekey);
+ time = xbt_dict_get_or_null (last_platform_variables, timekey);
if (!time) continue;
- char *value = xbt_dict_get (last_platform_variables, valuekey);
- char *variable = xbt_dict_get (last_platform_variables, variablekey);
+ value = xbt_dict_get (last_platform_variables, valuekey);
+ variable = xbt_dict_get (last_platform_variables, variablekey);
pajeSubVariable (atof(time), variable, resource, value);
xbt_dict_remove (last_platform_variables, timekey);
void __TRACE_surf_update_action_state_resource (double now, double delta, const char *variable, const char *resource, double value)
{
+ char valuestr[100];
+ char nowstr[100], nowdeltastr[100];
+ char timekey[100], valuekey[100], variablekey[100];
+ char *lastvariable = NULL;
+ char *lasttime = NULL;
+ char *lastvalue = NULL;
+ char *nowdeltastr_cpy = NULL;
+ char *valuestr_cpy = NULL;
+ char *variable_cpy = NULL;
+
if (!IS_TRACING_PLATFORM) return;
- char valuestr[100];
snprintf (valuestr, 100, "%f", value);
/*
* variables. It should be re-checked before put in production.
*/
- char nowstr[100], nowdeltastr[100];
snprintf (nowstr, 100, "%.15f", now);
snprintf (nowdeltastr, 100, "%.15f", now+delta);
- char timekey[100], valuekey[100], variablekey[100];
snprintf (timekey, 100, "%s%cTime", resource, VARIABLE_SEPARATOR);
snprintf (valuekey, 100, "%s%cValue", resource, VARIABLE_SEPARATOR);
snprintf (variablekey, 100, "%s%cVariable", resource, VARIABLE_SEPARATOR);
- char *lastvariable = xbt_dict_get_or_null (last_platform_variables, variablekey);
+ lastvariable = xbt_dict_get_or_null (last_platform_variables, variablekey);
if (lastvariable == NULL){
__TRACE_surf_check_variable_set_to_zero (now, variable, resource);
pajeAddVariable (now, variable, resource, valuestr);
- char *nowdeltastr_cpy = xbt_strdup (nowdeltastr);
- char *valuestr_cpy = xbt_strdup (valuestr);
- char *variable_cpy = xbt_strdup (variable);
+ nowdeltastr_cpy = xbt_strdup (nowdeltastr);
+ valuestr_cpy = xbt_strdup (valuestr);
+ variable_cpy = xbt_strdup (variable);
xbt_dict_set (last_platform_variables, timekey, nowdeltastr_cpy, xbt_free);
xbt_dict_set (last_platform_variables, valuekey, valuestr_cpy, xbt_free);
xbt_dict_set (last_platform_variables, variablekey, variable_cpy, xbt_free);
}else{
- char *lasttime = xbt_dict_get_or_null (last_platform_variables, timekey);
- char *lastvalue = xbt_dict_get_or_null (last_platform_variables, valuekey);
+ lasttime = xbt_dict_get_or_null (last_platform_variables, timekey);
+ lastvalue = xbt_dict_get_or_null (last_platform_variables, valuekey);
/* check if it is the same variable */
if (strcmp(lastvariable, variable) == 0){ /* same variable */
/* value has changed, subtract previous value, add new one */
pajeSubVariable (atof(lasttime), variable, resource, lastvalue);
pajeAddVariable (atof(nowstr), variable, resource, valuestr);
- char *nowdeltastr_cpy = xbt_strdup (nowdeltastr);
- char *valuestr_cpy = xbt_strdup (valuestr);
+ nowdeltastr_cpy = xbt_strdup (nowdeltastr);
+ valuestr_cpy = xbt_strdup (valuestr);
xbt_dict_set (last_platform_variables, timekey, nowdeltastr_cpy, xbt_free);
xbt_dict_set (last_platform_variables, valuekey, valuestr_cpy, xbt_free);
}
/* the last time is different from new starting time, subtract to lasttime and add from nowstr */
pajeSubVariable (atof(lasttime), variable, resource, lastvalue);
pajeAddVariable (atof(nowstr), variable, resource, valuestr);
- char *nowdeltastr_cpy = xbt_strdup (nowdeltastr);
- char *valuestr_cpy = xbt_strdup (valuestr);
+ nowdeltastr_cpy = xbt_strdup (nowdeltastr);
+ valuestr_cpy = xbt_strdup (valuestr);
xbt_dict_set (last_platform_variables, timekey, nowdeltastr_cpy, xbt_free);
xbt_dict_set (last_platform_variables, valuekey, valuestr_cpy, xbt_free);
}
pajeSubVariable (atof(lasttime), lastvariable, resource, lastvalue);
__TRACE_surf_check_variable_set_to_zero (now, variable, resource);
pajeAddVariable (now, variable, resource, valuestr);
- char *nowdeltastr_cpy = xbt_strdup (nowdeltastr);
- char *valuestr_cpy = xbt_strdup (valuestr);
- char *variable_cpy = xbt_strdup (variable);
+ nowdeltastr_cpy = xbt_strdup (nowdeltastr);
+ valuestr_cpy = xbt_strdup (valuestr);
+ variable_cpy = xbt_strdup (variable);
xbt_dict_set (last_platform_variables, timekey, nowdeltastr_cpy, xbt_free);
xbt_dict_set (last_platform_variables, valuekey, valuestr_cpy, xbt_free);
xbt_dict_set (last_platform_variables, variablekey, variable_cpy, xbt_free);
void __TRACE_surf_set_resource_variable (double date, const char *variable, const char *resource, double value)
{
+ char aux[100], key[100];
+ char *last_value = NULL;
if (!IS_TRACING) return;
- char aux[100], key[100];
snprintf (aux, 100, "%f", value);
snprintf (key, 100, "%s%c%s", resource, VARIABLE_SEPARATOR, variable);
- char *last_value = xbt_dict_get_or_null(resource_variables, key);
+ last_value = xbt_dict_get_or_null(resource_variables, key);
if (last_value){
if (atof(last_value) == value){
return;
void TRACE_surf_link_set_utilization (const char *name, smx_action_t smx_action, double value, double now, double delta)
{
+ char type[100];
if (!IS_TRACING || !IS_TRACED(smx_action)) return;
if (strcmp (name, "__loopback__")==0 ||
return;
}
- char type[100];
snprintf (type, 100, "b%s", smx_action->category);
__TRACE_surf_update_action_state_resource (now, delta, type, name, value);
return;
void TRACE_surf_host_set_utilization (const char *name, smx_action_t smx_action, double value, double now, double delta)
{
+ char type[100];
if (!IS_TRACING || !IS_TRACED(smx_action)) return;
if (value==0){
return;
}
- char type[100];
snprintf (type, 100, "p%s", smx_action->category);
__TRACE_surf_update_action_state_resource (now, delta, type, name, value);
return;
void TRACE_surf_link_declaration (char *name, double bw, double lat)
{
+ double *bw_ptr, *lat_ptr;
if (!IS_TRACING) return;
//if (IS_TRACING_PLATFORM) pajeCreateContainerWithBandwidthLatency (SIMIX_get_clock(), name, "LINK", "platform", name, bw, lat);
//save bw and lat information for this link
- double *bw_ptr, *lat_ptr;
bw_ptr = xbt_new (double, 1);
lat_ptr = xbt_new (double, 1);
*bw_ptr = bw;
void TRACE_surf_link_save_endpoints (char *link_name, int src, int dst)
{
+ char srcidstr[100], dstidstr[100];
+ char key[100];
+ char *srcname = NULL;
+ char *dstname = NULL;
+ double *bw = 0;
+ double *lat = 0;
if (!IS_TRACING) return;
- char srcidstr[100], dstidstr[100];
snprintf (srcidstr, 100, "%d", src);
snprintf (dstidstr, 100, "%d", dst);
- char *srcname = xbt_dict_get (hosts_id, srcidstr);
- char *dstname = xbt_dict_get (hosts_id, dstidstr);
-
- char key[100];
+ srcname = xbt_dict_get (hosts_id, srcidstr);
+ dstname = xbt_dict_get (hosts_id, dstidstr);
snprintf (key, 100, "l%d-%d", src, dst);
if (strcmp (link_name, "__loopback__")==0 ||
if (!xbt_dict_get_or_null (created_links, link_name)){
//if (IS_TRACING_PLATFORM) pajeStartLink (SIMIX_get_clock(), "edge", "platform", "route", srcname, key);
//if (IS_TRACING_PLATFORM) pajeEndLink (SIMIX_get_clock()+0.1, "edge", "platform", "route", dstname, key);
- double *bw = xbt_dict_get (link_bandwidth, link_name);
- double *lat = xbt_dict_get (link_latency, link_name);
+ bw = xbt_dict_get (link_bandwidth, link_name);
+ lat = xbt_dict_get (link_latency, link_name);
pajeCreateContainerWithBandwidthLatencySrcDst (SIMIX_get_clock(), link_name, "LINK", "platform", link_name, *bw, *lat, srcname, dstname);
if (IS_TRACING_PLATFORM) __TRACE_surf_set_resource_variable (SIMIX_get_clock(), "bandwidth", link_name, *bw);
if (IS_TRACING_PLATFORM) __TRACE_surf_set_resource_variable (SIMIX_get_clock(), "latency", link_name, *lat);
void TRACE_surf_host_define_id (const char *name, int host_id)
{
+ char strid[100];
if (!IS_TRACING) return;
- char strid[100];
snprintf (strid, 100, "%d", host_id);
xbt_dict_set (hosts_id, name, strdup(strid), free);
xbt_dict_set (hosts_id, strid, strdup(name), free);
/* to trace gtnets */
void TRACE_surf_gtnets_communicate (void *action, int src, int dst)
{
+ char key[100], aux[100];
if (!IS_TRACING) return;
- char key[100], aux[100];
snprintf (key, 100, "%p", action);
snprintf (aux, 100, "%d", src);
int TRACE_surf_gtnets_get_src (void *action)
{
+ char key[100];
+ char *aux = NULL;
if (!IS_TRACING) return -1;
- char key[100];
snprintf (key, 100, "%p", action);
- char *aux = xbt_dict_get_or_null (gtnets_src, key);
+ aux = xbt_dict_get_or_null (gtnets_src, key);
if (aux){
return atoi(aux);
}else{
int TRACE_surf_gtnets_get_dst (void *action)
{
+ char key[100];
+ char *aux = NULL;
if (!IS_TRACING) return -1;
- char key[100];
snprintf (key, 100, "%p", action);
- char *aux = xbt_dict_get_or_null (gtnets_dst, key);
+ aux = xbt_dict_get_or_null (gtnets_dst, key);
if (aux){
return atoi(aux);
}else{
void TRACE_surf_gtnets_destroy (void *action)
{
- if (!IS_TRACING) return;
char key[100];
+ if (!IS_TRACING) return;
snprintf (key, 100, "%p", action);
xbt_dict_remove (gtnets_src, key);
xbt_dict_remove (gtnets_dst, key);
void TRACE_msg_clean (void)
{
- __TRACE_surf_finalize();
-
- xbt_dict_cursor_t cursor = NULL;
char *key, *value;
+ xbt_dict_cursor_t cursor = NULL;
+ __TRACE_surf_finalize();
/* get all host from host_containers */
xbt_dict_foreach(host_containers, cursor, key, value) {
void TRACE_surf_host_vivaldi_parse (char *host, double x, double y, double h)
{
+ char valuestr[100];
if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
- char valuestr[100];
snprintf (valuestr, 100, "%g", x);
pajeSetVariable (0, "vivaldi_x", host, valuestr);
snprintf (valuestr, 100, "%g", y);
void __TRACE_link_variable (double time, const char *src, const char *dst, const char *variable, double value, const char *what)
{
+ char valuestr[100];
+ int src_id, dst_id;
+ xbt_dynar_t route = NULL;
+ unsigned int i;
+ void *link_ptr;
+ char *link = NULL;
if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
- char valuestr[100];
snprintf (valuestr, 100, "%g", value);
if (strcmp (what, "declare") == 0){
if (!used_routing) return;
- int src_id, dst_id;
src_id = *(int*)xbt_dict_get(used_routing->host_id,src);
dst_id = *(int*)xbt_dict_get(used_routing->host_id,dst);
- xbt_dynar_t route = used_routing->get_route(src_id, dst_id);
+ route = used_routing->get_route(src_id, dst_id);
- unsigned int i;
- void *link_ptr;
xbt_dynar_foreach(route, i, link_ptr) {
- char *link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
+ link = (*(link_CM02_t)link_ptr).lmm_resource.generic_resource.name;
if (strcmp (what, "set") == 0){
pajeSetVariable (time, variable, link, valuestr);
void __TRACE_host_variable (double time, const char *variable, double value, const char *what)
{
+ char valuestr[100];
if (!IS_TRACING || !IS_TRACING_PLATFORM) return;
- char valuestr[100];
snprintf (valuestr, 100, "%g", value);
if (strcmp (what, "declare") == 0){
xbt_ex_t e;
MSG_error_t ret = MSG_OK;
smx_comm_t comm;
-
+#ifdef HAVE_TRACING
+ double start_time = 0;
+#endif
/* We no longer support getting a task from a specific host */
if (host) THROW_UNIMPLEMENTED;
CHECK_HOST();
#ifdef HAVE_TRACING
TRACE_msg_task_get_start ();
- double start_time = MSG_get_clock();
+ start_time = MSG_get_clock();
#endif
memset(&comm,0,sizeof(comm));
MSG_error_t ret = MSG_OK;
simdata_task_t t_simdata = NULL;
m_process_t process = MSG_process_self();
-
+#ifdef HAVE_TRACING
+ int call_end = 0;
+#endif
CHECK_HOST();
#ifdef HAVE_TRACING
- int call_end = TRACE_msg_task_put_start (task); //must be after CHECK_HOST()
+ call_end = TRACE_msg_task_put_start (task); //must be after CHECK_HOST()
#endif
tmgr_trace_t state_trace,
xbt_dict_t cpu_properties)
{
-#ifdef HAVE_TRACING
+ cpu_Cas01_im_t cpu = NULL;
+ s_surf_action_cpu_Cas01_im_t action;
+ cpu = xbt_new0(s_cpu_Cas01_im_t, 1);
+
+ #ifdef HAVE_TRACING
TRACE_surf_host_declaration (name, power_scale * power_peak);
-#endif
+ #endif
- cpu_Cas01_im_t cpu = xbt_new0(s_cpu_Cas01_im_t, 1);
- s_surf_action_cpu_Cas01_im_t action;
xbt_assert1(!surf_model_resource_by_name(surf_cpu_model, name),
"Host '%s' declared several times in the platform file", name);
cpu->generic_resource.model = surf_cpu_model;