3 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_util, smpi,
4 "Logging specific to SMPI (utilities)");
6 int smpi_gettimeofday(struct timeval *tv, struct timezone *tz)
15 now = SIMIX_get_clock();
17 tv->tv_usec = ((now - (double) tv->tv_sec) * 1000000.0);
23 unsigned int smpi_sleep(unsigned int seconds)
29 e_surf_action_state_t state;
33 host = SIMIX_host_self();
34 mutex = smpi_process_mutex();
35 cond = smpi_process_cond();
37 SIMIX_mutex_lock(mutex);
39 // FIXME: explicit conversion to double?
40 action = SIMIX_action_sleep(host, seconds);
42 SIMIX_register_action_to_condition(action, cond);
43 for (state = SIMIX_action_get_state(action);
44 state == SURF_ACTION_READY ||
45 state == SURF_ACTION_RUNNING; state = SIMIX_action_get_state(action)
47 SIMIX_cond_wait(cond, mutex);
49 SIMIX_unregister_action_to_condition(action, cond);
50 SIMIX_action_destroy(action);
52 SIMIX_mutex_unlock(mutex);
58 void smpi_exit(int status)
61 smpi_process_finalize();
62 SIMIX_process_kill(SIMIX_process_self());