Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small change to calls to SIMIX_action_communicate and SIMIX_action_execute
[simgrid.git] / src / smpi / smpi_bench.c
1 #include "private.h"
2
3 // FIXME: could cause trouble with multithreaded procs on same host...
4 // FIXME: add benchmarking flag?
5
6 void smpi_bench_begin()
7 {
8         SIMIX_mutex_lock(smpi_global->timer_mutex);
9         xbt_os_timer_start(smpi_global->timer);
10         return;
11 }
12
13 void smpi_bench_end()
14 {
15         double duration;
16         smx_host_t host;
17         smx_action_t action;
18
19         xbt_os_timer_stop(smpi_global->timer);
20         duration = xbt_os_timer_elapsed(smpi_global->timer);
21         host     = SIMIX_host_self();
22         action   = SIMIX_action_execute(host, "computation", duration * SMPI_DEFAULT_SPEED);
23
24         SIMIX_register_action_to_condition(action, smpi_global->timer_cond);
25         SIMIX_cond_wait(smpi_global->timer_cond, smpi_global->timer_mutex);
26         SIMIX_unregister_action_to_condition(action, smpi_global->timer_cond);
27
28         SIMIX_mutex_unlock(smpi_global->timer_mutex);
29
30         return;
31 }