/* * Instrumentation functions to trace MSG processes (msg_process_t) */ void TRACE_msg_process_change_host(msg_process_t process, msg_host_t old_host, msg_host_t new_host) { if (TRACE_msg_process_is_enabled()){ static long long int counter = 0; if(MC_is_active()) MC_ignore_data_bss(&counter, sizeof(counter)); char key[INSTR_DEFAULT_STR_SIZE]; snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++); int len = INSTR_DEFAULT_STR_SIZE; char str[INSTR_DEFAULT_STR_SIZE]; //start link container_t msg = PJ_container_get (instr_process_id(process, str, len)); type_t type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root()); new_pajeStartLink (MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); //destroy existing container of this process TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process), old_host); //create new container on the new_host location TRACE_msg_process_create (MSG_process_get_name (process), MSG_process_get_PID (process), new_host); //end link msg = PJ_container_get(instr_process_id(process, str, len)); type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root()); new_pajeEndLink (MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); } }
/* MSG_task_create related function*/ void TRACE_msg_task_create(msg_task_t task) { static long long counter = 0; task->counter = counter++; task->category = NULL; if(MC_is_active()){ MC_ignore_data_bss(&counter, sizeof(counter)); MC_ignore_heap(&(task->counter), sizeof(task->counter)); } XBT_DEBUG("CREATE %p, %lld", task, task->counter); }
static char *TRACE_smpi_put_key(int src, int dst, char *key, int n) { //get the dynar for src#dst char aux[INSTR_DEFAULT_STR_SIZE]; snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst); xbt_dynar_t d = xbt_dict_get_or_null(keys, aux); if (d == NULL) { d = xbt_dynar_new(sizeof(char *), &xbt_free_ref); xbt_dict_set(keys, aux, d, NULL); } //generate the key static unsigned long long counter = 0; if(MC_is_active()) MC_ignore_data_bss(&counter, sizeof(counter)); snprintf(key, n, "%d_%d_%llu", src, dst, counter++); //push it char *a = (char*)xbt_strdup(key); xbt_dynar_push_as(d, char *, a); return key; }