/* Copyright (c) 2012. The SimGrid Team.
* All rights reserved. */
-
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "bittorrent.h"
${txt_files}
PARENT_SCOPE
)
+
int master(int argc, char *argv[]);
int slave(int argc, char *argv[]);
-
/** Promoter function
* Just promote each node into a host, with fixed power
*/
#! ./tesh
+
p Tracing master/slave application
$ $SG_TEST_EXENV ${bindir:=.}/tracing/trace_platform$EXEEXT --cfg=tracing:1 --cfg=tracing/categorized:1 ${srcdir:=.}/tracing/platform.xml
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to '1'
#! ./tesh
+
p Simple test of simdag
$ $SG_TEST_EXENV ./simdag_tracing --cfg=tracing:1 --cfg=tracing/categorized:1 ${srcdir:=.}/2clusters.xml
# use the tested library, not the installed one
# (since we want to pass it to the child, it has to be redefined before each command)
# Go for the first test
+
p Test instrumentation of SMPI
$ ../../bin/smpirun -trace -trace-resource -trace-file smpi_traced.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/tracing/platform.xml -np 3 ./smpi_traced
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
SG_BEGIN_DECL()
+/**************************** Scalar Values **********************************/
+
+typedef union u_smx_scalar u_smx_scalar_t;
/* ******************************** Host ************************************ */
/** @brief Host datatype
double process_kill_time);
/*********************************** Host *************************************/
-XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_dict(void);
+//XBT_PUBLIC(xbt_dict_t) SIMIX_host_get_dict(u_smx_scalar_t *args);
XBT_PUBLIC(smx_host_t) SIMIX_host_get_by_name(const char *name);
XBT_PUBLIC(smx_host_t) SIMIX_host_self(void);
XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-
#include "instr/instr_private.h"
#ifdef HAVE_TRACING
"scatterv", "0.52 0 0.52",
"scatter", "1 0.74 0.54",
"computing", "0 1 1",
-
NULL, NULL,
};
}
+mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
+ return MC_take_snapshot();
+}
+
mc_snapshot_t MC_take_snapshot()
{
heap_equality_free((heap_equality_t) * (void **) e);
}
+int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall,
+ mc_snapshot_t s1, mc_snapshot_t s2){
+ return snapshot_compare(s1, s2, NULL, NULL);
+}
+
int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, mc_comparison_times_t ct1, mc_comparison_times_t ct2){
int raw_mem = (mmalloc_get_current_heap() == raw_heap);
}s_mc_global_t, *mc_global_t;
//void MC_take_snapshot(mc_snapshot_t);
+mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall);
mc_snapshot_t MC_take_snapshot(void);
void MC_restore_snapshot(mc_snapshot_t);
void MC_free_snapshot(mc_snapshot_t);
int reached(xbt_state_t st);
void set_pair_reached(xbt_state_t st);
int visited(xbt_state_t st);
+int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall,
+ mc_snapshot_t s1, mc_snapshot_t s2);
int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, mc_comparison_times_t ct1, mc_comparison_times_t ct2);
void MC_pair_delete(mc_pair_t pair);
void MC_exit_liveness(void);
if( (r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
&& r2->call == SIMCALL_COMM_WAIT){
- if(r2->comm_wait.comm->comm.rdv == NULL)
+ if(simcall_comm_wait__get__comm(r2)->comm.rdv == NULL)
return FALSE;
- smx_rdv_t rdv = r1->call == SIMCALL_COMM_ISEND ? r1->comm_isend.rdv : r1->comm_irecv.rdv;
+ smx_rdv_t rdv = r1->call == SIMCALL_COMM_ISEND ? simcall_comm_isend__get__rdv(r1) : simcall_comm_irecv__get__rdv(r1);
- if(r2->comm_wait.comm->comm.rdv != rdv)
+ if(simcall_comm_wait__get__comm(r2)->comm.rdv != rdv)
return FALSE;
- if(r2->comm_wait.comm->comm.type == SIMIX_COMM_SEND && r1->call == SIMCALL_COMM_ISEND)
+ if(simcall_comm_wait__get__comm(r2)->comm.type == SIMIX_COMM_SEND && r1->call == SIMCALL_COMM_ISEND)
return FALSE;
- if(r2->comm_wait.comm->comm.type == SIMIX_COMM_RECEIVE && r1->call == SIMCALL_COMM_IRECV)
+ if(simcall_comm_wait__get__comm(r2)->comm.type == SIMIX_COMM_RECEIVE && r1->call == SIMCALL_COMM_IRECV)
return FALSE;
}
if( (r2->call == SIMCALL_COMM_ISEND || r2->call == SIMCALL_COMM_IRECV)
&& r1->call == SIMCALL_COMM_WAIT){
- if(r1->comm_wait.comm->comm.rdv != NULL)
+ if(simcall_comm_wait__get__comm(r1)->comm.rdv != NULL)
return FALSE;
- smx_rdv_t rdv = r2->call == SIMCALL_COMM_ISEND ? r2->comm_isend.rdv : r2->comm_irecv.rdv;
+ smx_rdv_t rdv = r2->call == SIMCALL_COMM_ISEND ? simcall_comm_isend__get__rdv(r2) : simcall_comm_irecv__get__rdv(r2);
- if(r1->comm_wait.comm->comm.rdv != rdv)
+ if(simcall_comm_wait__get__comm(r1)->comm.rdv != rdv)
return FALSE;
- if(r1->comm_wait.comm->comm.type == SIMIX_COMM_SEND && r2->call == SIMCALL_COMM_ISEND)
+ if(simcall_comm_wait__get__comm(r1)->comm.type == SIMIX_COMM_SEND && r2->call == SIMCALL_COMM_ISEND)
return FALSE;
- if(r1->comm_wait.comm->comm.type == SIMIX_COMM_RECEIVE && r2->call == SIMCALL_COMM_IRECV)
+ if(simcall_comm_wait__get__comm(r1)->comm.type == SIMIX_COMM_RECEIVE && r2->call == SIMCALL_COMM_IRECV)
return FALSE;
}
return FALSE;*/
if(r1->call == SIMCALL_COMM_ISEND && r2->call == SIMCALL_COMM_ISEND
- && r1->comm_isend.rdv != r2->comm_isend.rdv)
+ && simcall_comm_isend__get__rdv(r1) != simcall_comm_isend__get__rdv(r2))
return FALSE;
if(r1->call == SIMCALL_COMM_IRECV && r2->call == SIMCALL_COMM_IRECV
- && r1->comm_irecv.rdv != r2->comm_irecv.rdv)
+ && simcall_comm_irecv__get__rdv(r1) != simcall_comm_irecv__get__rdv(r2))
return FALSE;
if(r1->call == SIMCALL_COMM_WAIT && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
- && (r1->comm_wait.comm->comm.src_proc == NULL
- || r1->comm_wait.comm->comm.dst_proc == NULL))
+ && (simcall_comm_wait__get__comm(r1)->comm.src_proc == NULL
+ || simcall_comm_wait__get__comm(r1)->comm.dst_proc == NULL))
return FALSE;
if(r2->call == SIMCALL_COMM_WAIT && (r1->call == SIMCALL_COMM_WAIT || r1->call == SIMCALL_COMM_TEST)
- && (r2->comm_wait.comm->comm.src_proc == NULL
- || r2->comm_wait.comm->comm.dst_proc == NULL))
+ && (simcall_comm_wait__get__comm(r2)->comm.src_proc == NULL
+ || simcall_comm_wait__get__comm(r2)->comm.dst_proc == NULL))
return FALSE;
if(r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_WAIT
- && r1->comm_wait.comm->comm.src_buff == r2->comm_wait.comm->comm.src_buff
- && r1->comm_wait.comm->comm.dst_buff == r2->comm_wait.comm->comm.dst_buff)
+ && simcall_comm_wait__get__comm(r1)->comm.src_buff == simcall_comm_wait__get__comm(r2)->comm.src_buff
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff == simcall_comm_wait__get__comm(r2)->comm.dst_buff)
return FALSE;
if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_WAIT
- && r1->comm_wait.comm->comm.src_buff != NULL
- && r1->comm_wait.comm->comm.dst_buff != NULL
- && r2->comm_wait.comm->comm.src_buff != NULL
- && r2->comm_wait.comm->comm.dst_buff != NULL
- && r1->comm_wait.comm->comm.dst_buff != r2->comm_wait.comm->comm.src_buff
- && r1->comm_wait.comm->comm.dst_buff != r2->comm_wait.comm->comm.dst_buff
- && r2->comm_wait.comm->comm.dst_buff != r1->comm_wait.comm->comm.src_buff)
+ && simcall_comm_wait__get__comm(r1)->comm.src_buff != NULL
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff != NULL
+ && simcall_comm_wait__get__comm(r2)->comm.src_buff != NULL
+ && simcall_comm_wait__get__comm(r2)->comm.dst_buff != NULL
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.src_buff
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.dst_buff
+ && simcall_comm_wait__get__comm(r2)->comm.dst_buff != simcall_comm_wait__get__comm(r1)->comm.src_buff)
return FALSE;
if(r1->call == SIMCALL_COMM_TEST &&
- (r1->comm_test.comm == NULL
- || r1->comm_test.comm->comm.src_buff == NULL
- || r1->comm_test.comm->comm.dst_buff == NULL))
+ (simcall_comm_test__get__comm(r1) == NULL
+ || simcall_comm_test__get__comm(r1)->comm.src_buff == NULL
+ || simcall_comm_test__get__comm(r1)->comm.dst_buff == NULL))
return FALSE;
if(r2->call == SIMCALL_COMM_TEST &&
- (r2->comm_test.comm == NULL
- || r2->comm_test.comm->comm.src_buff == NULL
- || r2->comm_test.comm->comm.dst_buff == NULL))
+ (simcall_comm_test__get__comm(r2) == NULL
+ || simcall_comm_test__get__comm(r2)->comm.src_buff == NULL
+ || simcall_comm_test__get__comm(r2)->comm.dst_buff == NULL))
return FALSE;
if(r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
- && r1->comm_test.comm->comm.src_buff == r2->comm_wait.comm->comm.src_buff
- && r1->comm_test.comm->comm.dst_buff == r2->comm_wait.comm->comm.dst_buff)
+ && simcall_comm_test__get__comm(r1)->comm.src_buff == simcall_comm_wait__get__comm(r2)->comm.src_buff
+ && simcall_comm_test__get__comm(r1)->comm.dst_buff == simcall_comm_wait__get__comm(r2)->comm.dst_buff)
return FALSE;
if(r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
- && r1->comm_wait.comm->comm.src_buff == r2->comm_test.comm->comm.src_buff
- && r1->comm_wait.comm->comm.dst_buff == r2->comm_test.comm->comm.dst_buff)
+ && simcall_comm_wait__get__comm(r1)->comm.src_buff == simcall_comm_test__get__comm(r2)->comm.src_buff
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff == simcall_comm_test__get__comm(r2)->comm.dst_buff)
return FALSE;
if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
- && r1->comm_wait.comm->comm.src_buff != NULL
- && r1->comm_wait.comm->comm.dst_buff != NULL
- && r2->comm_test.comm->comm.src_buff != NULL
- && r2->comm_test.comm->comm.dst_buff != NULL
- && r1->comm_wait.comm->comm.dst_buff != r2->comm_test.comm->comm.src_buff
- && r1->comm_wait.comm->comm.dst_buff != r2->comm_test.comm->comm.dst_buff
- && r2->comm_test.comm->comm.dst_buff != r1->comm_wait.comm->comm.src_buff)
+ && simcall_comm_wait__get__comm(r1)->comm.src_buff != NULL
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff != NULL
+ && simcall_comm_test__get__comm(r2)->comm.src_buff != NULL
+ && simcall_comm_test__get__comm(r2)->comm.dst_buff != NULL
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_test__get__comm(r2)->comm.src_buff
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff != simcall_comm_test__get__comm(r2)->comm.dst_buff
+ && simcall_comm_test__get__comm(r2)->comm.dst_buff != simcall_comm_wait__get__comm(r1)->comm.src_buff)
return FALSE;
if (r1->call == SIMCALL_COMM_TEST && r2->call == SIMCALL_COMM_WAIT
- && r1->comm_test.comm->comm.src_buff != NULL
- && r1->comm_test.comm->comm.dst_buff != NULL
- && r2->comm_wait.comm->comm.src_buff != NULL
- && r2->comm_wait.comm->comm.dst_buff != NULL
- && r1->comm_test.comm->comm.dst_buff != r2->comm_wait.comm->comm.src_buff
- && r1->comm_test.comm->comm.dst_buff != r2->comm_wait.comm->comm.dst_buff
- && r2->comm_wait.comm->comm.dst_buff != r1->comm_test.comm->comm.src_buff)
+ && simcall_comm_test__get__comm(r1)->comm.src_buff != NULL
+ && simcall_comm_test__get__comm(r1)->comm.dst_buff != NULL
+ && simcall_comm_wait__get__comm(r2)->comm.src_buff != NULL
+ && simcall_comm_wait__get__comm(r2)->comm.dst_buff != NULL
+ && simcall_comm_test__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.src_buff
+ && simcall_comm_test__get__comm(r1)->comm.dst_buff != simcall_comm_wait__get__comm(r2)->comm.dst_buff
+ && simcall_comm_wait__get__comm(r2)->comm.dst_buff != simcall_comm_test__get__comm(r1)->comm.src_buff)
return FALSE;
switch(req->call){
case SIMCALL_COMM_ISEND:
type = xbt_strdup("iSend");
- p = pointer_to_string(req->comm_isend.src_buff);
- bs = buff_size_to_string(req->comm_isend.src_buff_size);
+ p = pointer_to_string(simcall_comm_isend__get__src_buff(req));
+ bs = buff_size_to_string(simcall_comm_isend__get__src_buff_size(req));
args = bprintf("src=%s, buff=%s, size=%s", req->issuer->name, p, bs);
break;
case SIMCALL_COMM_IRECV:
- size = req->comm_irecv.dst_buff_size ? *req->comm_irecv.dst_buff_size : 0;
+ size = simcall_comm_irecv__get__dst_buff_size(req) ? *simcall_comm_irecv__get__dst_buff_size(req) : 0;
type = xbt_strdup("iRecv");
- p = pointer_to_string(req->comm_irecv.dst_buff);
+ p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
bs = buff_size_to_string(size);
args = bprintf("dst=%s, buff=%s, size=%s", req->issuer->name, p, bs);
break;
case SIMCALL_COMM_WAIT:
- act = req->comm_wait.comm;
+ act = simcall_comm_wait__get__comm(req);
if(value == -1){
type = xbt_strdup("WaitTimeout");
p = pointer_to_string(act);
}
break;
case SIMCALL_COMM_TEST:
- act = req->comm_test.comm;
+ act = simcall_comm_test__get__comm(req);
if(act->comm.src_proc == NULL || act->comm.dst_proc == NULL){
type = xbt_strdup("Test FALSE");
p = pointer_to_string(act);
case SIMCALL_COMM_WAITANY:
type = xbt_strdup("WaitAny");
- p = pointer_to_string(xbt_dynar_get_as(req->comm_waitany.comms, value, smx_action_t));
+ p = pointer_to_string(xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_action_t));
args = bprintf("comm=%s (%d of %lu)", p,
- value+1, xbt_dynar_length(req->comm_waitany.comms));
+ value+1, xbt_dynar_length(simcall_comm_waitany__get__comms(req)));
break;
case SIMCALL_COMM_TESTANY:
args = xbt_strdup("-");
}else{
type = xbt_strdup("TestAny");
- args = bprintf("(%d of %lu)", value+1, xbt_dynar_length(req->comm_testany.comms));
+ args = bprintf("(%d of %lu)", value+1, xbt_dynar_length(simcall_comm_testany__get__comms(req)));
}
break;
unsigned int cursor;
smx_action_t action;
- xbt_dynar_foreach(req->comm_testany.comms, cursor, action){
+ xbt_dynar_foreach(simcall_comm_testany__get__comms(req), cursor, action){
if(action->comm.src_proc && action->comm.dst_proc)
return FALSE;
}
/* If it has a timeout it will be always be enabled, because even if the
* communication is not ready, it can timeout and won't block.
* On the other hand if it hasn't a timeout, check if the comm is ready.*/
- if(req->comm_wait.timeout >= 0){
+ if(simcall_comm_wait__get__timeout(req) >= 0){
if(_surf_mc_timeout == 1){
return TRUE;
}else{
- act = req->comm_wait.comm;
+ act = simcall_comm_wait__get__comm(req);
return (act->comm.src_proc && act->comm.dst_proc);
}
}else{
- act = req->comm_wait.comm;
+ act = simcall_comm_wait__get__comm(req);
return (act->comm.src_proc && act->comm.dst_proc);
}
break;
case SIMCALL_COMM_WAITANY:
/* Check if it has at least one communication ready */
- xbt_dynar_foreach(req->comm_waitany.comms, index, act) {
+ xbt_dynar_foreach(simcall_comm_waitany__get__comms(req), index, act) {
if (act->comm.src_proc && act->comm.dst_proc){
return TRUE;
}
case SIMCALL_COMM_WAIT:
/* FIXME: check also that src and dst processes are not suspended */
- act = req->comm_wait.comm;
+ act = simcall_comm_wait__get__comm(req);
return (act->comm.src_proc && act->comm.dst_proc);
break;
case SIMCALL_COMM_WAITANY:
- act = xbt_dynar_get_as(req->comm_waitany.comms, idx, smx_action_t);
+ act = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), idx, smx_action_t);
return (act->comm.src_proc && act->comm.dst_proc);
break;
case SIMCALL_COMM_TESTANY:
- act = xbt_dynar_get_as(req->comm_testany.comms, idx, smx_action_t);
+ act = xbt_dynar_get_as(simcall_comm_testany__get__comms(req), idx, smx_action_t);
return (act->comm.src_proc && act->comm.dst_proc);
break;
case SIMCALL_COMM_WAITANY:
state->internal_req.call = SIMCALL_COMM_WAIT;
state->internal_req.issuer = req->issuer;
- state->internal_comm = *xbt_dynar_get_as(req->comm_waitany.comms, value, smx_action_t);
- state->internal_req.comm_wait.comm = &state->internal_comm;
- state->internal_req.comm_wait.timeout = 0;
+ state->internal_comm = *xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_action_t);
+ simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm);
+ simcall_comm_wait__set__timeout(&state->internal_req, 0);
break;
case SIMCALL_COMM_TESTANY:
state->internal_req.issuer = req->issuer;
if(value > 0)
- state->internal_comm = *xbt_dynar_get_as(req->comm_testany.comms, value, smx_action_t);
+ state->internal_comm = *xbt_dynar_get_as(simcall_comm_testany__get__comms(req), value, smx_action_t);
- state->internal_req.comm_wait.comm = &state->internal_comm;
- state->internal_req.comm_test.result = value;
+ simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm);
+ simcall_comm_test__set__result(&state->internal_req, value);
break;
case SIMCALL_COMM_WAIT:
state->internal_req = *req;
- state->internal_comm = *(req->comm_wait.comm);
- state->executed_req.comm_wait.comm = &state->internal_comm;
- state->internal_req.comm_wait.comm = &state->internal_comm;
+ state->internal_comm = *(simcall_comm_wait__get__comm(req));
+ simcall_comm_wait__set__comm(&state->executed_req, &state->internal_comm);
+ simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm);
break;
case SIMCALL_COMM_TEST:
state->internal_req = *req;
- state->internal_comm = *req->comm_test.comm;
- state->executed_req.comm_test.comm = &state->internal_comm;
- state->internal_req.comm_test.comm = &state->internal_comm;
+ state->internal_comm = *simcall_comm_test__get__comm(req);
+ simcall_comm_test__set__comm(&state->executed_req, &state->internal_comm);
+ simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm);
break;
default:
switch(process->simcall.call){
case SIMCALL_COMM_WAITANY:
*value = -1;
- while(procstate->interleave_count < xbt_dynar_length(process->simcall.comm_waitany.comms)){
+ while(procstate->interleave_count < xbt_dynar_length(simcall_comm_waitany__get__comms(&process->simcall))){
if(MC_request_is_enabled_by_idx(&process->simcall, procstate->interleave_count++)){
*value = procstate->interleave_count-1;
break;
}
}
- if(procstate->interleave_count >= xbt_dynar_length(process->simcall.comm_waitany.comms))
+ if(procstate->interleave_count >= xbt_dynar_length(simcall_comm_waitany__get__comms(&process->simcall)))
procstate->state = MC_DONE;
if(*value != -1)
case SIMCALL_COMM_TESTANY:
start_count = procstate->interleave_count;
*value = -1;
- while(procstate->interleave_count < xbt_dynar_length(process->simcall.comm_testany.comms)){
+ while(procstate->interleave_count < xbt_dynar_length(simcall_comm_testany__get__comms(&process->simcall))){
if(MC_request_is_enabled_by_idx(&process->simcall, procstate->interleave_count++)){
*value = procstate->interleave_count - 1;
break;
}
}
- if(procstate->interleave_count >= xbt_dynar_length(process->simcall.comm_testany.comms))
+ if(procstate->interleave_count >= xbt_dynar_length(simcall_comm_testany__get__comms(&process->simcall)))
procstate->state = MC_DONE;
if(*value != -1 || start_count == 0)
break;
case SIMCALL_COMM_WAIT:
- if(process->simcall.comm_wait.comm->comm.src_proc
- && process->simcall.comm_wait.comm->comm.dst_proc){
+ if(simcall_comm_wait__get__comm(&process->simcall)->comm.src_proc
+ && simcall_comm_wait__get__comm(&process->simcall)->comm.dst_proc){
*value = 0;
}else{
*value = -1;
static void SIMIX_clean(void);
+SIMCALL_LIST(SIMCALL_RES_GETSET, SIMCALL_SEP_NOTHING)
+SIMCALL_LIST(SIMCALL_ARG_GETSET, SIMCALL_SEP_NOTHING)
+
/* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
#include <signal.h>
((smx_action_t) action)->simcalls = fifo;
}
+xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name){
+ return SIMIX_asr_get_properties(name);
+}
xbt_dict_t SIMIX_asr_get_properties(const char *name)
{
return xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL);
return;
}
-/**
- * \brief Returns a dict of all hosts.
- *
- * \return List of all hosts (as a #xbt_dict_t)
- */
-xbt_dict_t SIMIX_host_get_dict(void)
-{
- xbt_dict_t host_dict = xbt_dict_new_homogeneous(NULL);
- xbt_lib_cursor_t cursor = NULL;
- char *name = NULL;
- void **host = NULL;
-
- xbt_lib_foreach(host_lib, cursor, name, host){
- if(host[SIMIX_HOST_LEVEL])
- xbt_dict_set(host_dict,name,host[SIMIX_HOST_LEVEL], NULL);
- }
- return host_dict;
-}
-
-smx_host_t SIMIX_host_get_by_name(const char *name)
-{
+///**
+// * \brief Returns a dict of all hosts.
+// *
+// * \return List of all hosts (as a #xbt_dict_t)
+// */
+//xbt_dict_t SIMIX_host_get_dict(void)
+//{
+// xbt_dict_t host_dict = xbt_dict_new_homogeneous(NULL);
+// xbt_lib_cursor_t cursor = NULL;
+// char *name = NULL;
+// void **host = NULL;
+//
+// xbt_lib_foreach(host_lib, cursor, name, host){
+// if(host[SIMIX_HOST_LEVEL])
+// xbt_dict_set(host_dict,name,host[SIMIX_HOST_LEVEL], NULL);
+// }
+// return host_dict;
+//}
+smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t simcall, const char *name){
+ return SIMIX_host_get_by_name(name);
+}
+smx_host_t SIMIX_host_get_by_name(const char *name){
xbt_assert(((simix_global != NULL)
&& (host_lib != NULL)),
"Environment not set yet");
return (process == NULL) ? NULL : SIMIX_process_get_host(process);
}
+const char* SIMIX_pre_host_self_get_name(smx_simcall_t simcall){
+ return SIMIX_host_self_get_name();
+}
/* needs to be public and without simcall because it is called
by exceptions and logging events */
const char* SIMIX_host_self_get_name(void)
return SIMIX_host_get_name(host);
}
-const char* SIMIX_host_get_name(smx_host_t host)
-{
+const char* SIMIX_pre_host_get_name(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_name(host);
+}
+const char* SIMIX_host_get_name(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters");
return host->name;
}
-xbt_dict_t SIMIX_host_get_properties(smx_host_t host)
-{
+xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_properties(host);
+}
+xbt_dict_t SIMIX_host_get_properties(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.get_properties(host->host);
}
-double SIMIX_host_get_speed(smx_host_t host)
-{
+double SIMIX_pre_host_get_speed(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_speed(host);
+}
+double SIMIX_host_get_speed(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.
get_speed(host->host, 1.0);
}
-double SIMIX_host_get_available_speed(smx_host_t host)
-{
+double SIMIX_pre_host_get_available_speed(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_available_speed(host);
+}
+double SIMIX_host_get_available_speed(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.
get_available_speed(host->host);
}
-int SIMIX_host_get_state(smx_host_t host)
-{
+int SIMIX_pre_host_get_state(smx_simcall_t simcall, smx_host_t host){
+ return SIMIX_host_get_state(host);
+}
+int SIMIX_host_get_state(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_model->extension.workstation.
get_state(host->host);
}
+void* SIMIX_pre_host_self_get_data(smx_simcall_t simcall){
+ return SIMIX_host_self_get_data();
+}
void* SIMIX_host_self_get_data(void)
{
- return SIMIX_host_get_data(SIMIX_host_self());
+ smx_host_t self = SIMIX_host_self();
+ return SIMIX_host_get_data(self);
}
void SIMIX_host_self_set_data(void *data)
{
- SIMIX_host_set_data(SIMIX_host_self(), data);
+ smx_host_t self = SIMIX_host_self();
+ SIMIX_host_set_data(self, data);
}
-void* SIMIX_host_get_data(smx_host_t host)
-{
+void* SIMIX_pre_host_get_data(smx_simcall_t simcall,smx_host_t host){
+ return SIMIX_host_get_data(host);
+}
+void* SIMIX_host_get_data(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return host->data;
xbt_die("No function for simix_global->autorestart");
}
-void SIMIX_host_set_data(smx_host_t host, void *data)
-{
+void SIMIX_pre_host_set_data(smx_simcall_t simcall, smx_host_t host, void *data) {
+ SIMIX_host_set_data(host, data);
+}
+void SIMIX_host_set_data(smx_host_t host, void *data){
xbt_assert((host != NULL), "Invalid parameters");
xbt_assert((host->data == NULL), "Data already set");
host->data = data;
}
-smx_action_t SIMIX_host_execute(const char *name, smx_host_t host,
- double computation_amount,
- double priority)
-{
+smx_action_t SIMIX_pre_host_execute(smx_simcall_t simcall,const char *name,
+ smx_host_t host, double computation_amount, double priority){
+ return SIMIX_host_execute(name, host, computation_amount, priority);
+}
+smx_action_t SIMIX_host_execute(const char *name,
+ smx_host_t host, double computation_amount, double priority){
+
/* alloc structures and initialize */
smx_action_t action = xbt_mallocator_get(simix_global->action_mallocator);
action->type = SIMIX_ACTION_EXECUTE;
return action;
}
-smx_action_t SIMIX_host_parallel_execute( const char *name,
+smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t simcall, const char *name,
int host_nb, smx_host_t *host_list,
double *computation_amount, double *communication_amount,
- double amount, double rate)
-{
+ double amount, double rate){
+ return SIMIX_host_parallel_execute(name, host_nb, host_list, computation_amount,
+ communication_amount, amount, rate);
+}
+smx_action_t SIMIX_host_parallel_execute(const char *name,
+ int host_nb, smx_host_t *host_list,
+ double *computation_amount, double *communication_amount,
+ double amount, double rate){
+
void **workstation_list = NULL;
int i;
return action;
}
-void SIMIX_host_execution_destroy(smx_action_t action)
-{
+void SIMIX_pre_host_execution_destroy(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_host_execution_destroy(action);
+}
+void SIMIX_host_execution_destroy(smx_action_t action){
XBT_DEBUG("Destroy action %p", action);
if (action->execution.surf_exec) {
xbt_mallocator_release(simix_global->action_mallocator, action);
}
-void SIMIX_host_execution_cancel(smx_action_t action)
-{
+void SIMIX_pre_host_execution_cancel(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_host_execution_cancel(action);
+}
+void SIMIX_host_execution_cancel(smx_action_t action){
XBT_DEBUG("Cancel action %p", action);
if (action->execution.surf_exec)
surf_workstation_model->action_cancel(action->execution.surf_exec);
}
-double SIMIX_host_execution_get_remains(smx_action_t action)
-{
+double SIMIX_pre_host_execution_get_remains(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_host_execution_get_remains(action);
+}
+double SIMIX_host_execution_get_remains(smx_action_t action){
double result = 0.0;
if (action->state == SIMIX_RUNNING)
return result;
}
-e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action)
-{
+e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_host_execution_get_state(action);
+}
+e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action){
return action->state;
}
-void SIMIX_host_execution_set_priority(smx_action_t action, double priority)
-{
+void SIMIX_pre_host_execution_set_priority(smx_simcall_t simcall, smx_action_t action,
+ double priority){
+ return SIMIX_host_execution_set_priority(action, priority);
+}
+void SIMIX_host_execution_set_priority(smx_action_t action, double priority){
if(action->execution.surf_exec)
surf_workstation_model->set_priority(action->execution.surf_exec, priority);
}
-void SIMIX_pre_host_execution_wait(smx_simcall_t simcall)
-{
- smx_action_t action = simcall->host_execution_wait.execution;
+void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action){
XBT_DEBUG("Wait for execution of action %p, state %d", action, (int)action->state);
}
simcall->issuer->waiting_action = NULL;
- simcall->host_execution_wait.result = action->state;
+ simcall_host_execution_wait__set__result(simcall, action->state);
SIMIX_simcall_answer(simcall);
}
#ifdef HAVE_TRACING
+void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
+ const char *category){
+ SIMIX_set_category(action, category);
+}
void SIMIX_set_category(smx_action_t action, const char *category)
{
if (action->state != SIMIX_RUNNING) return;
int argc, char **argv,
xbt_dict_t properties,
int auto_restart);
+
void SIMIX_host_restart_processes(smx_host_t host);
void SIMIX_host_autorestart(smx_host_t host);
xbt_dict_t SIMIX_host_get_properties(smx_host_t host);
double SIMIX_host_execution_get_remains(smx_action_t action);
e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action);
void SIMIX_host_execution_set_priority(smx_action_t action, double priority);
-void SIMIX_pre_host_execution_wait(smx_simcall_t simcall);
+void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
+
+// pre prototypes
+smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
+const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
+const char* SIMIX_pre_host_get_name(smx_simcall_t, smx_host_t);
+xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t, smx_host_t);
+double SIMIX_pre_host_get_speed(smx_simcall_t, smx_host_t);
+double SIMIX_pre_host_get_available_speed(smx_simcall_t, smx_host_t);
+int SIMIX_pre_host_get_state(smx_simcall_t, smx_host_t);
+void* SIMIX_pre_host_self_get_data(smx_simcall_t);
+void* SIMIX_pre_host_get_data(smx_simcall_t, smx_host_t);
+void SIMIX_pre_host_set_data(smx_simcall_t, smx_host_t, void*);
+smx_action_t SIMIX_pre_host_execute(smx_simcall_t, const char*, smx_host_t, double, double);
+smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t, const char*, int, smx_host_t*,
+ double*, double*, double, double);
+void SIMIX_pre_host_execution_destroy(smx_simcall_t, smx_action_t);
+void SIMIX_pre_host_execution_cancel(smx_simcall_t, smx_action_t);
+double SIMIX_pre_host_execution_get_remains(smx_simcall_t, smx_action_t);
+e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t, smx_action_t);
+void SIMIX_pre_host_execution_set_priority(smx_simcall_t, smx_action_t, double);
void SIMIX_host_execution_suspend(smx_action_t action);
void SIMIX_host_execution_resume(smx_action_t action);
void SIMIX_post_host_execute(smx_action_t action);
#ifdef HAVE_TRACING
+void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
+ const char *category);
void SIMIX_set_category(smx_action_t action, const char *category);
#endif
//SIMIX FILE READ
-void SIMIX_pre_file_read(smx_simcall_t simcall)
+void SIMIX_pre_file_read(smx_simcall_t simcall, void *ptr, size_t size,
+ size_t nmemb, smx_file_t stream)
{
- smx_action_t action = SIMIX_file_read(simcall->issuer,
- simcall->file_read.ptr,
- simcall->file_read.size,
- simcall->file_read.nmemb,
- simcall->file_read.stream);
+ smx_action_t action = SIMIX_file_read(simcall->issuer, ptr, size, nmemb, stream);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE WRITE
-void SIMIX_pre_file_write(smx_simcall_t simcall)
+void SIMIX_pre_file_write(smx_simcall_t simcall, const void *ptr, size_t size,
+ size_t nmemb, smx_file_t stream)
{
- smx_action_t action = SIMIX_file_write(simcall->issuer,
- simcall->file_write.ptr,
- simcall->file_write.size,
- simcall->file_write.nmemb,
- simcall->file_write.stream);
+ smx_action_t action = SIMIX_file_write(simcall->issuer, ptr, size, nmemb, stream);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE OPEN
-void SIMIX_pre_file_open(smx_simcall_t simcall)
+void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount,
+ const char* path, const char* mode)
{
- smx_action_t action = SIMIX_file_open(simcall->issuer,
- simcall->file_open.mount,
- simcall->file_open.path,
- simcall->file_open.mode);
+ smx_action_t action = SIMIX_file_open(simcall->issuer, mount, path, mode);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE CLOSE
-void SIMIX_pre_file_close(smx_simcall_t simcall)
+void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fp)
{
- smx_action_t action = SIMIX_file_close(simcall->issuer,
- simcall->file_close.fp);
+ smx_action_t action = SIMIX_file_close(simcall->issuer, fp);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE STAT
-void SIMIX_pre_file_stat(smx_simcall_t simcall)
+void SIMIX_pre_file_stat(smx_simcall_t simcall, smx_file_t fd, s_file_stat_t *buf)
{
- smx_action_t action = SIMIX_file_stat(simcall->issuer,
- simcall->file_stat.fd,
- simcall->file_stat.buf);
+ smx_action_t action = SIMIX_file_stat(simcall->issuer, fd, *buf);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE UNLINK
-void SIMIX_pre_file_unlink(smx_simcall_t simcall)
+void SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd)
{
- smx_action_t action = SIMIX_file_unlink(simcall->issuer,
- simcall->file_unlink.fd);
+ smx_action_t action = SIMIX_file_unlink(simcall->issuer, fd);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
}
//SIMIX FILE LS
-void SIMIX_pre_file_ls(smx_simcall_t simcall)
+void SIMIX_pre_file_ls(smx_simcall_t simcall,
+ const char* mount, const char* path)
{
- smx_action_t action = SIMIX_file_ls(simcall->issuer,
- simcall->file_ls.mount, simcall->file_ls.path);
+ smx_action_t action = SIMIX_file_ls(simcall->issuer, mount, path);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
xbt_fifo_foreach(action->simcalls,i,simcall,smx_simcall_t) {
switch (simcall->call) {
- case SIMCALL_FILE_OPEN:
- simcall->file_open.result = xbt_new(s_smx_file_t,1);
- simcall->file_open.result->surf_file = (action->io.surf_io)->file;
+ case SIMCALL_FILE_OPEN:;
+ smx_file_t tmp = xbt_new(s_smx_file_t,1);
+ tmp->surf_file = (action->io.surf_io)->file;
+ simcall_file_open__set__result(simcall, tmp);
break;
case SIMCALL_FILE_CLOSE:
- xbt_free(simcall->file_close.fp);
- simcall->file_close.result = 0;
+ xbt_free(simcall_file_close__get__fp(simcall));
+ simcall_file_close__set__result(simcall, 0);
break;
case SIMCALL_FILE_WRITE:
- simcall->file_write.result = (action->io.surf_io)->cost;
+ simcall_file_write__set__result(simcall, (action->io.surf_io)->cost);
break;
case SIMCALL_FILE_READ:
- simcall->file_read.result = (action->io.surf_io)->cost;
+ simcall_file_read__set__result(simcall, (action->io.surf_io)->cost);
break;
case SIMCALL_FILE_STAT:
- simcall->file_stat.result = 0;
- dst = &(simcall->file_stat.buf);
+ simcall_file_stat__set__result(simcall, 0);
+ dst = simcall_file_stat__get__buf(simcall);
src = &((action->io.surf_io)->stat);
file_stat_copy(src,dst);
break;
case SIMCALL_FILE_UNLINK:
- xbt_free(simcall->file_unlink.fd);
- simcall->file_unlink.result = 0;
+ xbt_free(simcall_file_unlink__get__fd(simcall));
+ simcall_file_unlink__set__result(simcall, 0);
break;
case SIMCALL_FILE_LS:
xbt_dict_set((action->io.surf_io)->ls_dict,key,dst,free_file_stat);
}
}
- simcall->file_ls.result = (action->io.surf_io)->ls_dict;
+ simcall_file_ls__set__result(simcall, (action->io.surf_io)->ls_dict);
break;
default:
#include "simgrid/simix.h"
#include "smx_smurf_private.h"
-void SIMIX_pre_file_read(smx_simcall_t simcall);
-void SIMIX_pre_file_write(smx_simcall_t simcall);
-void SIMIX_pre_file_open(smx_simcall_t simcall);
-void SIMIX_pre_file_close(smx_simcall_t simcall);
-void SIMIX_pre_file_stat(smx_simcall_t simcall);
-void SIMIX_pre_file_unlink(smx_simcall_t simcall);
-void SIMIX_pre_file_ls(smx_simcall_t simcall);
+void SIMIX_pre_file_read(smx_simcall_t simcall, void *ptr, size_t size,
+ size_t nmemb, smx_file_t stream);
+void SIMIX_pre_file_write(smx_simcall_t simcall, const void *ptr, size_t size,
+ size_t nmemb, smx_file_t strea);
+void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount,
+ const char* path, const char* mode);
+void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fp);
+void SIMIX_pre_file_stat(smx_simcall_t simcall, smx_file_t fd, s_file_stat_t *buf);
+void SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd);
+void SIMIX_pre_file_ls(smx_simcall_t simcall,
+ const char* mount, const char* path);
smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
void SIMIX_io_destroy(smx_action_t action);
void SIMIX_io_finish(smx_action_t action);
+// pre prototypes
+
#endif
/* Rendez-Vous Points */
/******************************************************************************/
+smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name){
+ return SIMIX_rdv_create(name);
+}
smx_rdv_t SIMIX_rdv_create(const char *name)
{
/* two processes may have pushed the same rdv_create simcall at the same time */
return rdv;
}
+void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv){
+ return SIMIX_rdv_destroy(rdv);
+}
void SIMIX_rdv_destroy(smx_rdv_t rdv)
{
if (rdv->name)
return rdv_points;
}
+smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name){
+ return SIMIX_rdv_get_by_name(name);
+}
smx_rdv_t SIMIX_rdv_get_by_name(const char *name)
{
return xbt_dict_get_or_null(rdv_points, name);
}
+int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host){
+ return SIMIX_rdv_comm_count_by_host(rdv, host);
+}
int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
{
smx_action_t comm = NULL;
return count;
}
+smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv){
+ return SIMIX_rdv_get_head(rdv);
+}
smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv)
{
return xbt_fifo_get_item_content(xbt_fifo_get_first_item(rdv->comm_fifo));
}
+smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv){
+ return SIMIX_rdv_get_receiver(rdv);
+}
/**
* \brief get the receiver (process associated to the mailbox)
* \param rdv The rendez-vous point
return rdv->permanent_receiver;
}
+void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv,
+ smx_process_t process){
+ SIMIX_rdv_set_receiver(rdv, process);
+}
/**
* \brief set the receiver of the rendez vous point to allow eager sends
* \param rdv The rendez-vous point
* \param process The receiving process
*/
-void SIMIX_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process)
+void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t process)
{
rdv->permanent_receiver=process;
}
return act;
}
+void SIMIX_pre_comm_destroy(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_comm_destroy(action);
+}
/**
* \brief Destroy a communicate action
* \param action The communicate action to be destroyed
}
}
+void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *data, double timeout){
+ smx_action_t comm = SIMIX_comm_isend(simcall->issuer, rdv, task_size, rate,
+ src_buff, src_buff_size, match_fun, NULL,
+ data, 0);
+ simcall->mc_value = 0;
+ SIMIX_pre_comm_wait(simcall, comm, timeout);
+}
+smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void (*clean_fun)(void *),
+ void *data, int detached){
+ return SIMIX_comm_isend(simcall->issuer, rdv, task_size, rate, src_buff,
+ src_buff_size, match_fun, clean_fun, data, detached);
+
+}
smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
double task_size, double rate,
void *src_buff, size_t src_buff_size,
return (detached ? NULL : other_action);
}
+void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data, double timeout){
+ smx_action_t comm = SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff,
+ dst_buff_size, match_fun, data);
+ simcall->mc_value = 0;
+ SIMIX_pre_comm_wait(simcall, comm, timeout);
+}
+smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data){
+ return SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, dst_buff_size,
+ match_fun, data);
+}
smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
void *dst_buff, size_t *dst_buff_size,
int (*match_fun)(void *, void *, smx_action_t), void *data)
return other_action;
}
+smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
+ int src, int tag,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data){
+ return SIMIX_comm_iprobe(simcall->issuer, rdv, src, tag, match_fun, data);
+}
smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
int tag, int (*match_fun)(void *, void *, smx_action_t), void *data)
return other_action;
}
-void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx)
+void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout)
{
-
+ int idx = simcall->mc_value;
/* the simcall may be a wait, a send or a recv */
surf_action_t sleep;
}
}
-void SIMIX_pre_comm_test(smx_simcall_t simcall)
+void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action)
{
- smx_action_t action = simcall->comm_test.comm;
-
if(MC_is_active()){
- simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
- if(simcall->comm_test.result){
+ simcall_comm_test__set__result(simcall, action->comm.src_proc && action->comm.dst_proc);
+ if(simcall_comm_test__get__result(simcall)){
action->state = SIMIX_DONE;
xbt_fifo_push(action->simcalls, simcall);
SIMIX_comm_finish(action);
return;
}
- simcall->comm_test.result = (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING);
- if (simcall->comm_test.result) {
+ simcall_comm_test__set__result(simcall, (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING));
+ if (simcall_comm_test__get__result(simcall)) {
xbt_fifo_push(action->simcalls, simcall);
SIMIX_comm_finish(action);
} else {
}
}
-void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx)
+void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions)
{
+ int idx = simcall->mc_value;
unsigned int cursor;
smx_action_t action;
- xbt_dynar_t actions = simcall->comm_testany.comms;
- simcall->comm_testany.result = -1;
+ simcall_comm_testany__set__result(simcall, -1);
if (MC_is_active()){
if(idx == -1){
SIMIX_simcall_answer(simcall);
}else{
action = xbt_dynar_get_as(actions, idx, smx_action_t);
- simcall->comm_testany.result = idx;
+ simcall_comm_testany__set__result(simcall, idx);
xbt_fifo_push(action->simcalls, simcall);
action->state = SIMIX_DONE;
SIMIX_comm_finish(action);
return;
}
- xbt_dynar_foreach(simcall->comm_testany.comms,cursor,action) {
+ xbt_dynar_foreach(simcall_comm_testany__get__comms(simcall), cursor,action) {
if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) {
- simcall->comm_testany.result = cursor;
+ simcall_comm_testany__set__result(simcall, cursor);
xbt_fifo_push(action->simcalls, simcall);
SIMIX_comm_finish(action);
return;
SIMIX_simcall_answer(simcall);
}
-void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx)
+void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions)
{
+ int idx = simcall->mc_value;
smx_action_t action;
unsigned int cursor = 0;
- xbt_dynar_t actions = simcall->comm_waitany.comms;
if (MC_is_active()){
action = xbt_dynar_get_as(actions, idx, smx_action_t);
xbt_fifo_push(action->simcalls, simcall);
- simcall->comm_waitany.result = idx;
+ simcall_comm_waitany__set__result(simcall, idx);
action->state = SIMIX_DONE;
SIMIX_comm_finish(action);
return;
{
smx_action_t action;
unsigned int cursor = 0;
- xbt_dynar_t actions = simcall->comm_waitany.comms;
+ xbt_dynar_t actions = simcall_comm_waitany__get__comms(simcall);
xbt_dynar_foreach(actions, cursor, action) {
xbt_fifo_remove(action->simcalls, simcall);
if (simcall->call == SIMCALL_COMM_WAITANY) {
SIMIX_waitany_remove_simcall_from_actions(simcall);
if (!MC_is_active())
- simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action);
+ simcall_comm_waitany__set__result(simcall, xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &action));
}
/* If the action is still in a rendez-vous point then remove from it */
/* if there is an exception during a waitany or a testany, indicate the position of the failed communication */
if (simcall->issuer->doexception) {
if (simcall->call == SIMCALL_COMM_WAITANY) {
- simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall->comm_waitany.comms, &action);
+ simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &action);
}
else if (simcall->call == SIMCALL_COMM_TESTANY) {
- simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall->comm_testany.comms, &action);
+ simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall_comm_testany__get__comms(simcall), &action);
}
}
}
}
+void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action){
+ SIMIX_comm_cancel(action);
+}
void SIMIX_comm_cancel(smx_action_t action)
{
/* if the action is a waiting state means that it is still in a rdv */
/************* Action Getters **************/
+double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_remains(action);
+}
/**
* \brief get the amount remaining from the communication
* \param action The communication
return remains;
}
+e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_state(action);
+}
e_smx_state_t SIMIX_comm_get_state(smx_action_t action)
{
return action->state;
}
+void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_src_data(action);
+}
/**
* \brief Return the user data associated to the sender of the communication
* \param action The communication
return action->comm.src_data;
}
+void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_dst_data(action);
+}
/**
* \brief Return the user data associated to the receiver of the communication
* \param action The communication
return action->comm.dst_data;
}
+smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_src_proc(action);
+}
smx_process_t SIMIX_comm_get_src_proc(smx_action_t action)
{
return action->comm.src_proc;
}
+smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action){
+ return SIMIX_comm_get_dst_proc(action);
+}
smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action)
{
return action->comm.dst_proc;
int (*)(void *, void *, smx_action_t), void *data);
void SIMIX_comm_destroy(smx_action_t action);
void SIMIX_comm_destroy_internal_actions(smx_action_t action);
-void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx);
smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
int tag, int (*match_fun)(void *, void *, smx_action_t), void *data);
-void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx);
+void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout);
+void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions);
void SIMIX_post_comm(smx_action_t action);
-void SIMIX_pre_comm_test(smx_simcall_t simcall);
-void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx);
+void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action);
+void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions);
void SIMIX_comm_cancel(smx_action_t action);
double SIMIX_comm_get_remains(smx_action_t action);
e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
smx_process_t SIMIX_comm_get_src_proc(smx_action_t action);
smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
+// pre prototypes
+smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
+ int src, int tag,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data);
+smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name);
+void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv);
+smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name);
+int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host);
+smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv);
+smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv);
+void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv,
+ smx_process_t process);
+void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *data, double timeout);
+smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
+ double task_size, double rate,
+ void *src_buff, size_t src_buff_size,
+ int (*match_fun)(void *, void *,smx_action_t),
+ void (*clean_fun)(void *),
+ void *data, int detached);
+void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data, double timeout);
+smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv,
+ void *dst_buff, size_t *dst_buff_size,
+ int (*match_fun)(void *, void *, smx_action_t),
+ void *data);
+void SIMIX_pre_comm_destroy(smx_simcall_t simcall, smx_action_t action);
+void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action);
+double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action);
+e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action);
+void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action);
+void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action);
+smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action);
+smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action);
#endif
return xbt_fifo_size(process->comms) > 0;
}
+void SIMIX_pre_process_cleanup(smx_simcall_t simcall, smx_process_t process) {
+ SIMIX_process_cleanup(process);
+}
/**
* \brief Moves a process to the list of processes to destroy.
*/
return process;
}
+
+void SIMIX_pre_process_create(smx_simcall_t simcall,
+ smx_process_t *process,
+ const char *name,
+ xbt_main_func_t code,
+ void *data,
+ const char *hostname,
+ double kill_time,
+ int argc, char **argv,
+ xbt_dict_t properties,
+ int auto_restart){
+ return SIMIX_process_create(process, name, code, data, hostname,
+ kill_time, argc, argv, properties, auto_restart);
+}
/**
* \brief Internal function to create a process.
*
xbt_dynar_reset(simix_global->process_to_run);
}
+void SIMIX_pre_process_kill(smx_simcall_t simcall, smx_process_t process) {
+ SIMIX_process_kill(process, simcall->issuer);
+}
/**
* \brief Internal function to kill a SIMIX process.
*
}
+void SIMIX_pre_process_killall(smx_simcall_t simcall) {
+ SIMIX_process_killall(simcall->issuer);
+}
/**
* \brief Kills all running processes.
* \param issuer this one will not be killed
SIMIX_process_empty_trash();
}
+void SIMIX_pre_process_change_host(smx_simcall_t simcall, smx_process_t process,
+ smx_host_t dest)
+{
+ process->new_host = dest;
+}
void SIMIX_process_change_host(smx_process_t process,
smx_host_t dest)
{
xbt_swag_insert(process, dest->process_list);
}
-void SIMIX_pre_process_change_host(smx_process_t process, smx_host_t dest)
-{
- process->new_host = dest;
-}
-void SIMIX_pre_process_suspend(smx_simcall_t simcall)
+void SIMIX_pre_process_suspend(smx_simcall_t simcall, smx_process_t process)
{
- smx_process_t process = simcall->process_suspend.process;
smx_action_t action_suspend =
SIMIX_process_suspend(process, simcall->issuer);
}
}
+void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process){
+ SIMIX_process_resume(process, simcall->issuer);
+}
+
void SIMIX_process_resume(smx_process_t process, smx_process_t issuer)
{
xbt_assert((process != NULL), "Invalid parameters");
return simix_process_maxpid;
}
+int SIMIX_pre_process_count(smx_simcall_t simcall){
+ return SIMIX_process_count();
+}
int SIMIX_process_count(void)
{
return xbt_swag_size(simix_global->process_list);
}
+void* SIMIX_pre_process_self_get_data(smx_simcall_t simcall, smx_process_t self){
+ return SIMIX_process_self_get_data(self);
+}
+
void* SIMIX_process_self_get_data(smx_process_t self)
{
xbt_assert(self == SIMIX_process_self(), "This is not the current process");
return SIMIX_process_get_data(self);
}
+void SIMIX_pre_process_set_data(smx_simcall_t simcall, smx_process_t process,
+ void *data){
+ SIMIX_process_set_data(process, data);
+}
void SIMIX_process_self_set_data(smx_process_t self, void *data)
{
xbt_assert(self == SIMIX_process_self(), "This is not the current process");
SIMIX_process_set_data(self, data);
}
+void* SIMIX_pre_process_get_data(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_get_data(process);
+}
void* SIMIX_process_get_data(smx_process_t process)
{
return process->data;
process->data = data;
}
+smx_host_t SIMIX_pre_process_get_host(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_get_host(process);
+}
smx_host_t SIMIX_process_get_host(smx_process_t process)
{
return process->smx_host;
return SIMIX_process_get_name(process);
}
+const char* SIMIX_pre_process_get_name(smx_simcall_t simcall, smx_process_t process) {
+ return SIMIX_process_get_name(process);
+}
const char* SIMIX_process_get_name(smx_process_t process)
{
return process->name;
return NULL;
}
+int SIMIX_pre_process_is_suspended(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_is_suspended(process);
+}
int SIMIX_process_is_suspended(smx_process_t process)
{
return process->suspended;
}
+xbt_dict_t SIMIX_pre_process_get_properties(smx_simcall_t simcall, smx_process_t process){
+ return SIMIX_process_get_properties(process);
+}
xbt_dict_t SIMIX_process_get_properties(smx_process_t process)
{
return process->properties;
}
-void SIMIX_pre_process_sleep(smx_simcall_t simcall)
+void SIMIX_pre_process_sleep(smx_simcall_t simcall, double duration)
{
if (MC_is_active()) {
- MC_process_clock_add(simcall->issuer, simcall->process_sleep.duration);
- simcall->process_sleep.result = SIMIX_DONE;
+ MC_process_clock_add(simcall->issuer, duration);
+ simcall_process_sleep__set__result(simcall, SIMIX_DONE);
SIMIX_simcall_answer(simcall);
return;
}
- smx_action_t action = SIMIX_process_sleep(simcall->issuer, simcall->process_sleep.duration);
+ smx_action_t action = SIMIX_process_sleep(simcall->issuer, duration);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
workstation.get_state(simcall->issuer->smx_host->host) != SURF_RESOURCE_ON) {
simcall->issuer->context->iwannadie = 1;
}
- simcall->process_sleep.result = state;
+ simcall_process_sleep__set__result(simcall, state);
simcall->issuer->waiting_action = NULL;
SIMIX_simcall_answer(simcall);
}
return res;
}
+
+
void SIMIX_process_on_exit_runall(smx_process_t process) {
s_smx_process_exit_fun_t exit_fun;
(exit_fun.fun)(exit_fun.arg);
}
}
+
+void SIMIX_pre_process_on_exit(smx_simcall_t simcall, smx_process_t process,
+ int_f_pvoid_t fun, void *data) {
+ SIMIX_process_on_exit(process, fun, data);
+}
+
void SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data) {
xbt_assert(process, "current process not found: are you in maestro context ?");
xbt_dynar_push_as(process->on_exit,s_smx_process_exit_fun_t,exit_fun);
}
+
+void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process,
+ int auto_restart) {
+ SIMIX_process_auto_restart_set(process, auto_restart);
+}
/**
* \brief Sets the auto-restart status of the process.
* If set to 1, the process will be automatically restarted when its host
void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart) {
process->auto_restart = auto_restart;
}
+
+smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process) {
+ return SIMIX_process_restart(process, simcall->issuer);
+}
/**
* \brief Restart a process.
* Restart a process, starting it again from the beginning.
void SIMIX_process_yield(smx_process_t self);
xbt_running_ctx_t *SIMIX_process_get_running_context(void);
void SIMIX_process_exception_terminate(xbt_ex_t * e);
-void SIMIX_pre_process_change_host(smx_process_t process,
+void SIMIX_pre_process_change_host(smx_simcall_t, smx_process_t process,
smx_host_t dest);
void SIMIX_process_change_host(smx_process_t process,
smx_host_t dest);
-void SIMIX_pre_process_change_host(smx_process_t process, smx_host_t host);
-void SIMIX_pre_process_suspend(smx_simcall_t simcall);
+void SIMIX_pre_process_suspend(smx_simcall_t simcall, smx_process_t process);
smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer);
void SIMIX_process_resume(smx_process_t process, smx_process_t issuer);
void* SIMIX_process_get_data(smx_process_t process);
smx_process_t SIMIX_process_get_by_name(const char* name);
int SIMIX_process_is_suspended(smx_process_t process);
xbt_dict_t SIMIX_process_get_properties(smx_process_t process);
-void SIMIX_pre_process_sleep(smx_simcall_t simcall);
+void SIMIX_pre_process_sleep(smx_simcall_t simcall, double duration);
smx_action_t SIMIX_process_sleep(smx_process_t process, double duration);
void SIMIX_post_process_sleep(smx_action_t action);
void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart);
smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer);
+// pre prototypes
+void SIMIX_pre_process_create(smx_simcall_t simcall, smx_process_t *process,
+ const char *name, xbt_main_func_t code, void *data,
+ const char *hostname, double kill_time, int argc,
+ char **argv, xbt_dict_t properties, int auto_restart);
+void SIMIX_pre_process_kill(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_killall(smx_simcall_t simcall);
+void SIMIX_pre_process_cleanup(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process);
+int SIMIX_pre_process_count(smx_simcall_t simcall);
+void* SIMIX_pre_process_self_get_data(smx_simcall_t simcall, smx_process_t process);
+void* SIMIX_pre_process_get_data(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_set_data(smx_simcall_t simcall, smx_process_t process,
+ void *data);
+smx_host_t SIMIX_pre_process_get_host(smx_simcall_t simcall, smx_process_t process);
+const char* SIMIX_pre_process_get_name(smx_simcall_t simcall, smx_process_t process);
+int SIMIX_pre_process_is_suspended(smx_simcall_t simcall, smx_process_t process);
+xbt_dict_t SIMIX_pre_process_get_properties(smx_simcall_t simcall, smx_process_t process);
+void SIMIX_pre_process_on_exit(smx_simcall_t simcall, smx_process_t process,
+ int_f_pvoid_t fun, void *data);
+void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process,
+ int auto_restart);
+smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process);
#endif
void SIMIX_simcall_pre(smx_simcall_t simcall, int value)
{
XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
-
+ simcall->mc_value = value;
switch (simcall->call) {
- case SIMCALL_COMM_TEST:
- SIMIX_pre_comm_test(simcall);
- break;
-
- case SIMCALL_COMM_TESTANY:
- SIMIX_pre_comm_testany(simcall, value);
- break;
-
- case SIMCALL_COMM_WAIT:
- SIMIX_pre_comm_wait(simcall,
- simcall->comm_wait.comm,
- simcall->comm_wait.timeout,
- value);
- break;
-
- case SIMCALL_COMM_WAITANY:
- SIMIX_pre_comm_waitany(simcall, value);
- break;
-
- case SIMCALL_COMM_SEND:
- {
- smx_action_t comm = SIMIX_comm_isend(
- simcall->issuer,
- simcall->comm_send.rdv,
- simcall->comm_send.task_size,
- simcall->comm_send.rate,
- simcall->comm_send.src_buff,
- simcall->comm_send.src_buff_size,
- simcall->comm_send.match_fun,
- NULL, /* no clean function since it's not detached */
- simcall->comm_send.data,
- 0);
- SIMIX_pre_comm_wait(simcall, comm, simcall->comm_send.timeout, 0);
- break;
- }
-
- case SIMCALL_COMM_ISEND:
- simcall->comm_isend.result = SIMIX_comm_isend(
- simcall->issuer,
- simcall->comm_isend.rdv,
- simcall->comm_isend.task_size,
- simcall->comm_isend.rate,
- simcall->comm_isend.src_buff,
- simcall->comm_isend.src_buff_size,
- simcall->comm_isend.match_fun,
- simcall->comm_isend.clean_fun,
- simcall->comm_isend.data,
- simcall->comm_isend.detached);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_RECV:
- {
- smx_action_t comm = SIMIX_comm_irecv(
- simcall->issuer,
- simcall->comm_recv.rdv,
- simcall->comm_recv.dst_buff,
- simcall->comm_recv.dst_buff_size,
- simcall->comm_recv.match_fun,
- simcall->comm_recv.data);
- SIMIX_pre_comm_wait(simcall, comm, simcall->comm_recv.timeout, 0);
- break;
- }
-
- case SIMCALL_COMM_IRECV:
- simcall->comm_irecv.result = SIMIX_comm_irecv(
- simcall->issuer,
- simcall->comm_irecv.rdv,
- simcall->comm_irecv.dst_buff,
- simcall->comm_irecv.dst_buff_size,
- simcall->comm_irecv.match_fun,
- simcall->comm_irecv.data);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_IPROBE:
- simcall->comm_iprobe.result = SIMIX_comm_iprobe(
- simcall->issuer,
- simcall->comm_iprobe.rdv,
- simcall->comm_iprobe.src,
- simcall->comm_iprobe.tag,
- simcall->comm_iprobe.match_fun,
- simcall->comm_iprobe.data);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_DESTROY:
- SIMIX_comm_destroy(simcall->comm_destroy.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_CANCEL:
- SIMIX_comm_cancel(simcall->comm_cancel.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_REMAINS:
- simcall->comm_get_remains.result =
- SIMIX_comm_get_remains(simcall->comm_get_remains.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_STATE:
- simcall->comm_get_state.result =
- SIMIX_comm_get_state(simcall->comm_get_state.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_SRC_DATA:
- simcall->comm_get_src_data.result = SIMIX_comm_get_src_data(simcall->comm_get_src_data.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_DST_DATA:
- simcall->comm_get_dst_data.result = SIMIX_comm_get_dst_data(simcall->comm_get_dst_data.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_SRC_PROC:
- simcall->comm_get_src_proc.result =
- SIMIX_comm_get_src_proc(simcall->comm_get_src_proc.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COMM_GET_DST_PROC:
- simcall->comm_get_dst_proc.result =
- SIMIX_comm_get_dst_proc(simcall->comm_get_dst_proc.comm);
- SIMIX_simcall_answer(simcall);
- break;
-
-#ifdef HAVE_LATENCY_BOUND_TRACKING
- case SIMCALL_COMM_IS_LATENCY_BOUNDED:
- simcall->comm_is_latency_bounded.result =
- SIMIX_comm_is_latency_bounded(simcall->comm_is_latency_bounded.comm);
- SIMIX_simcall_answer(simcall);
- break;
-#endif
-
- case SIMCALL_RDV_CREATE:
- simcall->rdv_create.result = SIMIX_rdv_create(simcall->rdv_create.name);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_DESTROY:
- SIMIX_rdv_destroy(simcall->rdv_destroy.rdv);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_GEY_BY_NAME:
- simcall->rdv_get_by_name.result =
- SIMIX_rdv_get_by_name(simcall->rdv_get_by_name.name);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_COMM_COUNT_BY_HOST:
- simcall->rdv_comm_count_by_host.result = SIMIX_rdv_comm_count_by_host(
- simcall->rdv_comm_count_by_host.rdv,
- simcall->rdv_comm_count_by_host.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_GET_HEAD:
- simcall->rdv_get_head.result = SIMIX_rdv_get_head(simcall->rdv_get_head.rdv);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_SET_RECV:
- SIMIX_rdv_set_receiver(simcall->rdv_set_rcv_proc.rdv, simcall->rdv_set_rcv_proc.receiver);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_RDV_GET_RECV:
- simcall->rdv_get_rcv_proc.result = SIMIX_rdv_get_receiver(simcall->rdv_set_rcv_proc.rdv);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_BY_NAME:
- simcall->host_get_by_name.result =
- SIMIX_host_get_by_name(simcall->host_get_by_name.name);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_NAME:
- simcall->host_get_name.result = SIMIX_host_get_name(simcall->host_get_name.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_PROPERTIES:
- simcall->host_get_properties.result =
- SIMIX_host_get_properties(simcall->host_get_properties.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_SPEED:
- simcall->host_get_speed.result =
- SIMIX_host_get_speed(simcall->host_get_speed.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_AVAILABLE_SPEED:
- simcall->host_get_available_speed.result =
- SIMIX_host_get_available_speed(simcall->host_get_available_speed.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_STATE:
- simcall->host_get_state.result =
- SIMIX_host_get_state(simcall->host_get_state.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_GET_DATA:
- simcall->host_get_data.result = SIMIX_host_get_data(simcall->host_get_data.host);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_SET_DATA:
- SIMIX_host_set_data(simcall->host_set_data.host, simcall->host_set_data.data);
- SIMIX_simcall_answer(simcall);
- 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);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_PARALLEL_EXECUTE:
- simcall->host_parallel_execute.result = SIMIX_host_parallel_execute(
- simcall->host_parallel_execute.name,
- simcall->host_parallel_execute.host_nb,
- simcall->host_parallel_execute.host_list,
- simcall->host_parallel_execute.computation_amount,
- simcall->host_parallel_execute.communication_amount,
- simcall->host_parallel_execute.amount,
- simcall->host_parallel_execute.rate);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_DESTROY:
- SIMIX_host_execution_destroy(simcall->host_execution_destroy.execution);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_CANCEL:
- SIMIX_host_execution_cancel(simcall->host_execution_cancel.execution);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_GET_REMAINS:
- simcall->host_execution_get_remains.result =
- SIMIX_host_execution_get_remains(simcall->host_execution_get_remains.execution);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_GET_STATE:
- simcall->host_execution_get_state.result =
- SIMIX_host_execution_get_state(simcall->host_execution_get_state.execution);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_SET_PRIORITY:
- SIMIX_host_execution_set_priority(
- simcall->host_execution_set_priority.execution,
- simcall->host_execution_set_priority.priority);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_HOST_EXECUTION_WAIT:
- SIMIX_pre_host_execution_wait(simcall);
- break;
-
- case SIMCALL_PROCESS_CREATE:
- SIMIX_process_create(
- simcall->process_create.process,
- simcall->process_create.name,
- simcall->process_create.code,
- simcall->process_create.data,
- simcall->process_create.hostname,
- simcall->process_create.kill_time,
- simcall->process_create.argc,
- simcall->process_create.argv,
- simcall->process_create.properties,
- simcall->process_create.auto_restart);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_KILL:
- SIMIX_process_kill(simcall->process_kill.process,simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_KILLALL:
- SIMIX_process_killall(simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_CLEANUP:
- SIMIX_process_cleanup(simcall->process_cleanup.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_CHANGE_HOST:
- SIMIX_pre_process_change_host(
- simcall->process_change_host.process,
- simcall->process_change_host.dest);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_SUSPEND:
- SIMIX_pre_process_suspend(simcall);
- break;
-
- case SIMCALL_PROCESS_RESUME:
- SIMIX_process_resume(simcall->process_resume.process, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_COUNT:
- simcall->process_count.result = SIMIX_process_count();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_DATA:
- simcall->process_get_data.result =
- SIMIX_process_get_data(simcall->process_get_data.process);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_ON_EXIT:
- SIMIX_process_on_exit(simcall->process_on_exit.process,
- simcall->process_on_exit.fun,
- simcall->process_on_exit.data);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_RESTART:
- simcall->process_restart.result = SIMIX_process_restart(simcall->process_restart.process, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_AUTO_RESTART_SET:
- SIMIX_process_auto_restart_set(simcall->process_auto_restart.process,simcall->process_auto_restart.auto_restart);
- SIMIX_simcall_answer(simcall);
- break;
- case SIMCALL_PROCESS_SET_DATA:
- SIMIX_process_set_data(
- simcall->process_set_data.process,
- simcall->process_set_data.data);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_HOST:
- simcall->process_get_host.result = SIMIX_process_get_host(simcall->process_get_host.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_NAME:
- simcall->process_get_name.result = SIMIX_process_get_name(simcall->process_get_name.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_IS_SUSPENDED:
- simcall->process_is_suspended.result =
- SIMIX_process_is_suspended(simcall->process_is_suspended.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_GET_PROPERTIES:
- simcall->process_get_properties.result =
- SIMIX_process_get_properties(simcall->process_get_properties.process);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_PROCESS_SLEEP:
- SIMIX_pre_process_sleep(simcall);
- break;
-
-#ifdef HAVE_TRACING
- case SIMCALL_SET_CATEGORY:
- SIMIX_set_category(
- simcall->set_category.action,
- simcall->set_category.category);
- SIMIX_simcall_answer(simcall);
- break;
-#endif
-
- case SIMCALL_MUTEX_INIT:
- simcall->mutex_init.result = SIMIX_mutex_init();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MUTEX_DESTROY:
- SIMIX_mutex_destroy(simcall->mutex_destroy.mutex);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MUTEX_LOCK:
- SIMIX_pre_mutex_lock(simcall);
- break;
-
- case SIMCALL_MUTEX_TRYLOCK:
- simcall->mutex_trylock.result =
- SIMIX_mutex_trylock(simcall->mutex_trylock.mutex, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_MUTEX_UNLOCK:
- SIMIX_mutex_unlock(simcall->mutex_unlock.mutex, simcall->issuer);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_INIT:
- simcall->cond_init.result = SIMIX_cond_init();
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_DESTROY:
- SIMIX_cond_destroy(simcall->cond_destroy.cond);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_SIGNAL:
- SIMIX_cond_signal(simcall->cond_signal.cond);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_COND_WAIT:
- SIMIX_pre_cond_wait(simcall);
- break;
-
- case SIMCALL_COND_WAIT_TIMEOUT:
- SIMIX_pre_cond_wait_timeout(simcall);
- break;
-
- case SIMCALL_COND_BROADCAST:
- SIMIX_cond_broadcast(simcall->cond_broadcast.cond);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_INIT:
- simcall->sem_init.result = SIMIX_sem_init(simcall->sem_init.capacity);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_DESTROY:
- SIMIX_sem_destroy(simcall->sem_destroy.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_RELEASE:
- SIMIX_sem_release(simcall->sem_release.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_WOULD_BLOCK:
- simcall->sem_would_block.result =
- SIMIX_sem_would_block(simcall->sem_would_block.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_SEM_ACQUIRE:
- SIMIX_pre_sem_acquire(simcall);
- break;
-
- case SIMCALL_SEM_ACQUIRE_TIMEOUT:
- SIMIX_pre_sem_acquire_timeout(simcall);
- break;
-
- case SIMCALL_SEM_GET_CAPACITY:
- simcall->sem_get_capacity.result =
- SIMIX_sem_get_capacity(simcall->sem_get_capacity.sem);
- SIMIX_simcall_answer(simcall);
- break;
-
- case SIMCALL_FILE_READ:
- SIMIX_pre_file_read(simcall);
- break;
-
- case SIMCALL_FILE_WRITE:
- SIMIX_pre_file_write(simcall);
- break;
-
- case SIMCALL_FILE_OPEN:
- SIMIX_pre_file_open(simcall);
- break;
-
- case SIMCALL_FILE_CLOSE:
- SIMIX_pre_file_close(simcall);
- break;
-
- case SIMCALL_FILE_STAT:
- SIMIX_pre_file_stat(simcall);
- break;
-
- case SIMCALL_FILE_UNLINK:
- SIMIX_pre_file_unlink(simcall);
- break;
-
- case SIMCALL_FILE_LS:
- SIMIX_pre_file_ls(simcall);
+SIMCALL_LIST(SIMCALL_CASE, SIMCALL_SEP_NOTHING)
+ case NUM_SIMCALLS:;
break;
-
- case SIMCALL_ASR_GET_PROPERTIES:
- simcall->asr_get_properties.result =
- SIMIX_asr_get_properties(simcall->asr_get_properties.name);
- 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:
+ case SIMCALL_NONE:;
THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
SIMIX_process_get_name(simcall->issuer),
SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))
break;
}
}
+
+/* New Simcal interface */
+
+/* FIXME: add types for every simcall */
+//const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" };
+/* FIXME find a way to make this work
+simcall_handler_t simcall_table[NUM_SIMCALLS] = {
+#undef SIMCALL_ENUM_ELEMENT
+#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values
+SIMCALL_LIST
+#undef SIMCALL_ENUM_ELEMENT
+};*/
+
+/* New Simcal interface */
+
+/* FIXME: add types for every simcall */
+//const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p", [SIMCALL_HOST_EXECUTION_WAIT] = "%p%p" };
+
+
+/*TOFIX find a way to make this work
+simcall_handler_t simcall_table[NUM_SIMCALLS] = {
+#undef SIMCALL_ENUM_ELEMENT
+#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values
+SIMCALL_LIST
+#undef SIMCALL_ENUM_ELEMENT
+};*/
+
+smx_simcall_t __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);
+ }
+ return &(self->simcall);
+}
/********************************* Simcalls *********************************/
-/* we want to build the e_smx_simcall_t enumeration and the table of the
- * corresponding strings automatically, using macros */
-
-#define SIMCALL_LIST1 \
-SIMCALL_ENUM_ELEMENT(SIMCALL_NONE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_BY_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_PROPERTIES),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_SPEED),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_AVAILABLE_SPEED),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_STATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_GET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_SET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_PARALLEL_EXECUTE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_CANCEL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_REMAINS),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_GET_STATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_SET_PRIORITY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_HOST_EXECUTION_WAIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CREATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_KILLALL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CLEANUP),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_CHANGE_HOST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SUSPEND),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESUME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_COUNT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SET_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_HOST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_IS_SUSPENDED),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_GET_PROPERTIES),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_SLEEP),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_ON_EXIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_AUTO_RESTART_SET),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_PROCESS_RESTART),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_CREATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GEY_BY_NAME),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_COMM_COUNT_BY_HOST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_HEAD),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_SET_RECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_RDV_GET_RECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_SEND),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_ISEND),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_RECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IRECV),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_CANCEL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAITANY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_WAIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TEST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_TESTANY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IPROBE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_REMAINS),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_STATE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_DATA),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_SRC_PROC),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_GET_DST_PROC),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_INIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_LOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_TRYLOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_MUTEX_UNLOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_INIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_SIGNAL),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_WAIT_TIMEOUT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_COND_BROADCAST),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_INIT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_DESTROY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_RELEASE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_WOULD_BLOCK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_ACQUIRE_TIMEOUT),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_SEM_GET_CAPACITY),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_READ),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_WRITE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_OPEN),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_CLOSE),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_STAT), \
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_UNLINK),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_FILE_LS),\
-SIMCALL_ENUM_ELEMENT(SIMCALL_ASR_GET_PROPERTIES), \
-/* ****************************************************************************************** */ \
-/* TUTORIAL: New API */ \
-/* ****************************************************************************************** */ \
-SIMCALL_ENUM_ELEMENT(SIMCALL_NEW_API_INIT)
+/* we want to build the e_smx_simcall_t enumeration, the table of the
+ * corresponding simcalls string names, and the simcall handlers table
+ * automatically, using macros.
+ * To add a new simcall follow the following syntax:
+ *
+ * SIMCALL_ENUM_ELEMENT(<simcall_enumeration_id>, <simcall_handler_function>)
+ *
+ * */
+
+/****************************
+ * SIMCALL GENERATING MACRO *
+ ****************************
+ *
+ * action(ENUM_NAME, func_name, result_type, params…)
+ *
+ **/
+
+/*
+ * Some macro machinery to get a MAP over the arguments of a variadic macro.
+ * It uses a FOLD to apply a macro to every argument, and because there is
+ * no recursion in the C preprocessor we must create a new macro for every
+ * depth of FOLD's recursion.
+ */
+/* FOLD macro */
+#define FE_0(WHAT, X, ...)
+#define FE_1(I, WHAT, X) WHAT(I, X)
+#define FE_2(I, WHAT, X, ...) WHAT(I, X), FE_1(I+1, WHAT, __VA_ARGS__)
+#define FE_3(I, WHAT, X, ...) WHAT(I, X), FE_2(I+1, WHAT, __VA_ARGS__)
+#define FE_4(I, WHAT, X, ...) WHAT(I, X), FE_3(I+1, WHAT, __VA_ARGS__)
+#define FE_5(I, WHAT, X, ...) WHAT(I, X), FE_4(I+1, WHAT, __VA_ARGS__)
+#define FE_6(I, WHAT, X, ...) WHAT(I, X), FE_5(I+1, WHAT, __VA_ARGS__)
+#define FE_7(I, WHAT, X, ...) WHAT(I, X), FE_6(I+1, WHAT, __VA_ARGS__)
+#define FE_8(I, WHAT, X, ...) WHAT(I, X), FE_7(I+1, WHAT, __VA_ARGS__)
+#define FE_9(I, WHAT, X, ...) WHAT(I, X), FE_8(I+1, WHAT, __VA_ARGS__)
+#define FE_10(I, WHAT, X, ...) WHAT(I, X), FE_9(I+1, WHAT, __VA_ARGS__)
+
+/* NOTE: add as many FE_n as needed (maximum number of simcall arguments )*/
+
+/* Make a MAP macro usgin FOLD (will apply 'action' to the arguments.
+ * GET_MACRO is a smart hack that counts the number of arguments passed to
+ * the variadic macro, and it is used to invoke the right FOLD depth.
+ */
+#define GET_MACRO(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
+#define MAP(action, ...) \
+ GET_MACRO(, ##__VA_ARGS__, FE_10,FE_9,FE_8,FE_7,FE_6,FE_5,FE_4,FE_3,FE_2,FE_1, FE_0) (0, action, __VA_ARGS__)
+
+/* MAP with default arguments */
+#define APPLY_MAP(WHAT, I, X, ...) WHAT(I, __VA_ARGS__, X)
+#define FE_DA_0(I, WHAT, args, X, ...)
+#define FE_DA_1(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args)
+#define FE_DA_2(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_1(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_3(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_2(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_4(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_3(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_5(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_4(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_6(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_5(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_7(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_6(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_8(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_7(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_9(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_8(I+1, WHAT, args, __VA_ARGS__)
+#define FE_DA_10(I, WHAT, args, X, ...) APPLY_MAP(WHAT, I, X, args) FE_DA_9(I+1, WHAT, args, __VA_ARGS__)
+
+#define MAP_WITH_DEFAULT_ARGS(action, args, ...) \
+ GET_MACRO(, ##__VA_ARGS__, FE_DA_10,FE_DA_9,FE_DA_8,FE_DA_7,FE_DA_6,FE_DA_5,FE_DA_4,FE_DA_3,FE_DA_2,FE_DA_1, FE_DA_0) (0, action, args, __VA_ARGS__)
+
+/*
+ * Define scalar type wrappers to ease the use of simcalls.
+ * These are used to wrap the arguments in SIMIX_simcall macro.
+ */
+#define TCHAR(n) (n, char, c)
+#define TSTRING(n) (n, const char*, cc)
+#define TSHORT(n) (n, short, s)
+#define TINT(n) (n, int, i)
+#define TLONG(n) (n, long, l)
+#define TUCHAR(n) (n, unsigned char, uc)
+#define TUSHORT(n) (n, unsigned short, us)
+#define TUINT(n) (n, unsigned int, ui)
+#define TULONG(n) (n, unsigned long, ul)
+#define TFLOAT(n) (n, float, f)
+#define TDOUBLE(n) (n, double, d)
+#define TPTR(n) (n, void*, p)
+#define TCPTR(n) (n, const void*, cp)
+#define TSIZE(n) (n, size_t, si)
+#define TVOID(n) (n, void)
+#define TSPEC(n,t) (n, t, p)
+
+/* use comma or nothing to separate elements*/
+#define SIMCALL_SEP_COMMA ,
+#define SIMCALL_SEP_NOTHING
+
+/* get the name of the parameter */
+#define SIMCALL_NAME_(name, type, field) name
+#define SIMCALL_NAME(i, v) SIMCALL_NAME_ v
+
+/* get the %s format code of the parameter */
+#define SIMCALL_FORMAT_(name, type, field) %field
+#define SIMCALL_FORMAT(i, v) SIMCALL_FORMAT_ v
+
+/* get the field of the parameter */
+#define SIMCALL_FIELD_(name, type, field) field
+#define SIMCALL_FIELD(i, v) SIMCALL_FIELD_ v
+
+/* get the parameter declaration */
+#define SIMCALL_ARG_(name, type, field) type name
+#define SIMCALL_ARG(i, v) SIMCALL_ARG_ v
+
+/* get the parameter initialisation field */
+#define SIMCALL_INIT_FIELD_(name, type, field) {.field = name}
+#define SIMCALL_INIT_FIELD(i, v) SIMCALL_INIT_FIELD_ v
+
+/* get the case of the parameter */
+#define SIMCALL_CASE_PARAM_(name, type, field) field
+#define SIMCALL_CASE_PARAM(i, v) simcall->args[i].SIMCALL_CASE_PARAM_ v
+
+/* generate some code for SIMCALL_CASE if the simcall has an answer */
+#define MAYBE2(_0, _1, func, ...) func
+
+#define SIMCALL_WITH_RESULT_BEGIN(name, type, field) simcall->result.field =
+#define SIMCALL_WITHOUT_RESULT_BEGIN(name, type, field)
+#define SIMCALL_RESULT_BEGIN_(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_RESULT_BEGIN, SIMCALL_WITHOUT_RESULT_BEGIN)\
+ (name, type, __VA_ARGS__)
+#define SIMCALL_RESULT_BEGIN(answer, res) answer(SIMCALL_RESULT_BEGIN_ res)
+
+#define SIMCALL_RESULT_END_(name, type, ...)\
+ SIMIX_simcall_answer(simcall);
+#define SIMCALL_RESULT_END(answer, res) answer(SIMCALL_RESULT_END_ res)
+
+/* generate some code for BODY function */
+#define SIMCALL_FUNC_RETURN_TYPE_(name, type, ...) type
+#define SIMCALL_FUNC_RETURN_TYPE(res) SIMCALL_FUNC_RETURN_TYPE_ res
+
+#define SIMCALL_WITH_FUNC_SIMCALL(name, type, field) smx_simcall_t simcall =
+#define SIMCALL_WITHOUT_FUNC_SIMCALL(name, type, field)
+#define SIMCALL_FUNC_SIMCALL_(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_FUNC_SIMCALL, SIMCALL_WITHOUT_FUNC_SIMCALL)\
+ (name, type, __VA_ARGS__)
+#define SIMCALL_FUNC_SIMCALL(res) SIMCALL_FUNC_SIMCALL_ res
+
+#define SIMCALL_WITH_FUNC_RETURN(name, type, field) return simcall->result.field;
+#define SIMCALL_WITHOUT_FUNC_RETURN(name, type, field)
+#define SIMCALL_FUNC_RETURN_(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_FUNC_RETURN, SIMCALL_WITHOUT_FUNC_RETURN)\
+ (name, type, __VA_ARGS__)
+#define SIMCALL_FUNC_RETURN(res) SIMCALL_FUNC_RETURN_ res
+
+
+/* generate the simcall enumeration */
+#define SIMCALL_ENUM(type, ...)\
+ type
+
+/* generate strings from the enumeration values */
+#define SIMCALL_TYPE(type, name, answer, res, ...)\
+ [type] = STRINGIFY(MAP(SIMCALL_FORMAT, __VA_ARGS__))
+
+/* generate the simcalls functions */
+#define SIMCALL_FUNC(type, name, answer, res, ...)\
+ inline static SIMCALL_FUNC_RETURN_TYPE(res) simcall_BODY_##name(MAP(SIMCALL_ARG, ##__VA_ARGS__)) { \
+ SIMCALL_FUNC_SIMCALL(res) __SIMIX_simcall(type, (u_smx_scalar_t[]){MAP(SIMCALL_INIT_FIELD, ##__VA_ARGS__)}); \
+ SIMCALL_FUNC_RETURN(res)\
+ }
+
+/* generate the simcalls prototypes functions */
+#define VOID_IF_EMPTY(...) GET_CLEAN(,##__VA_ARGS__,,,,,,,,,,,void)
+#define SIMCALL_FUNC_PROTO(type, name, answer, res, ...)\
+ inline static SIMCALL_FUNC_RETURN_TYPE(res) simcall_BODY_##name(VOID_IF_EMPTY(__VA_ARGS__) MAP(SIMCALL_ARG, ##__VA_ARGS__));
+
+
+/* generate a comma if there is an argument*/
+#define WITHOUT_COMMA
+#define WITH_COMMA ,
+#define GET_CLEAN(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10, NAME,...) NAME
+#define MAYBE_COMMA(...) GET_CLEAN(,##__VA_ARGS__,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITH_COMMA,WITHOUT_COMMA)
+
+/* generate the simcalls cases for the SIMIX_simcall_pre function */
+#define WITH_ANSWER(...) __VA_ARGS__
+#define WITHOUT_ANSWER(...)
+#define SIMCALL_CASE(type, name, answer, res, ...)\
+ case type:;\
+ SIMCALL_RESULT_BEGIN(answer, res) SIMIX_pre_ ## name(simcall MAYBE_COMMA(__VA_ARGS__) MAP(SIMCALL_CASE_PARAM, ##__VA_ARGS__));\
+ SIMCALL_RESULT_END(answer, res)\
+ break;
+
+
+/*
+ * Generate simcall args and result getter/setter
+ */
+#define SIMCALL_GS_SC_NAME_(n) n
+#define SIMCALL_GS_SC_NAME(n) SIMCALL_GS_SC_NAME_ n
+#define SIMCALL_GS_ARG_NAME(n) SIMCALL_NAME_ n
+#define JOIN2(_0, _1) _0 ##__## _1
+#define JOIN3(_0, _1, _2) JOIN2(_0 ##__## _1, _2)
+#define JOIN4(_0, _1, _2, _3) JOIN3(_0 ##_## _1, _2, _3)
+#define SIMCALL_GS_FUNC(scname, setget, vname) \
+ JOIN4(simcall, scname, setget, vname)
+
+/* generate the simcalls args getter/setter */
+#define SIMCALL_ARG_GETSET_(i, name, v) \
+ inline SIMCALL_FUNC_RETURN_TYPE(v) SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME(name), get, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall){\
+ return simcall->args[i].SIMCALL_FIELD_ v ;\
+ }\
+ inline void SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME(name), set, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall, SIMCALL_ARG_ v){\
+ simcall->args[i].SIMCALL_FIELD_ v = SIMCALL_NAME_ v ;\
+ }
+
+#define SIMCALL_ARG_GETSET(type, name, answer, res, ...)\
+ MAP_WITH_DEFAULT_ARGS(SIMCALL_ARG_GETSET_, (name), ##__VA_ARGS__)
+
+/* generate the simcalls args getter/setter protos*/
+#define SIMCALL_ARG_GETSET_PROTO_(i, name, v) \
+ inline SIMCALL_FUNC_RETURN_TYPE(v) SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME(name), get, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall);\
+ inline void SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME(name), set, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall, SIMCALL_ARG_ v);
+
+#define SIMCALL_ARG_GETSET_PROTO(type, name, answer, res, ...)\
+ MAP_WITH_DEFAULT_ARGS(SIMCALL_ARG_GETSET_PROTO_, (name), ##__VA_ARGS__)
+
+/* generate the simcalls result getter/setter */
+#define SIMCALL_WITH_RES_GETSET(name, v) \
+ inline SIMCALL_FUNC_RETURN_TYPE(v) SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME((name)), get, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall){\
+ return simcall->result.SIMCALL_FIELD_ v ;\
+ }\
+ inline void SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME((name)), set, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall, SIMCALL_ARG_ v){\
+ simcall->result.SIMCALL_FIELD_ v = SIMCALL_NAME_ v ;\
+ }
+#define SIMCALL_WITHOUT_RES_GETSET(name, v)
+#define SIMCALL_RES_GETSET__(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_RES_GETSET, SIMCALL_WITHOUT_RES_GETSET)
+#define SIMCALL_RES_GETSET_(scname, v)\
+ SIMCALL_RES_GETSET__ v (scname, v)
+#define SIMCALL_RES_GETSET(type, name, answer, res, ...)\
+ SIMCALL_RES_GETSET_(name, res)
+
+/* generate the simcalls result getter/setter protos*/
+#define SIMCALL_WITH_RES_GETSET_PROTO(name, v) \
+ inline SIMCALL_FUNC_RETURN_TYPE(v) SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME((name)), get, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall);\
+ inline void SIMCALL_GS_FUNC(SIMCALL_GS_SC_NAME((name)), set, SIMCALL_GS_ARG_NAME(v))(smx_simcall_t simcall, SIMCALL_ARG_ v);
+#define SIMCALL_WITHOUT_RES_GETSET_PROTO(name, v)
+#define SIMCALL_RES_GETSET_PROTO__(name, type, ...)\
+ MAYBE2(,##__VA_ARGS__, SIMCALL_WITH_RES_GETSET_PROTO, SIMCALL_WITHOUT_RES_GETSET_PROTO)
+#define SIMCALL_RES_GETSET_PROTO_(scname, v)\
+ SIMCALL_RES_GETSET_PROTO__ v (scname, v)
+#define SIMCALL_RES_GETSET_PROTO(type, name, answer, res, ...)\
+ SIMCALL_RES_GETSET_PROTO_(name, res)
+
+
+
+
+/* stringify arguments */
+#define STRINGIFY_(...) #__VA_ARGS__
+#define STRINGIFY(...) STRINGIFY_(__VA_ARGS__)
+
+/* the list of simcalls definitions */
+#define SIMCALL_LIST1(ACTION, sep) \
+ACTION(SIMCALL_HOST_GET_BY_NAME, host_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(name)) sep \
+ACTION(SIMCALL_HOST_GET_NAME, host_get_name, WITH_ANSWER, TSTRING(result), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_GET_PROPERTIES, host_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_GET_SPEED, host_get_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_GET_AVAILABLE_SPEED, host_get_available_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_GET_STATE, host_get_state, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_GET_DATA, host_get_data, WITH_ANSWER, TPTR(result), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_HOST_SET_DATA, host_set_data, WITH_ANSWER, TVOID(result), TSPEC(host, smx_host_t), TPTR(data)) sep \
+ACTION(SIMCALL_HOST_EXECUTE, host_execute, WITH_ANSWER, TSPEC(result, smx_action_t), TSTRING(name), TSPEC(host, smx_host_t), TDOUBLE(computation_amount), TDOUBLE(priority)) sep \
+ACTION(SIMCALL_HOST_PARALLEL_EXECUTE, host_parallel_execute, WITH_ANSWER, TSPEC(result, smx_action_t), TSTRING(name), TINT(host_nb), TSPEC(host_list, smx_host_t*), TSPEC(computation_amount, double*), TSPEC(communication_amount, double*), TDOUBLE(amount), TDOUBLE(rate)) sep \
+ACTION(SIMCALL_HOST_EXECUTION_DESTROY, host_execution_destroy, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_HOST_EXECUTION_CANCEL, host_execution_cancel, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_HOST_EXECUTION_GET_REMAINS, host_execution_get_remains, WITH_ANSWER, TDOUBLE(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \
+ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t*), TSTRING(name), TSPEC(code, xbt_main_func_t), TPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TSPEC(argv, char**), TSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \
+ACTION(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_KILLALL, process_killall, WITH_ANSWER, TVOID(result)) sep \
+ACTION(SIMCALL_PROCESS_CLEANUP, process_cleanup, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_CHANGE_HOST, process_change_host, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TSPEC(dest, smx_host_t)) sep \
+ACTION(SIMCALL_PROCESS_SUSPEND, process_suspend, WITHOUT_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_RESUME, process_resume, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_COUNT, process_count, WITH_ANSWER, TINT(result)) sep \
+ACTION(SIMCALL_PROCESS_GET_DATA, process_get_data, WITH_ANSWER, TPTR(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_SET_DATA, process_set_data, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TPTR(data)) sep \
+ACTION(SIMCALL_PROCESS_GET_HOST, process_get_host, WITH_ANSWER, TSPEC(result, smx_host_t), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_GET_NAME, process_get_name, WITH_ANSWER, TSTRING(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_IS_SUSPENDED, process_is_suspended, WITH_ANSWER, TINT(result), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_GET_PROPERTIES, process_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_PROCESS_SLEEP, process_sleep, WITHOUT_ANSWER, TINT(result), TDOUBLE(duration)) sep \
+ACTION(SIMCALL_PROCESS_ON_EXIT, process_on_exit, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TSPEC(fun, int_f_pvoid_t), TPTR(data)) sep \
+ACTION(SIMCALL_PROCESS_AUTO_RESTART_SET, process_auto_restart_set, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TINT(auto_restart)) sep \
+ACTION(SIMCALL_PROCESS_RESTART, process_restart, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(process, smx_process_t)) sep \
+ACTION(SIMCALL_RDV_CREATE, rdv_create, WITH_ANSWER, TSPEC(result, smx_rdv_t), TSTRING(name)) sep \
+ACTION(SIMCALL_RDV_DESTROY, rdv_destroy, WITH_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t)) sep \
+ACTION(SIMCALL_RDV_GET_BY_NAME, rdv_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(name)) sep \
+ACTION(SIMCALL_RDV_COMM_COUNT_BY_HOST, rdv_comm_count_by_host, WITH_ANSWER, TUINT(result), TSPEC(rdv, smx_rdv_t), TSPEC(host, smx_host_t)) sep \
+ACTION(SIMCALL_RDV_GET_HEAD, rdv_get_head, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t)) sep \
+ACTION(SIMCALL_RDV_SET_RECV, rdv_set_receiver, WITH_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TSPEC(receiver, smx_process_t)) sep \
+ACTION(SIMCALL_RDV_GET_RECV, rdv_get_receiver, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(rdv, smx_rdv_t)) sep \
+ACTION(SIMCALL_COMM_IPROBE, comm_iprobe, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TINT(src), TINT(tag), TSPEC(match_fun, simix_match_func_t), TPTR(data)) sep \
+ACTION(SIMCALL_COMM_SEND, comm_send, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TPTR(src_buff), TSIZE(src_buff_size), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout)) sep \
+ACTION(SIMCALL_COMM_ISEND, comm_isend, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TPTR(src_buff), TSIZE(src_buff_size), TSPEC(match_fun, simix_match_func_t), TSPEC(clean_fun, simix_clean_func_t), TPTR(data), TINT(detached)) sep \
+ACTION(SIMCALL_COMM_RECV, comm_recv, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout)) sep \
+ACTION(SIMCALL_COMM_IRECV, comm_irecv, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data)) sep \
+ACTION(SIMCALL_COMM_DESTROY, comm_destroy, WITH_ANSWER, TVOID(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_CANCEL, comm_cancel, WITH_ANSWER, TVOID(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_WAITANY, comm_waitany, WITHOUT_ANSWER, TINT(result), TSPEC(comms, xbt_dynar_t)) sep \
+ACTION(SIMCALL_COMM_WAIT, comm_wait, WITHOUT_ANSWER, TVOID(result), TSPEC(comm, smx_action_t), TDOUBLE(timeout)) sep \
+ACTION(SIMCALL_COMM_TEST, comm_test, WITHOUT_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_TESTANY, comm_testany, WITHOUT_ANSWER, TINT(result), TSPEC(comms, xbt_dynar_t)) sep \
+ACTION(SIMCALL_COMM_GET_REMAINS, comm_get_remains, WITH_ANSWER, TDOUBLE(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_GET_STATE, comm_get_state, WITH_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_GET_SRC_DATA, comm_get_src_data, WITH_ANSWER, TPTR(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_GET_DST_DATA, comm_get_dst_data, WITH_ANSWER, TPTR(result), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_GET_SRC_PROC, comm_get_src_proc, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_COMM_GET_DST_PROC, comm_get_dst_proc, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(comm, smx_action_t)) sep \
+ACTION(SIMCALL_MUTEX_INIT, mutex_init, WITH_ANSWER, TSPEC(result, smx_mutex_t)) sep \
+ACTION(SIMCALL_MUTEX_DESTROY, mutex_destroy, WITH_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \
+ACTION(SIMCALL_MUTEX_LOCK, mutex_lock, WITHOUT_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \
+ACTION(SIMCALL_MUTEX_TRYLOCK, mutex_trylock, WITH_ANSWER, TINT(result), TSPEC(mutex, smx_mutex_t)) sep \
+ACTION(SIMCALL_MUTEX_UNLOCK, mutex_unlock, WITH_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \
+ACTION(SIMCALL_COND_INIT, cond_init, WITH_ANSWER, TSPEC(result, smx_cond_t)) sep \
+ACTION(SIMCALL_COND_DESTROY, cond_destroy, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \
+ACTION(SIMCALL_COND_SIGNAL, cond_signal, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \
+ACTION(SIMCALL_COND_WAIT, cond_wait, WITHOUT_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t), TSPEC(mutex, smx_mutex_t)) sep \
+ACTION(SIMCALL_COND_WAIT_TIMEOUT, cond_wait_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t), TSPEC(mutex, smx_mutex_t), TDOUBLE(timeout)) sep \
+ACTION(SIMCALL_COND_BROADCAST, cond_broadcast, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \
+ACTION(SIMCALL_SEM_INIT, sem_init, WITH_ANSWER, TSPEC(result, smx_sem_t), TINT(capacity)) sep \
+ACTION(SIMCALL_SEM_DESTROY, sem_destroy, WITH_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
+ACTION(SIMCALL_SEM_RELEASE, sem_release, WITH_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
+ACTION(SIMCALL_SEM_WOULD_BLOCK, sem_would_block, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \
+ACTION(SIMCALL_SEM_ACQUIRE, sem_acquire, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
+ACTION(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem_acquire_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t), TDOUBLE(timeout)) sep \
+ACTION(SIMCALL_SEM_GET_CAPACITY, sem_get_capacity, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \
+ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TDOUBLE(result), TPTR(ptr), TSIZE(size), TSIZE(nmemb), TSPEC(stream, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TCPTR(ptr), TSIZE(size), TSIZE(nmemb), TSPEC(stream, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_OPEN, file_open, WITHOUT_ANSWER, TSPEC(result, smx_file_t), TSTRING(mount), TSTRING(path), TSTRING(mode)) sep \
+ACTION(SIMCALL_FILE_CLOSE, file_close, WITHOUT_ANSWER, TINT(result), TSPEC(fp, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_STAT, file_stat, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t), TSPEC(buf, s_file_stat_t*)) sep \
+ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_LS, file_ls, WITHOUT_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(mount), TSTRING(path)) sep \
+ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(name)) sep
/* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
* because they are not always present */
#ifdef HAVE_LATENCY_BOUND_TRACKING
-#define SIMCALL_LIST2 \
-,SIMCALL_ENUM_ELEMENT(SIMCALL_COMM_IS_LATENCY_BOUNDED)
+#define SIMCALL_LIST2(ACTION, sep) \
+ACTION(SIMCALL_COMM_IS_LATENCY_BOUNDED, comm_is_latency_bounded, WITH_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep
#else
-#define SIMCALL_LIST2
+#define SIMCALL_LIST2(ACTION, sep)
#endif
#ifdef HAVE_TRACING
-#define SIMCALL_LIST3 \
-,SIMCALL_ENUM_ELEMENT(SIMCALL_SET_CATEGORY)
+#define SIMCALL_LIST3(ACTION, sep) \
+ACTION(SIMCALL_SET_CATEGORY, set_category, WITH_ANSWER, TVOID(result), TSPEC(action, smx_action_t), TSTRING(category)) sep
#else
-#define SIMCALL_LIST3
+#define SIMCALL_LIST3(ACTION, sep)
#endif
#ifdef HAVE_MC
-#define SIMCALL_LIST4 \
- ,SIMCALL_ENUM_ELEMENT(SIMCALL_MC_SNAPSHOT) \
- ,SIMCALL_ENUM_ELEMENT(SIMCALL_MC_COMPARE_SNAPSHOTS)
+#define SIMCALL_LIST4(ACTION, sep) \
+ACTION(SIMCALL_MC_SNAPSHOT, mc_snapshot, WITH_ANSWER, TPTR(result)) sep \
+ACTION(SIMCALL_MC_COMPARE_SNAPSHOTS, mc_compare_snapshots, WITH_ANSWER, TINT(result), TPTR(s1), TPTR(s2)) sep
#else
-#define SIMCALL_LIST4
+#define SIMCALL_LIST4(ACTION, sep)
#endif
/* SIMCALL_LIST is the final macro to use */
-#define SIMCALL_LIST SIMCALL_LIST1 SIMCALL_LIST2 SIMCALL_LIST3 SIMCALL_LIST4
+#define SIMCALL_LIST(ACTION, ...) \
+ SIMCALL_LIST1(ACTION, ##__VA_ARGS__)\
+ SIMCALL_LIST2(ACTION, ##__VA_ARGS__)\
+ SIMCALL_LIST3(ACTION, ##__VA_ARGS__)\
+ SIMCALL_LIST4(ACTION, ##__VA_ARGS__)
+
/* you can redefine the following macro differently to generate something else
* with the list of enumeration values (e.g. a table of strings or a table of function pointers) */
-#define SIMCALL_ENUM_ELEMENT(x) x
+#define SIMCALL_ENUM_ELEMENT(x, y) x
/**
* \brief All possible simcalls.
*/
typedef enum {
-SIMCALL_LIST
+SIMCALL_NONE,
+SIMCALL_LIST(SIMCALL_ENUM, SIMCALL_SEP_COMMA)
+SIMCALL_NEW_API_INIT,
+NUM_SIMCALLS
} e_smx_simcall_t;
+typedef int (*simix_match_func_t)(void *, void *, smx_action_t);
+typedef void (*simix_clean_func_t)(void *);
+
+/**
+ * \brief Prototypes of SIMIX
+ */
+SIMCALL_LIST(SIMCALL_FUNC_PROTO, SIMCALL_SEP_NOTHING)
+
+
+/* Pack all possible scalar types in an union */
+union u_smx_scalar {
+ char c;
+ const char* cc;
+ short s;
+ int i;
+ long l;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long ul;
+ float f;
+ double d;
+ size_t si;
+ void* p;
+ const void* cp;
+};
+
/**
* \brief Represents a simcall to the kernel.
*/
typedef struct s_smx_simcall {
e_smx_simcall_t call;
smx_process_t issuer;
-
+ int mc_value;
+ union u_smx_scalar *args;
+ union u_smx_scalar result;
+ //FIXME: union u_smx_scalar retval;
union {
-
- struct {
- const char *name;
- smx_host_t result;
- } host_get_by_name;
-
- struct {
- smx_host_t host;
- const char* result;
- } host_get_name;
-
- struct {
- smx_host_t host;
- xbt_dict_t result;
- } host_get_properties;
-
- struct {
- smx_host_t host;
- double result;
- } host_get_speed;
-
- struct {
- smx_host_t host;
- double result;
- } host_get_available_speed;
-
- struct {
- smx_host_t host;
- int result;
- } host_get_state;
-
- struct {
- smx_host_t host;
- void* result;
- } host_get_data;
-
- struct {
- smx_host_t host;
- void* data;
- } host_set_data;
-
- struct {
- const char* name;
- smx_host_t host;
- double computation_amount;
- double priority;
- smx_action_t result;
- } host_execute;
-
- struct {
- const char *name;
- int host_nb;
- smx_host_t *host_list;
- double *computation_amount;
- double *communication_amount;
- double amount;
- double rate;
- smx_action_t result;
- } host_parallel_execute;
-
- struct {
- smx_action_t execution;
- } host_execution_destroy;
-
- struct {
- smx_action_t execution;
- } host_execution_cancel;
-
- struct {
- smx_action_t execution;
- double result;
- } host_execution_get_remains;
-
- struct {
- smx_action_t execution;
- e_smx_state_t result;
- } host_execution_get_state;
-
- struct {
- smx_action_t execution;
- double priority;
- } host_execution_set_priority;
-
- struct {
- smx_action_t execution;
- e_smx_state_t result;
- } host_execution_wait;
-
- struct {
- smx_process_t *process;
- const char *name;
- xbt_main_func_t code;
- void *data;
- const char *hostname;
- double kill_time;
- int argc;
- char **argv;
- xbt_dict_t properties;
- int auto_restart;
- } process_create;
-
- struct {
- smx_process_t process;
- } process_kill;
-
- struct {
- smx_process_t process;
- } process_cleanup;
-
- struct {
- smx_process_t process;
- smx_host_t dest;
- } process_change_host;
-
- struct {
- smx_process_t process;
- } process_suspend;
-
- struct {
- smx_process_t process;
- } process_resume;
-
- struct {
- int result;
- } process_count;
-
- struct {
- smx_process_t process;
- void* result;
- } process_get_data;
-
- struct {
- smx_process_t process;
- void* data;
- } process_set_data;
-
- struct {
- smx_process_t process;
- smx_host_t result;
- } process_get_host;
-
- struct {
- smx_process_t process;
- const char *result;
- } process_get_name;
-
- struct {
- smx_process_t process;
- int result;
- } process_is_suspended;
-
- struct {
- smx_process_t process;
- xbt_dict_t result;
- } process_get_properties;
-
- struct {
- double duration;
- e_smx_state_t result;
- } process_sleep;
-
- struct {
- smx_process_t process;
- int_f_pvoid_t fun;
- void *data;
- } process_on_exit;
-
- struct {
- smx_process_t process;
- int auto_restart;
- } process_auto_restart;
-
- struct {
- smx_process_t process;
- smx_process_t result;
- } process_restart;
-
- struct {
- const char *name;
- smx_rdv_t result;
- } rdv_create;
-
- struct {
- smx_rdv_t rdv;
- } rdv_destroy;
-
- struct {
- const char* name;
- smx_rdv_t result;
- } rdv_get_by_name;
-
- struct {
- smx_rdv_t rdv;
- smx_host_t host;
- unsigned int result;
- } rdv_comm_count_by_host;
-
- struct {
- smx_rdv_t rdv;
- smx_action_t result;
- } rdv_get_head;
-
- struct {
- smx_rdv_t rdv;
- smx_process_t receiver;
- } rdv_set_rcv_proc;
-
- struct {
- smx_rdv_t rdv;
- smx_process_t result;
- } rdv_get_rcv_proc;
-
- struct {
- smx_rdv_t rdv;
- double task_size;
- double rate;
- void *src_buff;
- size_t src_buff_size;
- int (*match_fun)(void *, void *, smx_action_t);
- void *data;
- double timeout;
- } comm_send;
-
- struct {
- smx_rdv_t rdv;
- double task_size;
- double rate;
- void *src_buff;
- size_t src_buff_size;
- int (*match_fun)(void *, void *, smx_action_t);
- void (*clean_fun)(void *);
- void *data;
- int detached;
- smx_action_t result;
- } comm_isend;
-
- struct {
- smx_rdv_t rdv;
- void *dst_buff;
- size_t *dst_buff_size;
- int (*match_fun)(void *, void *, smx_action_t);
- void *data;
- double timeout;
- } comm_recv;
-
- struct {
- smx_rdv_t rdv;
- void *dst_buff;
- size_t *dst_buff_size;
- int (*match_fun)(void *, void *, smx_action_t);
- void *data;
- smx_action_t result;
- } comm_irecv;
-
- struct {
- smx_rdv_t rdv;
- int src;
- int tag;
- int (*match_fun)(void *, void *, smx_action_t);
- void *data;
- smx_action_t result;
- } comm_iprobe;
-
- struct {
- smx_action_t comm;
- } comm_destroy;
-
- struct {
- smx_action_t comm;
- } comm_cancel;
-
- struct {
- xbt_dynar_t comms;
- unsigned int result;
- } comm_waitany;
-
- struct {
- smx_action_t comm;
- double timeout;
- } comm_wait;
-
- struct {
- smx_action_t comm;
- int result;
- } comm_test;
-
- struct {
- xbt_dynar_t comms;
- int result;
- } comm_testany;
-
- struct {
- smx_action_t comm;
- double result;
- } comm_get_remains;
-
- struct {
- smx_action_t comm;
- e_smx_state_t result;
- } comm_get_state;
-
- struct {
- smx_action_t comm;
- void *result;
- } comm_get_src_data;
-
- struct {
- smx_action_t comm;
- void *result;
- } comm_get_dst_data;
-
- struct {
- smx_action_t comm;
- smx_process_t result;
- } comm_get_src_proc;
-
- struct {
- smx_action_t comm;
- smx_process_t result;
- } comm_get_dst_proc;
-
-#ifdef HAVE_LATENCY_BOUND_TRACKING
- struct {
- smx_action_t comm;
- int result;
- } comm_is_latency_bounded;
-#endif
-
-#ifdef HAVE_TRACING
- struct {
- smx_action_t action;
- const char *category;
- } set_category;
-#endif
-
- struct {
- smx_mutex_t result;
- } mutex_init;
-
- struct {
- smx_mutex_t mutex;
- } mutex_lock;
-
- struct {
- smx_mutex_t mutex;
- int result;
- } mutex_trylock;
-
- struct {
- smx_mutex_t mutex;
- } mutex_unlock;
-
- struct {
- smx_mutex_t mutex;
- } mutex_destroy;
-
- struct {
- smx_cond_t result;
- } cond_init;
-
- struct {
- smx_cond_t cond;
- } cond_destroy;
-
- struct {
- smx_cond_t cond;
- } cond_signal;
-
- struct {
- smx_cond_t cond;
- smx_mutex_t mutex;
- } cond_wait;
-
- struct {
- smx_cond_t cond;
- smx_mutex_t mutex;
- double timeout;
- } cond_wait_timeout;
-
- struct {
- smx_cond_t cond;
- } cond_broadcast;
-
- struct {
- int capacity;
- smx_sem_t result;
- } sem_init;
-
- struct {
- smx_sem_t sem;
- } sem_destroy;
-
- struct {
- smx_sem_t sem;
- } sem_release;
-
- struct {
- smx_sem_t sem;
- int result;
- } sem_would_block;
-
- struct {
- smx_sem_t sem;
- } sem_acquire;
-
- struct {
- smx_sem_t sem;
- double timeout;
- } sem_acquire_timeout;
-
- struct {
- smx_sem_t sem;
- int result;
- } sem_get_capacity;
-
- struct {
- void *ptr;
- size_t size;
- size_t nmemb;
- smx_file_t stream;
- double result;
- } file_read;
-
- struct {
- const void *ptr;
- size_t size;
- size_t nmemb;
- smx_file_t stream;
- size_t result;
- } file_write;
-
- struct {
- const char* mount;
- const char* path;
- const char* mode;
- smx_file_t result;
- } file_open;
-
- struct {
- smx_file_t fp;
- int result;
- } file_close;
-
- struct {
- smx_file_t fd;
- s_file_stat_t buf;
- int result;
- } file_stat;
-
- struct {
- smx_file_t fd;
- int result;
- } file_unlink;
-
- struct {
- const char *mount;
- const char *path;
- xbt_dict_t result;
- } file_ls;
-
- struct {
- const char* name;
- xbt_dict_t result;
- } asr_get_properties;
-
- struct{
- void *s;
- } mc_snapshot;
-
- struct{
- void *snapshot1;
- void *snapshot2;
- int result;
- } mc_compare_snapshots;
-
- /* ****************************************************************************************** */
- /* TUTORIAL: New API */
- /* ****************************************************************************************** */
struct {
const char* param1;
double param2;
};
} s_smx_simcall_t, *smx_simcall_t;
+SIMCALL_LIST(SIMCALL_RES_GETSET_PROTO, SIMCALL_SEP_NOTHING)
+SIMCALL_LIST(SIMCALL_ARG_GETSET_PROTO, SIMCALL_SEP_NOTHING)
+
/******************************** General *************************************/
void SIMIX_simcall_push(smx_process_t self);
void SIMIX_simcall_post(smx_action_t);
smx_simcall_t SIMIX_simcall_mine(void);
const char *SIMIX_simcall_name(e_smx_simcall_t kind);
+//TOFIX put it in a better place
+xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name);
+
+/*************************** New simcall interface ****************************/
+
+smx_simcall_t __SIMIX_simcall(e_smx_simcall_t simcall_id, u_smx_scalar_t *args);
+
+typedef smx_action_t (*simcall_handler_t)(u_smx_scalar_t *);
+
+extern const char *simcall_types[];
+extern simcall_handler_t simcall_table[];
#endif
switch (simcall->call) {
case SIMCALL_MUTEX_LOCK:
- xbt_swag_remove(process, simcall->mutex_lock.mutex->sleeping);
+ xbt_swag_remove(process, simcall_mutex_lock__get__mutex(simcall)->sleeping);
break;
case SIMCALL_COND_WAIT:
- xbt_swag_remove(process, simcall->cond_wait.cond->sleeping);
+ xbt_swag_remove(process, simcall_cond_wait__get__cond(simcall)->sleeping);
break;
case SIMCALL_COND_WAIT_TIMEOUT:
- xbt_swag_remove(process, simcall->cond_wait_timeout.cond->sleeping);
+ xbt_swag_remove(process, simcall_cond_wait_timeout__get__cond(simcall)->sleeping);
break;
case SIMCALL_SEM_ACQUIRE:
- xbt_swag_remove(process, simcall->sem_acquire.sem->sleeping);
+ xbt_swag_remove(process, simcall_sem_acquire__get__sem(simcall)->sleeping);
break;
case SIMCALL_SEM_ACQUIRE_TIMEOUT:
- xbt_swag_remove(process, simcall->sem_acquire_timeout.sem->sleeping);
+ xbt_swag_remove(process, simcall_sem_acquire_timeout__get__sem(simcall)->sleeping);
break;
default:
}
/*********************************** Mutex ************************************/
+smx_mutex_t SIMIX_pre_mutex_init(smx_simcall_t simcall){
+ return SIMIX_mutex_init();
+}
/**
* \brief Initialize a mutex.
*
* \brief Handles a mutex lock simcall.
* \param simcall the simcall
*/
-void SIMIX_pre_mutex_lock(smx_simcall_t simcall)
+void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex)
{
XBT_IN("(%p)",simcall);
/* FIXME: check where to validate the arguments */
smx_action_t sync_act = NULL;
- smx_mutex_t mutex = simcall->mutex_lock.mutex;
smx_process_t process = simcall->issuer;
if (mutex->locked) {
XBT_OUT();
}
+int SIMIX_pre_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex){
+ return SIMIX_mutex_trylock(mutex, simcall->issuer);
+}
/**
* \brief Tries to lock a mutex.
*
return 1;
}
+void SIMIX_pre_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex){
+ SIMIX_mutex_unlock(mutex, simcall->issuer);
+}
/**
* \brief Unlocks a mutex.
*
XBT_OUT();
}
+void SIMIX_pre_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex){
+ SIMIX_mutex_destroy(mutex);
+}
/**
* \brief Destroys a mutex.
*
/********************************* Condition **********************************/
+smx_cond_t SIMIX_pre_cond_init(smx_simcall_t simcall){
+ return SIMIX_cond_init();
+}
/**
* \brief Initialize a condition.
*
* It have to be called before the use of the condition.
* \return A condition
*/
-smx_cond_t SIMIX_cond_init()
+smx_cond_t SIMIX_cond_init(void)
{
XBT_IN("()");
s_smx_process_t p;
* \brief Handle a condition waiting simcall without timeouts
* \param simcall the simcall
*/
-void SIMIX_pre_cond_wait(smx_simcall_t simcall)
+void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex)
{
XBT_IN("(%p)",simcall);
smx_process_t issuer = simcall->issuer;
- smx_cond_t cond = simcall->cond_wait.cond;
- smx_mutex_t mutex = simcall->cond_wait.mutex;
_SIMIX_cond_wait(cond, mutex, -1, issuer, simcall);
XBT_OUT();
* \brief Handle a condition waiting simcall with timeouts
* \param simcall the simcall
*/
-void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall)
+void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond,
+ smx_mutex_t mutex, double timeout)
{
XBT_IN("(%p)",simcall);
smx_process_t issuer = simcall->issuer;
- smx_cond_t cond = simcall->cond_wait_timeout.cond;
- smx_mutex_t mutex = simcall->cond_wait_timeout.mutex;
- double timeout = simcall->cond_wait_timeout.timeout;
_SIMIX_cond_wait(cond, mutex, timeout, issuer, simcall);
XBT_OUT();
XBT_OUT();
}
+void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_signal(cond);
+}
/**
* \brief Signalizes a condition.
*
/* Now transform the cond wait simcall into a mutex lock one */
simcall = &proc->simcall;
if(simcall->call == SIMCALL_COND_WAIT)
- mutex = simcall->cond_wait.mutex;
+ mutex = simcall_cond_wait__get__mutex(simcall);
else
- mutex = simcall->cond_wait_timeout.mutex;
-
+ mutex = simcall_cond_wait_timeout__get__mutex(simcall);
simcall->call = SIMCALL_MUTEX_LOCK;
- simcall->mutex_lock.mutex = mutex;
- SIMIX_pre_mutex_lock(simcall);
+ SIMIX_pre_mutex_lock(simcall, mutex);
}
XBT_OUT();
}
+void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_broadcast(cond);
+}
/**
* \brief Broadcasts a condition.
*
XBT_OUT();
}
+void SIMIX_pre_cond_destroy(smx_simcall_t simcall, smx_cond_t cond){
+ SIMIX_cond_destroy(cond);
+}
/**
* \brief Destroys a contidion.
*
/******************************** Semaphores **********************************/
#define SMX_SEM_NOLIMIT 99999
+smx_sem_t SIMIX_pre_sem_init(smx_simcall_t simcall, unsigned int value){
+ return SIMIX_sem_init(value);
+}
/** @brief Initialize a semaphore */
smx_sem_t SIMIX_sem_init(unsigned int value)
{
return sem;
}
+void SIMIX_pre_sem_destroy(smx_simcall_t simcall, smx_sem_t sem){
+ SIMIX_sem_destroy(sem);
+}
/** @brief Destroys a semaphore */
void SIMIX_sem_destroy(smx_sem_t sem)
{
XBT_OUT();
}
+void SIMIX_pre_sem_release(smx_simcall_t simcall, smx_sem_t sem){
+ SIMIX_sem_release(sem);
+}
/** @brief release the semaphore
*
* Unlock a process waiting on the semaphore.
XBT_OUT();
}
+XBT_INLINE int SIMIX_pre_sem_would_block(smx_simcall_t simcall, smx_sem_t sem){
+ return SIMIX_sem_would_block(sem);
+}
/** @brief Returns true if acquiring this semaphore would block */
XBT_INLINE int SIMIX_sem_would_block(smx_sem_t sem)
{
return (sem->value <= 0);
}
+int SIMIX_pre_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem){
+ return SIMIX_sem_get_capacity(sem);
+}
/** @brief Returns the current capacity of the semaphore */
int SIMIX_sem_get_capacity(smx_sem_t sem)
{
* \brief Handles a sem acquire simcall without timeout.
* \param simcall the simcall
*/
-void SIMIX_pre_sem_acquire(smx_simcall_t simcall)
+void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem)
{
XBT_IN("(%p)",simcall);
- _SIMIX_sem_wait(simcall->sem_acquire.sem, -1, simcall->issuer, simcall);
+ _SIMIX_sem_wait(sem, -1, simcall->issuer, simcall);
XBT_OUT();
}
* \brief Handles a sem acquire simcall with timeout.
* \param simcall the simcall
*/
-void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall)
+void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout)
{
XBT_IN("(%p)",simcall);
- _SIMIX_sem_wait(simcall->sem_acquire_timeout.sem,
- simcall->sem_acquire_timeout.timeout, simcall->issuer, simcall);
+ _SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall);
XBT_OUT();
}
smx_mutex_t SIMIX_mutex_init(void);
void SIMIX_mutex_destroy(smx_mutex_t mutex);
-void SIMIX_pre_mutex_lock(smx_simcall_t simcall);
+void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex);
int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer);
void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer);
smx_cond_t SIMIX_cond_init(void);
void SIMIX_cond_destroy(smx_cond_t cond);
void SIMIX_cond_signal(smx_cond_t cond);
-void SIMIX_pre_cond_wait(smx_simcall_t simcall);
-void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall);
+void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex);
+void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond,
+ smx_mutex_t mutex, double timeout);
void SIMIX_cond_broadcast(smx_cond_t cond);
smx_sem_t SIMIX_sem_init(unsigned int value);
void SIMIX_sem_destroy(smx_sem_t sem);
void SIMIX_sem_release(smx_sem_t sem);
int SIMIX_sem_would_block(smx_sem_t sem);
-void SIMIX_pre_sem_acquire(smx_simcall_t simcall);
-void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall);
+void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
+void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
int SIMIX_sem_get_capacity(smx_sem_t sem);
+// pre prototypes
+smx_mutex_t SIMIX_pre_mutex_init(smx_simcall_t simcall);
+void SIMIX_pre_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex);
+int SIMIX_pre_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex);
+void SIMIX_pre_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex);
+smx_cond_t SIMIX_pre_cond_init(smx_simcall_t simcall);
+void SIMIX_pre_cond_destroy(smx_simcall_t simcall, smx_cond_t cond);
+void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond);
+void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond);
+smx_sem_t SIMIX_pre_sem_init(smx_simcall_t simcall, unsigned int value);
+void SIMIX_pre_sem_destroy(smx_simcall_t simcall, smx_sem_t sem);
+void SIMIX_pre_sem_release(smx_simcall_t simcall, smx_sem_t sem);
+XBT_INLINE int SIMIX_pre_sem_would_block(smx_simcall_t simcall, smx_sem_t sem);
+int SIMIX_pre_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
#endif
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
+/* generate strings from the enumeration values */
static const char* simcall_names[] = {
-#undef SIMCALL_ENUM_ELEMENT
-#define SIMCALL_ENUM_ELEMENT(x) #x /* generate strings from the enumeration values */
-SIMCALL_LIST
-#undef SIMCALL_ENUM_ELEMENT
+SIMCALL_LIST(SIMCALL_TYPE, SIMCALL_SEP_COMMA)
+[SIMCALL_NONE] = "NONE"
};
+SIMCALL_LIST(SIMCALL_FUNC, SIMCALL_SEP_NOTHING)
+
/**
* \ingroup simix_host_management
* \brief Returns a host given its name.
*/
smx_host_t simcall_host_get_by_name(const char *name)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_BY_NAME;
- simcall->host_get_by_name.name = name;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->host_get_by_name.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_by_name.result;
+ return simcall_BODY_host_get_by_name(name);
}
/**
*/
const char* simcall_host_get_name(smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_NAME;
- simcall->host_get_name.host = host;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->host_get_name.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_name.result;
+ return simcall_BODY_host_get_name(host);
}
/**
*/
xbt_dict_t simcall_host_get_properties(smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_PROPERTIES;
- simcall->host_get_properties.host = host;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->host_get_properties.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_properties.result;
+ return simcall_BODY_host_get_properties(host);
}
/**
*/
xbt_dict_t simcall_asr_get_properties(const char *name)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_ASR_GET_PROPERTIES;
- simcall->asr_get_properties.name = name;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->asr_get_properties.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->asr_get_properties.result;
+ return simcall_BODY_asr_get_properties(name);
}
*/
double simcall_host_get_speed(smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_SPEED;
- simcall->host_get_speed.host = host;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->host_get_speed.result = 0.0;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_speed.result;
+ return simcall_BODY_host_get_speed(host);
}
/**
*/
double simcall_host_get_available_speed(smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_AVAILABLE_SPEED;
- simcall->host_get_available_speed.host = host;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->host_get_available_speed.result = 0.0;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_available_speed.result;
+ return simcall_BODY_host_get_available_speed(host);
}
/**
*/
int simcall_host_get_state(smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_STATE;
- simcall->host_get_state.host = host;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->host_get_state.result = -1;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_state.result;
+ return simcall_BODY_host_get_state(host);
}
/**
*/
void* simcall_host_get_data(smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_GET_DATA;
- simcall->host_get_data.host = host;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->host_get_data.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_get_data.result;
+ return simcall_BODY_host_get_data(host);
}
/**
*/
void simcall_host_set_data(smx_host_t host, void *data)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_SET_DATA;
- simcall->host_set_data.host = host;
- simcall->host_set_data.data = data;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_host_set_data(host, data);
}
/**
* \param priority computation priority
* \return A new SIMIX execution action
*/
+
smx_action_t simcall_host_execute(const char *name, smx_host_t host,
double computation_amount,
double priority)
xbt_assert(isfinite(computation_amount), "computation_amount is not finite!");
xbt_assert(isfinite(priority), "priority is not finite!");
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTE;
- simcall->host_execute.name = name;
- simcall->host_execute.host = host;
- simcall->host_execute.computation_amount = computation_amount;
- simcall->host_execute.priority = priority;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->host_execute.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_execute.result;
+ return simcall_BODY_host_execute(name, host, computation_amount, priority);
}
/**
xbt_assert(isfinite(amount), "amount is not finite!");
xbt_assert(isfinite(rate), "rate is not finite!");
- smx_simcall_t simcall = SIMIX_simcall_mine();
+ return simcall_BODY_host_parallel_execute(name, host_nb, host_list,
+ computation_amount,
+ communication_amount,
+ amount, rate);
- simcall->call = SIMCALL_HOST_PARALLEL_EXECUTE;
- simcall->host_parallel_execute.name = name;
- simcall->host_parallel_execute.host_nb = host_nb;
- simcall->host_parallel_execute.host_list = host_list;
- simcall->host_parallel_execute.computation_amount = computation_amount;
- simcall->host_parallel_execute.communication_amount = communication_amount;
- simcall->host_parallel_execute.amount = amount;
- simcall->host_parallel_execute.rate = rate;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->host_parallel_execute.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_parallel_execute.result;
}
/**
*/
void simcall_host_execution_destroy(smx_action_t execution)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTION_DESTROY;
- simcall->host_execution_destroy.execution = execution;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_host_execution_destroy(execution);
}
/**
*/
void simcall_host_execution_cancel(smx_action_t execution)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTION_CANCEL;
- simcall->host_execution_cancel.execution = execution;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_host_execution_cancel(execution);
}
/**
*/
double simcall_host_execution_get_remains(smx_action_t execution)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTION_GET_REMAINS;
- simcall->host_execution_get_remains.execution = execution;
- if(MC_is_active()) /* Initializeialize result to a default value for snapshot comparison done during simcall */
- simcall->host_execution_get_remains.result = 0.0;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_execution_get_remains.result;
+ return simcall_BODY_host_execution_get_remains(execution);
}
/**
*/
e_smx_state_t simcall_host_execution_get_state(smx_action_t execution)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTION_GET_STATE;
- simcall->host_execution_get_state.execution = execution;
- simcall->host_execution_get_state.result = -1;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_execution_get_state.result;
+ return simcall_BODY_host_execution_get_state(execution);
}
/**
/* checking for infinite values */
xbt_assert(isfinite(priority), "priority is not finite!");
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTION_SET_PRIORITY;
- simcall->host_execution_set_priority.execution = execution;
- simcall->host_execution_set_priority.priority = priority;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_host_execution_set_priority(execution, priority);
}
/**
*/
e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_HOST_EXECUTION_WAIT;
- simcall->host_execution_wait.execution = execution;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->host_execution_wait.result = -1;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->host_execution_wait.result;
+ return simcall_BODY_host_execution_wait(execution);
}
/**
xbt_dict_t properties,
int auto_restart)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_CREATE;
- simcall->process_create.process = process;
- simcall->process_create.name = name;
- simcall->process_create.code = code;
- simcall->process_create.data = data;
- simcall->process_create.hostname = hostname;
- simcall->process_create.kill_time = kill_time;
- simcall->process_create.argc = argc;
- simcall->process_create.argv = argv;
- simcall->process_create.properties = properties;
- simcall->process_create.auto_restart = auto_restart;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_create(process, name, code, data, hostname,
+ kill_time, argc, argv, properties,
+ auto_restart);
}
/**
*/
void simcall_process_kill(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_KILL;
- simcall->process_kill.process = process;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_kill(process);
}
/**
*/
void simcall_process_killall(void)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_KILLALL;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_killall();
}
/**
*/
void simcall_process_cleanup(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_CLEANUP;
- simcall->process_cleanup.process = process;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_cleanup(process);
}
/**
*/
void simcall_process_change_host(smx_process_t process, smx_host_t dest)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_CHANGE_HOST;
- simcall->process_change_host.process = process;
- simcall->process_change_host.dest = dest;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_change_host(process, dest);
}
/**
{
xbt_assert(process, "Invalid parameters");
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_SUSPEND;
- simcall->process_suspend.process = process;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_suspend(process);
}
/**
*/
void simcall_process_resume(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_RESUME;
- simcall->process_resume.process = process;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_resume(process);
}
/**
*/
int simcall_process_count(void)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_COUNT;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->process_count.result = -1;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_count.result;
+ return simcall_BODY_process_count();
}
/**
return SIMIX_process_get_data(process);
}
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_GET_DATA;
- simcall->process_get_data.process = process;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->process_get_data.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_get_data.result;
+ return simcall_BODY_process_get_data(process);
}
/**
SIMIX_process_self_set_data(process, data);
}
else {
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_SET_DATA;
- simcall->process_set_data.process = process;
- simcall->process_set_data.data = data;
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_set_data(process, data);
}
}
*/
smx_host_t simcall_process_get_host(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_GET_HOST;
- simcall->process_get_host.process = process;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->process_get_host.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_get_host.result;
+ return simcall_BODY_process_get_host(process);
}
/**
/* avoid a simcall if this function is called by the process itself */
return process->name;
}
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_GET_NAME;
- simcall->process_get_name.process = process;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->process_get_name.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_get_name.result;
+ return simcall_BODY_process_get_name(process);
}
/**
*/
int simcall_process_is_suspended(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_IS_SUSPENDED;
- simcall->process_is_suspended.process = process;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->process_is_suspended.result = -1;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_is_suspended.result;
+ return simcall_BODY_process_is_suspended(process);
}
/**
*/
xbt_dict_t simcall_process_get_properties(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_GET_PROPERTIES;
- simcall->process_get_properties.process = process;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->process_get_properties.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_get_properties.result;
+ return simcall_BODY_process_get_properties(process);
}
/**
* \ingroup simix_process_management
*/
XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_ON_EXIT;
- simcall->process_on_exit.process = process;
- simcall->process_on_exit.fun = fun;
- simcall->process_on_exit.data = data;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_on_exit(process, fun, data);
}
/**
* \ingroup simix_process_management
XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int auto_restart)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_AUTO_RESTART_SET;
- simcall->process_auto_restart.process = process;
- simcall->process_auto_restart.auto_restart = auto_restart;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_process_auto_restart_set(process, auto_restart);
}
+
/**
* \ingroup simix_process_management
* \brief Restarts the process, killing it and starting it again from scratch.
*/
XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_RESTART;
- simcall->process_restart.process = process;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->process_restart.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->process_restart.result;
+ return simcall_BODY_process_restart(process);
}
/**
* \ingroup simix_process_management
{
/* checking for infinite values */
xbt_assert(isfinite(duration), "duration is not finite!");
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_PROCESS_SLEEP;
- simcall->process_sleep.duration = duration;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->process_sleep.result = -1;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->process_sleep.result;
+ return simcall_BODY_process_sleep(duration);
}
/**
*/
smx_rdv_t simcall_rdv_create(const char *name)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_RDV_CREATE;
- simcall->rdv_create.name = name;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->rdv_create.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->rdv_create.result;
+ return simcall_BODY_rdv_create(name);
}
*/
void simcall_rdv_destroy(smx_rdv_t rdv)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_RDV_DESTROY;
- simcall->rdv_destroy.rdv = rdv;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_rdv_destroy(rdv);
}
/**
* \ingroup simix_rdv_management
*/
int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_RDV_COMM_COUNT_BY_HOST;
- simcall->rdv_comm_count_by_host.rdv = rdv;
- simcall->rdv_comm_count_by_host.host = host;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->rdv_comm_count_by_host.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->rdv_comm_count_by_host.result;
+ return simcall_BODY_rdv_comm_count_by_host(rdv, host);
}
/**
*/
smx_action_t simcall_rdv_get_head(smx_rdv_t rdv)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_RDV_GET_HEAD;
- simcall->rdv_get_head.rdv = rdv;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->rdv_get_head.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->rdv_get_head.result;
+ return simcall_BODY_rdv_get_head(rdv);
}
-void simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process)
+void simcall_rdv_set_receiver(smx_rdv_t rdv, smx_process_t process)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_RDV_SET_RECV;
- simcall->rdv_set_rcv_proc.rdv = rdv;
- simcall->rdv_set_rcv_proc.receiver = process;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_rdv_set_receiver(rdv, process);
}
smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_RDV_GET_RECV;
- simcall->rdv_get_rcv_proc.rdv = rdv;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->rdv_get_rcv_proc.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->rdv_get_rcv_proc.result;
+ return simcall_BODY_rdv_get_receiver(rdv);
}
/**
simcall_comm_wait(comm, timeout);
}
else {
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_SEND;
- simcall->comm_send.rdv = rdv;
- simcall->comm_send.task_size = task_size;
- simcall->comm_send.rate = rate;
- simcall->comm_send.src_buff = src_buff;
- simcall->comm_send.src_buff_size = src_buff_size;
- simcall->comm_send.match_fun = match_fun;
- simcall->comm_send.data = data;
- simcall->comm_send.timeout = timeout;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_comm_send(rdv, task_size, rate, src_buff, src_buff_size,
+ match_fun, data, timeout);
}
}
+
/**
* \ingroup simix_comm_management
*/
xbt_assert(rdv, "No rendez-vous point defined for isend");
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_ISEND;
- simcall->comm_isend.rdv = rdv;
- simcall->comm_isend.task_size = task_size;
- simcall->comm_isend.rate = rate;
- simcall->comm_isend.src_buff = src_buff;
- simcall->comm_isend.src_buff_size = src_buff_size;
- simcall->comm_isend.match_fun = match_fun;
- simcall->comm_isend.clean_fun = clean_fun;
- simcall->comm_isend.data = data;
- simcall->comm_isend.detached = detached;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_isend.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_isend.result;
+ return simcall_BODY_comm_isend(rdv, task_size, rate, src_buff,
+ src_buff_size, match_fun,
+ clean_fun, data, detached);
}
/**
* \ingroup simix_comm_management
simcall_comm_wait(comm, timeout);
}
else {
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_RECV;
- simcall->comm_recv.rdv = rdv;
- simcall->comm_recv.dst_buff = dst_buff;
- simcall->comm_recv.dst_buff_size = dst_buff_size;
- simcall->comm_recv.match_fun = match_fun;
- simcall->comm_recv.data = data;
- simcall->comm_recv.timeout = timeout;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_comm_recv(rdv, dst_buff, dst_buff_size,
+ match_fun, data, timeout);
}
}
/**
* \ingroup simix_comm_management
*/
-smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
+smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size,
int (*match_fun)(void *, void *, smx_action_t), void *data)
{
xbt_assert(rdv, "No rendez-vous point defined for irecv");
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_IRECV;
- simcall->comm_irecv.rdv = rdv;
- simcall->comm_irecv.dst_buff = dst_buff;
- simcall->comm_irecv.dst_buff_size = dst_buff_size;
- simcall->comm_irecv.match_fun = match_fun;
- simcall->comm_irecv.data = data;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_irecv.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_irecv.result;
+ return simcall_BODY_comm_irecv(rdv, dst_buff, dst_buff_size,
+ match_fun, data);
}
{
xbt_assert(rdv, "No rendez-vous point defined for iprobe");
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_IPROBE;
- simcall->comm_iprobe.rdv = rdv;
- simcall->comm_iprobe.src = src;
- simcall->comm_iprobe.match_fun = match_fun;
- simcall->comm_iprobe.data = data;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_iprobe.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_iprobe.result;
+ return simcall_BODY_comm_iprobe(rdv, src, tag, match_fun, data);
}
-
void simcall_comm_destroy(smx_action_t comm)
{
xbt_assert(comm, "Invalid parameter");
SIMIX_simcall_push(simcall->issuer);
*/
}
+
/**
* \ingroup simix_comm_management
*/
void simcall_comm_cancel(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_CANCEL;
- simcall->comm_cancel.comm = comm;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_comm_cancel(comm);
}
+
/**
* \ingroup simix_comm_management
*/
unsigned int simcall_comm_waitany(xbt_dynar_t comms)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_WAITANY;
- simcall->comm_waitany.comms = comms;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->comm_waitany.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_waitany.result;
+ return simcall_BODY_comm_waitany(comms);
}
+
/**
* \ingroup simix_comm_management
*/
int simcall_comm_testany(xbt_dynar_t comms)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
if (xbt_dynar_is_empty(comms))
return -1;
-
- simcall->call = SIMCALL_COMM_TESTANY;
- simcall->comm_testany.comms = comms;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->comm_testany.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_testany.result;
+ return simcall_BODY_comm_testany(comms);
}
+
/**
* \ingroup simix_comm_management
*/
void simcall_comm_wait(smx_action_t comm, double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_WAIT;
- simcall->comm_wait.comm = comm;
- simcall->comm_wait.timeout = timeout;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_comm_wait(comm, timeout);
}
#ifdef HAVE_TRACING
if (category == NULL) {
return;
}
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SET_CATEGORY;
- simcall->set_category.action = action;
- simcall->set_category.category = category;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_set_category(action, category);
}
#endif
+
/**
* \ingroup simix_comm_management
*
*/
int simcall_comm_test(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_TEST;
- simcall->comm_test.comm = comm;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->comm_test.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_test.result;
+ return simcall_BODY_comm_test(comm);
}
+
/**
* \ingroup simix_comm_management
*
*/
double simcall_comm_get_remains(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_GET_REMAINS;
- simcall->comm_get_remains.comm = comm;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->comm_get_remains.result = 0.0;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_get_remains.result;
+ return simcall_BODY_comm_get_remains(comm);
}
+
/**
* \ingroup simix_comm_management
*
*/
e_smx_state_t simcall_comm_get_state(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_GET_STATE;
- simcall->comm_get_state.comm = comm;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->comm_get_state.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_get_state.result;
+ return simcall_BODY_comm_get_state(comm);
}
+
/**
* \ingroup simix_comm_management
*
*/
void *simcall_comm_get_src_data(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_GET_SRC_DATA;
- simcall->comm_get_src_data.comm = comm;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_get_src_data.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_get_src_data.result;
+ return simcall_BODY_comm_get_src_data(comm);
}
+
/**
* \ingroup simix_comm_management
*
*/
void *simcall_comm_get_dst_data(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_GET_DST_DATA;
- simcall->comm_get_dst_data.comm = comm;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_get_dst_data.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_get_dst_data.result;
+ return simcall_BODY_comm_get_dst_data(comm);
}
+
/**
* \ingroup simix_comm_management
*
*/
smx_process_t simcall_comm_get_src_proc(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_GET_SRC_PROC;
- simcall->comm_get_src_proc.comm = comm;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_get_src_proc.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_get_src_proc.result;
+ return simcall_BODY_comm_get_src_proc(comm);
}
+
/**
* \ingroup simix_comm_management
*
*/
smx_process_t simcall_comm_get_dst_proc(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_GET_DST_PROC;
- simcall->comm_get_dst_proc.comm = comm;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->comm_get_dst_proc.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_get_dst_proc.result;
+ return simcall_BODY_comm_get_dst_proc(comm);
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
int simcall_comm_is_latency_bounded(smx_action_t comm)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COMM_IS_LATENCY_BOUNDED;
- simcall->comm_is_latency_bounded.comm = comm;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->comm_is_latency_bounded.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->comm_is_latency_bounded.result;
+ return simcall_BODY_comm_is_latency_bounded(comm);
}
#endif
+
/**
* \ingroup simix_synchro_management
*
fprintf(stderr,"You must run MSG_init before using MSG\n"); // We can't use xbt_die since we may get there before the initialization
xbt_abort();
}
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_MUTEX_INIT;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->mutex_init.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->mutex_init.result;
+ return simcall_BODY_mutex_init();
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_mutex_destroy(smx_mutex_t mutex)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_MUTEX_DESTROY;
- simcall->mutex_destroy.mutex = mutex;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_mutex_destroy(mutex);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_mutex_lock(smx_mutex_t mutex)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_MUTEX_LOCK;
- simcall->mutex_lock.mutex = mutex;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_mutex_lock(mutex);
}
+
/**
* \ingroup simix_synchro_management
*
*/
int simcall_mutex_trylock(smx_mutex_t mutex)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_MUTEX_TRYLOCK;
- simcall->mutex_trylock.mutex = mutex;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->mutex_trylock.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->mutex_trylock.result;
+ return simcall_BODY_mutex_trylock(mutex);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_mutex_unlock(smx_mutex_t mutex)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_MUTEX_UNLOCK;
- simcall->mutex_unlock.mutex = mutex;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_mutex_unlock(mutex);
}
+
/**
* \ingroup simix_synchro_management
*
*/
smx_cond_t simcall_cond_init(void)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COND_INIT;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->cond_init.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->cond_init.result;
+ return simcall_BODY_cond_init();
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_cond_destroy(smx_cond_t cond)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COND_DESTROY;
- simcall->cond_destroy.cond = cond;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_cond_destroy(cond);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_cond_signal(smx_cond_t cond)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COND_SIGNAL;
- simcall->cond_signal.cond = cond;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_cond_signal(cond);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COND_WAIT;
- simcall->cond_wait.cond = cond;
- simcall->cond_wait.mutex = mutex;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_cond_wait(cond, mutex);
}
+
/**
* \ingroup simix_synchro_management
*
double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COND_WAIT_TIMEOUT;
- simcall->cond_wait_timeout.cond = cond;
- simcall->cond_wait_timeout.mutex = mutex;
- simcall->cond_wait_timeout.timeout = timeout;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_cond_broadcast(smx_cond_t cond)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_COND_BROADCAST;
- simcall->cond_broadcast.cond = cond;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_cond_broadcast(cond);
}
+
/**
* \ingroup simix_synchro_management
*
*/
smx_sem_t simcall_sem_init(int capacity)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_INIT;
- simcall->sem_init.capacity = capacity;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->sem_init.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->sem_init.result;
+ return simcall_BODY_sem_init(capacity);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_sem_destroy(smx_sem_t sem)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_DESTROY;
- simcall->sem_destroy.sem = sem;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_sem_destroy(sem);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_sem_release(smx_sem_t sem)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_RELEASE;
- simcall->sem_release.sem = sem;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_sem_release(sem);
}
+
/**
* \ingroup simix_synchro_management
*
*/
int simcall_sem_would_block(smx_sem_t sem)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_WOULD_BLOCK;
- simcall->sem_would_block.sem = sem;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->sem_would_block.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->sem_would_block.result;
+ return simcall_BODY_sem_would_block(sem);
}
+
/**
* \ingroup simix_synchro_management
*
*/
void simcall_sem_acquire(smx_sem_t sem)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_ACQUIRE;
- simcall->sem_acquire.sem = sem;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_sem_acquire(sem);
}
+
/**
* \ingroup simix_synchro_management
*
void simcall_sem_acquire_timeout(smx_sem_t sem, double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_ACQUIRE_TIMEOUT;
- simcall->sem_acquire_timeout.sem = sem;
- simcall->sem_acquire_timeout.timeout = timeout;
-
- SIMIX_simcall_push(simcall->issuer);
+ simcall_BODY_sem_acquire_timeout(sem, timeout);
}
+
/**
* \ingroup simix_synchro_management
*
*/
int simcall_sem_get_capacity(smx_sem_t sem)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_SEM_GET_CAPACITY;
- simcall->sem_get_capacity.sem = sem;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->sem_get_capacity.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
- return simcall->sem_get_capacity.result;
+ return simcall_BODY_sem_get_capacity(sem);
}
+
/**
* \ingroup simix_file_management
*
*/
double simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_FILE_READ;
- simcall->file_read.ptr = ptr;
- simcall->file_read.size = size;
- simcall->file_read.nmemb = nmemb;
- simcall->file_read.stream = stream;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->file_read.result = 0.0;
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->file_read.result;
+ return simcall_BODY_file_read(ptr, size, nmemb, stream);
}
+
/**
* \ingroup simix_file_management
*
*/
size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_FILE_WRITE;
- simcall->file_write.ptr = ptr;
- simcall->file_write.size = size;
- simcall->file_write.nmemb = nmemb;
- simcall->file_write.stream = stream;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->file_write.result = 0;
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->file_write.result;
+ return simcall_BODY_file_write(ptr, size, nmemb, stream);
}
+
/**
* \ingroup simix_file_management
* \brief
*/
smx_file_t simcall_file_open(const char* mount, const char* path, const char* mode)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_FILE_OPEN;
- simcall->file_open.mount = mount;
- simcall->file_open.path = path;
- simcall->file_open.mode = mode;
- if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
- simcall->file_open.result = NULL;
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->file_open.result;
+ return simcall_BODY_file_open(mount, path, mode);
}
+
/**
* \ingroup simix_file_management
*
*/
int simcall_file_close(smx_file_t fp)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
-
- simcall->call = SIMCALL_FILE_CLOSE;
- simcall->file_close.fp = fp;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->file_close.result = -1;
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->file_close.result;
+ return simcall_BODY_file_close(fp);
}
+
/**
* \ingroup simix_file_management
*
*/
int simcall_file_stat(smx_file_t fd, s_file_stat_t *buf)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
- simcall->call = SIMCALL_FILE_STAT;
- simcall->file_stat.fd = fd;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->file_stat.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
-
- *buf = simcall->file_stat.buf;
-
- return simcall->file_stat.result;
+ return simcall_BODY_file_stat(fd, buf);
}
/**
*/
int simcall_file_unlink(smx_file_t fd)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
- simcall->call = SIMCALL_FILE_UNLINK;
- simcall->file_unlink.fd = fd;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->file_unlink.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->file_unlink.result;
+ return simcall_BODY_file_unlink(fd);
}
/**
*/
xbt_dict_t simcall_file_ls(const char* mount, const char* path)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
- simcall->call = SIMCALL_FILE_LS;
- simcall->file_ls.mount = mount;
- simcall->file_ls.path = path;
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->file_ls.result = NULL;
-
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->file_ls.result;
+ return simcall_BODY_file_ls(mount, path);
}
#ifdef HAVE_MC
void *simcall_mc_snapshot(void)
{
- smx_simcall_t simcall = SIMIX_simcall_mine();
- simcall->call = SIMCALL_MC_SNAPSHOT;
-
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->mc_snapshot.s;
+ return simcall_BODY_mc_snapshot();
}
-int simcall_mc_compare_snapshots(void *s1, void *s2){
-
- smx_simcall_t simcall = SIMIX_simcall_mine();
- simcall->call = SIMCALL_MC_COMPARE_SNAPSHOTS;
- simcall->mc_compare_snapshots.snapshot1 = s1;
- simcall->mc_compare_snapshots.snapshot2 = s2;
-
- if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
- simcall->mc_compare_snapshots.result = -1;
-
- SIMIX_simcall_push(simcall->issuer);
-
- return simcall->mc_compare_snapshots.result;
+int simcall_mc_compare_snapshots(void *s1, void *s2){
+ return simcall_BODY_mc_compare_snapshots(s1, s2);
}
#endif /* HAVE_MC */
/* Fortran specific stuff */
/* With smpicc, the following weak symbols are used */
/* With smpiff, the following weak symbols are replaced by those in libf2c */
-
int __attribute__((weak)) xargc;
char** __attribute__((weak)) xargv;
int retval;
smpi_bench_end();
-
if (comm == MPI_COMM_NULL) {
retval = MPI_ERR_COMM;
} else if (src == MPI_PROC_NULL) {
xbt_dynar_free(&recvs);
}
TRACE_smpi_computing_in(rank_traced);
-
-
#endif
smpi_bench_begin();
return retval;
fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4);
}
}
-
}
void mmalloc_backtrace_fragment_display(void* heapinfo, int block, int frag){
mmalloc_backtrace_fragment_display(heap->heapinfo, block, frag_nb);
break;
}
-
}
}
}
-
}
while(i2 <= heaplimit && !equal){
heaplimit = 0, heapsize1 = 0, heapsize2 = 0;
return ((nb_diff1 > 0) || (nb_diff2 > 0));
-
}
static heap_area_t new_heap_area(int block, int fragment){