3 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_util, smpi, "Logging specific to SMPI (utilities)");
5 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz)
14 now = SIMIX_get_clock();
16 tv->tv_usec = ((now - (double)tv->tv_sec) * 1000000.0);
22 unsigned int smpi_sleep(unsigned int seconds)
28 e_surf_action_state_t state;
32 host = SIMIX_host_self();
33 mutex = smpi_host_mutex();
34 cond = smpi_host_cond();
36 SIMIX_mutex_lock(mutex);
38 // FIXME: explicit conversion to double?
39 action = SIMIX_action_sleep(host, seconds);
41 SIMIX_register_action_to_condition(action, cond);
43 state = SIMIX_action_get_state(action);
44 state == SURF_ACTION_READY ||
45 state == SURF_ACTION_RUNNING;
46 state = SIMIX_action_get_state(action)
48 SIMIX_cond_wait(cond, mutex);
50 SIMIX_unregister_action_to_condition(action, cond);
51 SIMIX_action_destroy(action);
53 SIMIX_mutex_unlock(mutex);
59 void smpi_exit(int status)
63 SIMIX_process_kill(SIMIX_process_self());