- /* check if we have to set it to 0 */
- if (!xbt_dict_get_or_null(platform_variables, resource)) {
- xbt_dynar_t array = xbt_dynar_new(sizeof(char *), xbt_free);
- char *var_cpy = xbt_strdup(variable);
- xbt_dynar_push(array, &var_cpy);
- container_t container = getContainerByName (resource);
- type_t type = getVariableType (variable, NULL, container->type);
+ /*
+ * To trace resource utilization, we use pajeAddVariable and pajeSubVariable only.
+ * The Paje simulator needs a pajeSetVariable in the first place so it knows
+ * the initial value of all variables for subsequent adds/subs. If we don't do
+ * so, the first pajeAddVariable is added to a non-determined value within
+ * the Paje simulator, causing analysis problems.
+ */
+
+ // create a key considering the resource and variable
+ int n = strlen(variable)+strlen(resource)+1;
+ char *key = (char*)xbt_malloc(n*sizeof(char));
+ snprintf (key, n, "%s%s", resource, variable);
+
+ // check if key exists: if it doesn't, set the variable to zero and mark this in the dict
+ if (!xbt_dict_get_or_null(platform_variables, key)) {
+ container_t container = PJ_container_get (resource);
+ type_t type = PJ_type_get (variable, container->type);