- smx_mutex_t mutex;
- smx_cond_t cond;
- e_surf_action_state_t state;
-
- if(duration >= xbt_cfg_get_double(_surf_cfg_set, "smpi/cpu_threshold")) {
- host = SIMIX_host_self();
- mutex = SIMIX_mutex_init();
- cond = SIMIX_cond_init();
- DEBUG1("Sleep for %f to handle real computation time", duration);
- duration *= xbt_cfg_get_double(_surf_cfg_set, "smpi/running_power");
- action = SIMIX_action_execute(host, "computation", duration);
- SIMIX_mutex_lock(mutex);
- SIMIX_register_action_to_condition(action, cond);
- for(state = SIMIX_action_get_state(action);
- state == SURF_ACTION_READY ||
- state == SURF_ACTION_RUNNING; state = SIMIX_action_get_state(action)) {
- SIMIX_cond_wait(cond, mutex);
- }
- SIMIX_unregister_action_to_condition(action, cond);
- SIMIX_mutex_unlock(mutex);
- SIMIX_action_destroy(action);
- SIMIX_cond_destroy(cond);
- SIMIX_mutex_destroy(mutex);
- }
+ smx_host_t host;
+ host = SIMIX_host_self();
+
+ XBT_DEBUG("Handle real computation time: %f flops", flops);
+ action = SIMIX_req_host_execute("computation", host, flops, 1);
+#ifdef HAVE_TRACING
+ SIMIX_req_set_category (action, TRACE_internal_smpi_get_category());
+#endif
+ SIMIX_req_host_execution_wait(action);