- 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;
-
- /*
- * The following code replaces the code above with the objective
- * to decrease the size of file because of unnecessary add/sub on
- * variables. It should be re-checked before put in production.
- */
-
- snprintf (valuestr, 100, "%f", value);
- snprintf (nowstr, 100, "%f", now);
- snprintf (nowdeltastr, 100, "%f", now+delta);
- snprintf (timekey, 100, "%s%cTime", resource, VARIABLE_SEPARATOR);
- snprintf (valuekey, 100, "%s%cValue", resource, VARIABLE_SEPARATOR);
- snprintf (variablekey, 100, "%s%cVariable", resource, VARIABLE_SEPARATOR);
-
- lastvariable = xbt_dict_get_or_null (method_b_dict, variablekey);
- if (lastvariable == NULL){
- __TRACE_surf_check_variable_set_to_zero (now, variable, resource);
- pajeAddVariable (now, variable, resource, valuestr);
- nowdeltastr_cpy = xbt_strdup (nowdeltastr);
- valuestr_cpy = xbt_strdup (valuestr);
- variable_cpy = xbt_strdup (variable);
- xbt_dict_set (method_b_dict, timekey, nowdeltastr_cpy, xbt_free);
- xbt_dict_set (method_b_dict, valuekey, valuestr_cpy, xbt_free);
- xbt_dict_set (method_b_dict, variablekey, variable_cpy, xbt_free);
+ char key_time[INSTR_DEFAULT_STR_SIZE];
+ char key_value[INSTR_DEFAULT_STR_SIZE];
+ char nowstr[INSTR_DEFAULT_STR_SIZE];
+ char valuestr[INSTR_DEFAULT_STR_SIZE];
+ char nowdeltastr[INSTR_DEFAULT_STR_SIZE];
+
+ snprintf (key_time, INSTR_DEFAULT_STR_SIZE, "%s %s time", resource, variable);
+ snprintf (key_value, INSTR_DEFAULT_STR_SIZE, "%s %s value", resource, variable);
+ snprintf (nowstr, INSTR_DEFAULT_STR_SIZE, "%f", now);
+ snprintf (valuestr, INSTR_DEFAULT_STR_SIZE, "%f", value);
+ snprintf (nowdeltastr, INSTR_DEFAULT_STR_SIZE, "%f", now+delta);
+
+ char *lasttimestr = xbt_dict_get_or_null(method_b_dict, key_time);
+ char *lastvaluestr = xbt_dict_get_or_null(method_b_dict, key_value);
+ if (lasttimestr == NULL){
+ __TRACE_surf_check_variable_set_to_zero(now, variable, resource);
+ pajeAddVariable(now, variable, resource, valuestr);
+ xbt_dict_set(method_b_dict, key_time, xbt_strdup(nowdeltastr), xbt_free);
+ xbt_dict_set(method_b_dict, key_value, xbt_strdup(valuestr), xbt_free);