From: cristianrosa Date: Thu, 27 Jan 2011 13:59:24 +0000 (+0000) Subject: Add extra argument "priority" to SIMIX_req_host_execute. X-Git-Tag: v3.6_beta2~411 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5d0e92347e2ff135459af73e2dc199a3d33f684f Add extra argument "priority" to SIMIX_req_host_execute. This avoids a second request to set it right afterwards. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9518 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/include/simix/simix.h b/include/simix/simix.h index d73f296c29..a64306cd7d 100644 --- a/include/simix/simix.h +++ b/include/simix/simix.h @@ -98,7 +98,8 @@ XBT_PUBLIC(void *) SIMIX_req_host_get_data(smx_host_t host); XBT_PUBLIC(void) SIMIX_req_host_set_data(smx_host_t host, void *data); XBT_PUBLIC(smx_action_t) SIMIX_req_host_execute(const char *name, smx_host_t host, - double computation_amount); + double computation_amount, + double priority); XBT_PUBLIC(smx_action_t) SIMIX_req_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, diff --git a/src/gras/Virtu/sg_emul.c b/src/gras/Virtu/sg_emul.c index 62be7c2d3f..4729c35d60 100644 --- a/src/gras/Virtu/sg_emul.c +++ b/src/gras/Virtu/sg_emul.c @@ -23,7 +23,7 @@ void gras_cpu_burn(double flops) smx_action_t execution; if (flops > 0){ - execution = SIMIX_req_host_execute("task", SIMIX_host_self(), flops); + execution = SIMIX_req_host_execute("task", SIMIX_host_self(), flops, 1); SIMIX_req_host_execution_wait(execution); } } diff --git a/src/msg/gos.c b/src/msg/gos.c index e281bf7127..75aa0841f2 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -64,8 +64,8 @@ MSG_error_t MSG_task_execute(m_task_t task) simdata->isused=1; simdata->compute = SIMIX_req_host_execute(task->name, SIMIX_host_self(), - simdata->computation_amount); - SIMIX_req_host_execution_set_priority(simdata->compute, simdata->priority); + simdata->computation_amount, + simdata->priority); #ifdef HAVE_TRACING SIMIX_req_set_category(simdata->compute, task->category); #endif diff --git a/src/simix/host_private.h b/src/simix/host_private.h index ad5332d9a3..84a315ca92 100644 --- a/src/simix/host_private.h +++ b/src/simix/host_private.h @@ -27,7 +27,7 @@ double SIMIX_host_get_speed(smx_host_t host); double SIMIX_host_get_available_speed(smx_host_t host); int SIMIX_host_get_state(smx_host_t host); smx_action_t SIMIX_host_execute(const char *name, - smx_host_t host, double computation_amount); + smx_host_t host, double computation_amount, double priority); smx_action_t SIMIX_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, double *computation_amount, double *communication_amount, diff --git a/src/simix/smurf_private.h b/src/simix/smurf_private.h index 0a0bcd8566..59fcf28c02 100644 --- a/src/simix/smurf_private.h +++ b/src/simix/smurf_private.h @@ -169,6 +169,7 @@ typedef struct s_smx_req { const char* name; smx_host_t host; double computation_amount; + double priority; smx_action_t result; } host_execute; diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 205c46b1cb..65afb4ff7c 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -178,7 +178,8 @@ void SIMIX_host_set_data(smx_host_t host, void *data) } smx_action_t SIMIX_host_execute(const char *name, smx_host_t host, - double computation_amount) + double computation_amount, + double priority) { /* alloc structures and initialize */ smx_action_t action = xbt_new0(s_smx_action_t, 1); @@ -198,6 +199,7 @@ smx_action_t SIMIX_host_execute(const char *name, smx_host_t host, surf_workstation_model->extension.workstation.execute(host->host, computation_amount); surf_workstation_model->action_data_set(action->execution.surf_exec, action); + surf_workstation_model->set_priority(action->execution.surf_exec, priority); } #ifdef HAVE_TRACING diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 7ed0ac1791..da3f652556 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -268,7 +268,8 @@ void SIMIX_request_pre(smx_req_t req, int value) req->host_execute.result = SIMIX_host_execute( req->host_execute.name, req->host_execute.host, - req->host_execute.computation_amount); + req->host_execute.computation_amount, + req->host_execute.priority); SIMIX_request_answer(req); break; diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 1b75a462a9..163a7d47f8 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -150,7 +150,8 @@ void SIMIX_req_host_set_data(smx_host_t host, void *data) * \return A new SIMIX execution action */ smx_action_t SIMIX_req_host_execute(const char *name, smx_host_t host, - double computation_amount) + double computation_amount, + double priority) { smx_req_t req = SIMIX_req_mine(); @@ -158,6 +159,7 @@ smx_action_t SIMIX_req_host_execute(const char *name, smx_host_t host, req->host_execute.name = name; req->host_execute.host = host; req->host_execute.computation_amount = computation_amount; + req->host_execute.priority = priority; SIMIX_request_push(); return req->host_execute.result; } diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index 084123b849..ae6c88c05a 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -48,7 +48,7 @@ static void smpi_execute_flops(double flops) host = SIMIX_host_self(); DEBUG1("Handle real computation time: %f flops", flops); - action = SIMIX_req_host_execute("computation", host, flops); + action = SIMIX_req_host_execute("computation", host, flops, 1); #ifdef HAVE_TRACING SIMIX_req_set_category (action, TRACE_internal_smpi_get_category()); #endif