- Change --cfg=tracing/msg/vm to --cfg=tracing/vm as virtual machine
behavior tracing is no longer limited to MSG
+MSG
+ - The deprecation of MSG is ongoing. A lot of functions are now simple
+ wrappers on the C API of S4U. All these wrappers (and their S4U counterparts
+ can be found in src/msg/msg_legacy.cpp).
+
S4U:
- Introduced new function simgrid::s4u::Host::get_actor_count. This function
returns the number of actors running on a specific host.
SG_BEGIN_DECL()
XBT_PUBLIC void sg_engine_load_platform(const char* filename);
XBT_PUBLIC void sg_engine_load_deployment(const char* filename);
+XBT_PUBLIC void sg_engine_run();
XBT_PUBLIC void sg_engine_register_function(const char* name, int (*code)(int, char**));
XBT_PUBLIC void sg_engine_register_default(int (*code)(int, char**));
XBT_PUBLIC double sg_engine_get_clock();
--- /dev/null
+/* Copyright (c) 2018. 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. */
+
+#ifndef INCLUDE_SIMGRID_MAILBOX_H_
+#define INCLUDE_SIMGRID_MAILBOX_H_
+
+#include <simgrid/forward.h>
+#include <xbt/base.h>
+
+/* C interface */
+SG_BEGIN_DECL()
+
+void sg_mailbox_set_receiver(const char* alias);
+int sg_mailbox_listen(const char* alias);
+
+SG_END_DECL()
+
+#endif /* INCLUDE_SIMGRID_MAILBOX_H_ */
#include <simgrid/forward.h>
#include <simgrid/host.h>
#include <simgrid/instr.h>
+#include <simgrid/mailbox.h>
#include <simgrid/plugins/live_migration.h>
#include <simgrid/storage.h>
#include <simgrid/vm.h>
JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setAsyncMailbox(JNIEnv * env, jclass cls_arg, jobject jname)
{
const char *name = env->GetStringUTFChars((jstring) jname, 0);
- MSG_mailbox_set_async(name);
+ sg_mailbox_set_receiver(name);
env->ReleaseStringUTFChars((jstring) jname, name);
}
atexit(MSG_exit);
}
-/** \ingroup msg_simulation
- * \brief Launch the MSG simulation
- */
-msg_error_t MSG_main()
-{
- /* Clean IO before the run */
- fflush(stdout);
- fflush(stderr);
-
- if (MC_is_active()) {
- MC_run();
- } else {
- SIMIX_run();
- }
- return MSG_OK;
-}
-
/** \ingroup msg_simulation
* \brief set a configuration variable
*
return MSG_task_send_with_timeout(task, alias, timeout);
}
-/** \ingroup msg_task_usage
- * \brief Check if there is a communication going on in a mailbox.
- *
- * \param alias the name of the mailbox to be considered
- *
- * \return Returns 1 if there is a communication, 0 otherwise
- */
-int MSG_task_listen(const char *alias)
-{
- simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::by_name(alias);
- return mbox->listen() ? 1 : 0;
-}
-
/** \ingroup msg_task_usage
* \brief Look if there is a communication on a mailbox and return the PID of the sender process.
*
{
sg_engine_load_deployment(filename);
}
+msg_error_t MSG_main()
+{
+ sg_engine_run();
+ return MSG_OK;
+}
void MSG_function_register(const char* name, xbt_main_func_t code)
{
sg_engine_register_function(name, code);
{
return sg_engine_get_clock();
}
+
+/* ************************** Mailboxes ************************ */
+void MSG_mailbox_set_async(const char* alias)
+{
+ sg_mailbox_set_receiver(alias);
+}
+int MSG_task_listen(const char* alias)
+{
+ return sg_mailbox_listen(alias);
+}
+
/* ************************** Actors *************************** */
int MSG_process_get_PID(sg_actor_t actor)
{
+++ /dev/null
-/* Mailboxes in MSG */
-
-/* Copyright (c) 2008-2018. 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 "simgrid/s4u/Mailbox.hpp"
-#include "src/msg/msg_private.hpp"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mailbox)");
-
-/** \ingroup msg_mailbox_management
- * \brief Set the mailbox to receive in asynchronous mode
- *
- * All messages sent to this mailbox will be transferred to the receiver without waiting for the receive call.
- * The receive call will still be necessary to use the received data.
- * If there is a need to receive some messages asynchronously, and some not, two different mailboxes should be used.
- *
- * \param alias The name of the mailbox
- */
-void MSG_mailbox_set_async(const char *alias){
- simgrid::s4u::Mailbox::by_name(alias)->set_receiver(simgrid::s4u::Actor::self());
- XBT_VERB("%s mailbox set to receive eagerly for myself\n",alias);
-}
void Engine::run()
{
+ /* Clean IO before the run */
+ fflush(stdout);
+ fflush(stderr);
+
if (MC_is_active()) {
MC_run();
} else {
{
simgrid::s4u::Engine::get_instance()->load_deployment(file);
}
-
+void sg_engine_run()
+{
+ simgrid::s4u::Engine::get_instance()->run();
+}
void sg_engine_register_function(const char* name, int (*code)(int, char**))
{
simgrid::s4u::Engine::get_instance()->register_function(name, code);
}
} // namespace s4u
} // namespace simgrid
+
+/* **************************** Public C interface *************************** */
+/** \brief Set the mailbox to receive in asynchronous mode
+ *
+ * All messages sent to this mailbox will be transferred to the receiver without waiting for the receive call.
+ * The receive call will still be necessary to use the received data.
+ * If there is a need to receive some messages asynchronously, and some not, two different mailboxes should be used.
+ *
+ * \param alias The name of the mailbox
+ */
+void sg_mailbox_set_receiver(const char* alias)
+{
+ simgrid::s4u::Mailbox::by_name(alias)->set_receiver(simgrid::s4u::Actor::self());
+ XBT_VERB("%s mailbox set to receive eagerly for myself\n", alias);
+}
+
+/** \brief Check if there is a communication going on in a mailbox.
+ *
+ * \param alias the name of the mailbox to be considered
+ * \return Returns 1 if there is a communication, 0 otherwise
+ */
+int sg_mailbox_listen(const char* alias)
+{
+ return simgrid::s4u::Mailbox::by_name(alias)->listen() ? 1 : 0;
+}
src/msg/msg_global.cpp
src/msg/msg_gos.cpp
src/msg/msg_legacy.cpp
- src/msg/msg_mailbox.cpp
src/msg/msg_process.cpp
src/msg/msg_synchro.cpp
src/msg/msg_task.cpp
include/simgrid/plugins/load_balancer.h
include/simgrid/smpi/replay.hpp
include/simgrid/instr.h
+ include/simgrid/mailbox.h
include/simgrid/msg.h
include/simgrid/simdag.h
include/simgrid/modelchecker.h