X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f3eb95bea2b4188d46fa0cb4d652dd1d200f1e12..8cb8e7da03088da26d6f05b7ff84c412fef25a53:/src/simix/smx_smurf.c diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index aed0958996..91c67a4acf 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -1,6 +1,7 @@ #include "smx_private.h" #include "xbt/fifo.h" #include "xbt/xbt_os_thread.h" +#include "../mc/mc_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_smurf, simix, "Logging specific to SIMIX (SMURF)"); @@ -24,6 +25,7 @@ void SIMIX_simcall_push(smx_process_t self) SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { + XBT_DEBUG("I'm the maestro, execute the simcall directly"); SIMIX_simcall_pre(&self->simcall, 0); } } @@ -270,11 +272,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value) break; case SIMCALL_HOST_EXECUTE: - simcall->host_execute.result = SIMIX_host_execute( - simcall->host_execute.name, - simcall->host_execute.host, - simcall->host_execute.computation_amount, - simcall->host_execute.priority); + simcall->host_execute.result = simcall_table[simcall->call](simcall->args); SIMIX_simcall_answer(simcall); break; @@ -557,6 +555,19 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value) SIMIX_simcall_answer(simcall); break; +#ifdef HAVE_MC + case SIMCALL_MC_SNAPSHOT: + simcall->mc_snapshot.s = MC_take_snapshot(); + SIMIX_simcall_answer(simcall); + break; + + case SIMCALL_MC_COMPARE_SNAPSHOTS: + simcall->mc_compare_snapshots.result = + snapshot_compare(simcall->mc_compare_snapshots.snapshot1, simcall->mc_compare_snapshots.snapshot2, NULL, NULL); + SIMIX_simcall_answer(simcall); + break; +#endif /* HAVE_MC */ + case SIMCALL_NONE: THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s", SIMIX_process_get_name(simcall->issuer), @@ -602,7 +613,36 @@ void SIMIX_simcall_post(smx_action_t action) /* TUTORIAL: New API */ /* ****************************************************************************************** */ case SIMIX_ACTION_NEW_API: - SIMIX_post_new_model(action); + SIMIX_post_new_api(action); break; } } + +/* New Simcal interface */ + +/* FIXME: add types for every simcall */ +const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" }; + +simcall_handler_t simcall_table[NUM_SIMCALLS] = {[SIMCALL_HOST_EXECUTE] = &SIMIX_host_execute}; + +void SIMIX_simcall_typecheck(const char *fmt, ...) +{ + return; +} + +void __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args) +{ + smx_process_t self = SIMIX_process_self(); + self->simcall.call = simcall_id; + self->simcall.args = args; + + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + + SIMIX_process_yield(self); + } else { + + SIMIX_simcall_pre(&self->simcall, 0); + } +}