3 void smpi_execute(double duration) {
4 smx_host_t host = SIMIX_host_self();
7 SIMIX_mutex_lock(smpi_global->execute_mutex);
9 action = SIMIX_action_execute(host, "computation", duration * SMPI_DEFAULT_SPEED);
11 SIMIX_register_action_to_condition(action, smpi_global->execute_cond);
12 SIMIX_cond_wait(smpi_global->execute_cond, smpi_global->execute_mutex);
13 SIMIX_unregister_action_to_condition(action, smpi_global->execute_cond);
14 SIMIX_action_destroy(action);
16 SIMIX_mutex_unlock(smpi_global->execute_mutex);
21 void smpi_bench_begin()
23 SIMIX_mutex_lock(smpi_global->timer_mutex);
24 xbt_os_timer_start(smpi_global->timer);
28 double smpi_bench_end()
32 xbt_os_timer_stop(smpi_global->timer);
34 duration = xbt_os_timer_elapsed(smpi_global->timer);
36 SIMIX_mutex_unlock(smpi_global->timer_mutex);
38 smpi_execute(duration);
44 void smpi_bench_skip() {
45 double duration = smpi_global->times[0];
46 smpi_execute(duration);
50 void smpi_do_once_1() {
52 SIMIX_mutex_lock(smpi_global->times_mutex);
53 if (0 < smpi_global->times[0]) {
59 int smpi_do_once_2() {
61 if (0 < smpi_global->times[0]) {
62 SIMIX_mutex_unlock(smpi_global->times_mutex);
69 void smpi_do_once_3() {
70 smpi_global->times[0] = smpi_bench_end();