-static void __TRACE_B_end(smx_action_t action)
-{
-}
-
-#define C_METHOD
-//C
-static void __TRACE_C_alloc(void)
-{
- method_c_dict = xbt_dict_new();
-}
-
-static void __TRACE_C_release(void)
-{
- xbt_dict_free(&method_c_dict);
-}
-
-static void __TRACE_C_start(smx_action_t action)
-{
- char key[100];
- snprintf(key, 100, "%p", action);
-
- //check if exists
- if (xbt_dict_get_or_null(method_c_dict, key)) {
- xbt_dict_remove(method_c_dict, key); //should never execute here, but it does
- }
- xbt_dict_set(method_c_dict, key, xbt_dict_new(), xbt_free);
-}
-
-static void __TRACE_C_event(smx_action_t action, double now, double delta,
- const char *variable, const char *resource,
- double value)
-{
- char key[100];
- snprintf(key, 100, "%p", action);
-
- xbt_dict_t action_dict = xbt_dict_get(method_c_dict, key);
- //setting start time
- if (!xbt_dict_get_or_null(action_dict, "start")) {
- char start_time[100];
- snprintf(start_time, 100, "%f", now);
- xbt_dict_set(action_dict, "start", xbt_strdup(start_time), xbt_free);
- }
- //updating end time
- char end_time[100];
- snprintf(end_time, 100, "%f", now + delta);
- xbt_dict_set(action_dict, "end", xbt_strdup(end_time), xbt_free);
-
- //accumulate the value resource-variable
- char res_var[300];
- snprintf(res_var, 300, "%s %s", resource, variable);
- double current_value_f;
- char *current_value = xbt_dict_get_or_null(action_dict, res_var);
- if (current_value) {
- current_value_f = atof(current_value);
- current_value_f += value * delta;
- } else {
- current_value_f = value * delta;
- }
- char new_current_value[100];
- snprintf(new_current_value, 100, "%f", current_value_f);
- xbt_dict_set(action_dict, res_var, xbt_strdup(new_current_value),
- xbt_free);
-}
-
-static void __TRACE_C_end(smx_action_t action)
-{
- char key[100];
- snprintf(key, 100, "%p", action);
-
- xbt_dict_t action_dict = xbt_dict_get(method_c_dict, key);
- double start_time = atof(xbt_dict_get(action_dict, "start"));
- double end_time = atof(xbt_dict_get(action_dict, "end"));
-
- xbt_dict_cursor_t cursor = NULL;
- char *action_dict_key, *action_dict_value;
- xbt_dict_foreach(action_dict, cursor, action_dict_key, action_dict_value) {
- char resource[100], variable[100];
- if (sscanf(action_dict_key, "%s %s", resource, variable) != 2)
- continue;
- __TRACE_surf_check_variable_set_to_zero(start_time, variable,
- resource);
- char value_str[100];
- if (end_time - start_time != 0) {
- snprintf(value_str, 100, "%f",
- atof(action_dict_value) / (end_time - start_time));
- pajeAddVariable(start_time, variable, resource, value_str);
- pajeSubVariable(end_time, variable, resource, value_str);
- }
- }
- xbt_dict_remove(method_c_dict, key);
-}
-
-#define RESOURCE_UTILIZATION_INTERFACE