#include "mc/mc.h"
#include "xbt/dict.h"
-/* Pimple to get an histogram of message sizes in the simulation */
-xbt_dict_t msg_sizes = NULL;
-#ifdef HAVE_LATENCY_BOUND_TRACKING
-xbt_dict_t latency_limited_dict = NULL;
-#endif
-
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix,
"Logging specific to SIMIX (network)");
VERB2("Destroy communication %p; refcount initially %d", comm,
comm->refcount);
- if(!(comm->refcount>0)) {
- INFO1("There is no more reference to this comm (%p). Cannot destroy!",comm);
- xbt_die("Argh.!");
- }
+ if(!(comm->refcount>0))
+ xbt_die(bprintf("the refcount of comm %p is already 0 before decreasing it. That's a bug!",comm));
#ifdef HAVE_LATENCY_BOUND_TRACKING
//save is latency limited flag to use afterwards
- if (latency_limited_dict == NULL) {
- latency_limited_dict = xbt_dict_new();
- }
if (comm->act) {
DEBUG2("adding key %p with latency limited value %d to the dict", comm,
SIMIX_action_is_latency_bounded(comm->act));
- xbt_dicti_set(latency_limited_dict, (uintptr_t) comm,
+ xbt_dicti_set(simix_global->latency_limited_dict, (uintptr_t) comm,
SIMIX_action_is_latency_bounded(comm->act));
}
#endif
uintptr_t key = 0;
uintptr_t data = 0;
xbt_dict_cursor_t cursor;
- xbt_dict_foreach(latency_limited_dict, cursor, key, data) {
+ xbt_dict_foreach(simix_global->latency_limited_dict, cursor, key, data) {
DEBUG2("comparing key=%p with comm=%p", (void *) key, (void *) comm);
if ((void *) comm == (void *) key) {
DEBUG2("key %p found, return value latency limited value %d",
/* pimple to display the message sizes */
{
- if (msg_sizes == NULL)
- msg_sizes = xbt_dict_new();
casted_size = comm->task_size;
- amount = xbt_dicti_get(msg_sizes, casted_size);
+ amount = xbt_dicti_get(simix_global->msg_sizes, casted_size);
amount++;
- xbt_dicti_set(msg_sizes, casted_size, amount);
- }
-}
-
-#include "xbt.h"
-/* pimple to display the message sizes */
-void SIMIX_message_sizes_output(const char *filename)
-{
- uintptr_t key = 0;
- uintptr_t data = 0;
- xbt_dict_cursor_t cursor;
- FILE *out = NULL;
- out = fopen(filename, "w");
- xbt_assert1(out, "Cannot open file %s", filename);
-
- xbt_dict_foreach(msg_sizes, cursor, key, data) {
- fprintf(out, "%zu %zu\n", key, data);
+ xbt_dicti_set(simix_global->msg_sizes, casted_size, amount);
}
- fclose(out);
}
/**