A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
simix
/
libsmx.cpp
diff --git
a/src/simix/libsmx.cpp
b/src/simix/libsmx.cpp
index
261f22c
..
46a9e5e
100644
(file)
--- a/
src/simix/libsmx.cpp
+++ b/
src/simix/libsmx.cpp
@@
-17,15
+17,17
@@
#include <xbt/functional.hpp>
#include <xbt/functional.hpp>
+#include <simgrid/s4u/VirtualMachine.hpp>
#include <simgrid/simix/blocking_simcall.hpp>
#include <simgrid/simix/blocking_simcall.hpp>
-#include "
src/mc/mc_replay
.h"
+#include "
mc/mc
.h"
#include "smx_private.h"
#include "smx_private.h"
+#include "src/kernel/activity/SynchroComm.hpp"
#include "src/mc/mc_forward.hpp"
#include "src/mc/mc_forward.hpp"
-#include "
xbt/ex
.h"
-#include "
mc/mc.h
"
+#include "
src/mc/mc_replay
.h"
+#include "
src/plugins/vm/VirtualMachineImpl.hpp
"
#include "src/simix/smx_host_private.h"
#include "src/simix/smx_host_private.h"
-#include "
src/kernel/activity/SynchroComm.hpp
"
+#include "
xbt/ex.h
"
#include <simgrid/simix.hpp>
#include <simgrid/simix.hpp>
@@
-95,15
+97,12
@@
smx_activity_t simcall_execution_start(const char *name,
* amount between each pair of hosts
* \param amount the SURF action amount
* \param rate the SURF action rate
* amount between each pair of hosts
* \param amount the SURF action amount
* \param rate the SURF action rate
+ * \param timeout timeout
* \return A new SIMIX execution synchronization
*/
* \return A new SIMIX execution synchronization
*/
-smx_activity_t simcall_execution_parallel_start(const char *name,
- int host_nb,
- sg_host_t *host_list,
- double *flops_amount,
- double *bytes_amount,
- double amount,
- double rate)
+smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list,
+ double* flops_amount, double* bytes_amount, double amount, double rate,
+ double timeout)
{
int i,j;
/* checking for infinite values */
{
int i,j;
/* checking for infinite values */
@@
-120,11
+119,8
@@
smx_activity_t simcall_execution_parallel_start(const char *name,
xbt_assert(std::isfinite(amount), "amount is not finite!");
xbt_assert(std::isfinite(rate), "rate is not finite!");
xbt_assert(std::isfinite(amount), "amount is not finite!");
xbt_assert(std::isfinite(rate), "rate is not finite!");
- return simcall_BODY_execution_parallel_start(name, host_nb, host_list,
- flops_amount,
- bytes_amount,
- amount, rate);
-
+ return simcall_BODY_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate,
+ timeout);
}
/**
}
/**
@@
-179,19
+175,23
@@
e_smx_state_t simcall_execution_wait(smx_activity_t execution)
return (e_smx_state_t) simcall_BODY_execution_wait(execution);
}
return (e_smx_state_t) simcall_BODY_execution_wait(execution);
}
-
/**
* \ingroup simix_vm_management
* \brief Create a VM on the given physical host.
*
* \param name VM name
/**
* \ingroup simix_vm_management
* \brief Create a VM on the given physical host.
*
* \param name VM name
- * \param
host Physical host
+ * \param
dest Physical host on which to create the VM
*
* \return The host object of the VM
*/
*
* \return The host object of the VM
*/
-sg_host_t simcall_vm_create(const char
*name, sg_host_t phys_ho
st)
+sg_host_t simcall_vm_create(const char
* name, sg_host_t de
st)
{
{
- return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_create, name, phys_host));
+ return simgrid::simix::kernelImmediate([&name, &dest] {
+ sg_host_t host = new simgrid::s4u::VirtualMachine(name, dest);
+ host->extension_set<simgrid::simix::Host>(new simgrid::simix::Host());
+
+ return host;
+ });
}
/**
}
/**
@@
-219,19
+219,27
@@
int simcall_vm_get_state(sg_host_t vm)
/**
* \ingroup simix_vm_management
/**
* \ingroup simix_vm_management
- * \brief Get the
name of the
physical host on which the given VM runs.
+ * \brief Get the physical host on which the given VM runs.
*
* \param vm VM
*
* \param vm VM
- * \return The
name of the
physical host
+ * \return The physical host
*/
void *simcall_vm_get_pm(sg_host_t vm)
{
*/
void *simcall_vm_get_pm(sg_host_t vm)
{
- return simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_get_pm, vm));
+ return simgrid::simix::kernelImmediate(
+ [vm]() { return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getPm(); });
}
}
+/**
+ * @brief Function to set the CPU bound of the given SIMIX VM host.
+ *
+ * @param host the vm host (a sg_host_t)
+ * @param bound bound (a double)
+ */
void simcall_vm_set_bound(sg_host_t vm, double bound)
{
void simcall_vm_set_bound(sg_host_t vm, double bound)
{
- simgrid::simix::kernelImmediate(std::bind(SIMIX_vm_set_bound, vm, bound));
+ simgrid::simix::kernelImmediate(
+ [vm, bound]() { static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->setBound(bound); });
}
/**
}
/**