include examples/c/actor-join/actor-join.tesh
include examples/c/actor-kill/actor-kill.c
include examples/c/actor-kill/actor-kill.tesh
+include examples/c/actor-migrate/actor-migrate.c
+include examples/c/actor-migrate/actor-migrate.tesh
+include examples/c/actor-suspend/actor-suspend.c
+include examples/c/actor-suspend/actor-suspend.tesh
+include examples/c/actor-yield/actor-yield.c
+include examples/c/actor-yield/actor-yield.tesh
+include examples/c/actor-yield/actor-yield_d.xml
include examples/c/app-pingpong/app-pingpong.c
include examples/c/app-pingpong/app-pingpong.tesh
include examples/c/app-pingpong/app-pingpong_d.xml
include teshsuite/msg/process-lifetime/process-lifetime.tesh
include teshsuite/msg/process-lifetime/start_d.xml
include teshsuite/msg/process-lifetime/start_kill_d.xml
-include teshsuite/msg/process-migration/process-migration.c
-include teshsuite/msg/process-migration/process-migration.tesh
-include teshsuite/msg/process-suspend/process-suspend.c
-include teshsuite/msg/process-suspend/process-suspend.tesh
-include teshsuite/msg/process-yield/process-yield.c
-include teshsuite/msg/process-yield/process-yield.tesh
-include teshsuite/msg/process-yield/process-yield_d.xml
include teshsuite/msg/task-priority/task-priority.c
include teshsuite/msg/task-priority/task-priority.tesh
include teshsuite/msg/task-priority/task-priority_d.xml
foreach(x
- actor-create actor-daemon actor-join actor-kill
+ actor-create actor-daemon actor-join actor-kill actor-migrate actor-suspend actor-yield
app-pingpong app-token-ring async-waitany io-disk-raw)
add_executable (${x}-c EXCLUDE_FROM_ALL ${x}/${x}.c)
target_link_libraries(${x}-c simgrid)
set(tesh_files ${tesh_files} PARENT_SCOPE)
set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/actor-create_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/actor-yield_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-waitany/async-waitany_d.xml
PARENT_SCOPE)
foreach(x
- actor-create actor-daemon actor-join actor-kill
+ actor-create actor-daemon actor-join actor-kill actor-migrate actor-suspend actor-yield
app-pingpong app-token-ring async-waitany io-disk-raw)
ADD_TESH(c-${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
--setenv bindir=${CMAKE_BINARY_DIR}/examples/c/${x}
--- /dev/null
+/* Copyright (c) 2009-2020. 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/actor.h"
+#include "simgrid/barrier.h"
+#include "simgrid/engine.h"
+#include "simgrid/host.h"
+
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(actor_migrate, "Messages specific for this example");
+
+static void worker(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+ sg_host_t first = sg_host_by_name(argv[1]);
+ sg_host_t second = sg_host_by_name(argv[2]);
+
+ double flopAmount = sg_host_speed(first) * 5 + sg_host_speed(second) * 5;
+
+ XBT_INFO("Let's move to %s to execute %.2f Mflops (5sec on %s and 5sec on %s)", argv[1], flopAmount / 1e6, argv[1],
+ argv[2]);
+
+ sg_actor_set_host(sg_actor_self(), first);
+ sg_actor_self_execute(flopAmount);
+
+ XBT_INFO("I wake up on %s. Let's suspend a bit", sg_host_get_name(sg_host_self()));
+
+ sg_actor_suspend(sg_actor_self());
+
+ XBT_INFO("I wake up on %s", sg_host_get_name(sg_host_self()));
+ XBT_INFO("Done");
+}
+
+static void monitor(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+ sg_host_t jacquelin = sg_host_by_name("Jacquelin");
+ sg_host_t fafard = sg_host_by_name("Fafard");
+
+ int actor_argc = 3;
+ const char* actor_argv[] = {"worker", "Boivin", "Jacquelin", NULL};
+ sg_actor_t actor = sg_actor_init("worker", sg_host_by_name("Fafard"));
+ sg_actor_start(actor, worker, actor_argc, actor_argv);
+
+ sg_actor_sleep_for(5);
+
+ XBT_INFO("After 5 seconds, move the process to %s", sg_host_get_name(jacquelin));
+ sg_actor_set_host(actor, jacquelin);
+
+ sg_actor_sleep_until(15);
+ XBT_INFO("At t=15, move the process to %s and resume it.", sg_host_get_name(fafard));
+ sg_actor_set_host(actor, fafard);
+ sg_actor_resume(actor);
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid_init(&argc, argv);
+ xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+ simgrid_load_platform(argv[1]); /* - Load the platform description */
+ /* - Create and deploy the emigrant and policeman processes */
+ sg_actor_t actor = sg_actor_init("monitor", sg_host_by_name("Boivin"));
+ sg_actor_start(actor, monitor, 0, NULL);
+
+ simgrid_run();
+
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+p Testing the actor migration feature
+
+$ ${bindir:=.}/actor-migrate-c ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+> [ 0.000000] (worker@Fafard) Let's move to Boivin to execute 1177.14 Mflops (5sec on Boivin and 5sec on Jacquelin)
+> [ 5.000000] (monitor@Boivin) After 5 seconds, move the process to Jacquelin
+> [ 10.000000] (worker@Jacquelin) I wake up on Jacquelin. Let's suspend a bit
+> [ 15.000000] (monitor@Boivin) At t=15, move the process to Fafard and resume it.
+> [ 15.000000] (worker@Fafard) I wake up on Fafard
+> [ 15.000000] (worker@Fafard) Done
--- /dev/null
+/* Copyright (c) 2007-2020. 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/actor.h"
+#include "simgrid/engine.h"
+#include "simgrid/host.h"
+
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(actor_suspend, "Messages specific for this example");
+
+/* The Lazy guy only wants to sleep, but can be awaken by the dream_master process. */
+static void lazy_guy(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+ XBT_INFO("Nobody's watching me ? Let's go to sleep.");
+ sg_actor_suspend(sg_actor_self()); /* - Start by suspending itself */
+ XBT_INFO("Uuuh ? Did somebody call me ?");
+
+ XBT_INFO("Going to sleep..."); /* - Then repetitively go to sleep, but got awaken */
+ sg_actor_sleep_for(10.0);
+ XBT_INFO("Mmm... waking up.");
+
+ XBT_INFO("Going to sleep one more time (for 10 sec)...");
+ sg_actor_sleep_for(10.0);
+ XBT_INFO("Waking up once for all!");
+
+ XBT_INFO("Ok, let's do some work, then (for 10 sec on Boivin).");
+ sg_actor_self_execute(980.95e6);
+
+ XBT_INFO("Mmmh, I'm done now. Goodbye.");
+}
+
+/* The Dream master: */
+static void dream_master(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+{
+ XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */
+ sg_actor_t lazy = sg_actor_init("Lazy", sg_host_self());
+ sg_actor_start(lazy, lazy_guy, 0, NULL);
+ XBT_INFO("Let's wait a little bit...");
+ sg_actor_sleep_for(10.0); /* - Wait for 10 seconds */
+ XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
+ sg_actor_resume(lazy); /* - Then wake up the lazy_guy */
+
+ sg_actor_sleep_for(5.0); /* Repeat two times: */
+ XBT_INFO("Suspend the lazy guy while he's sleeping...");
+ sg_actor_suspend(lazy); /* - Suspend the lazy_guy while he's asleep */
+ XBT_INFO("Let him finish his siesta.");
+ sg_actor_sleep_for(10.0); /* - Wait for 10 seconds */
+ XBT_INFO("Wake up, lazy guy!");
+ sg_actor_resume(lazy); /* - Then wake up the lazy_guy again */
+
+ sg_actor_sleep_for(5.0);
+ XBT_INFO("Suspend again the lazy guy while he's sleeping...");
+ sg_actor_suspend(lazy);
+ XBT_INFO("This time, don't let him finish his siesta.");
+ sg_actor_sleep_for(2.0);
+ XBT_INFO("Wake up, lazy guy!");
+ sg_actor_resume(lazy);
+
+ sg_actor_sleep_for(5.0);
+ XBT_INFO("Give a 2 seconds break to the lazy guy while he's working...");
+ sg_actor_suspend(lazy);
+ sg_actor_sleep_for(2.0);
+ XBT_INFO("Back to work, lazy guy!");
+ sg_actor_resume(lazy);
+
+ XBT_INFO("OK, I'm done here.");
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid_init(&argc, argv);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+
+ simgrid_load_platform(argv[1]);
+ simgrid_register_function("dream_master", dream_master);
+
+ sg_actor_t actor = sg_actor_init("dream_master", sg_host_by_name("Boivin"));
+ sg_actor_start(actor, dream_master, 0, NULL);
+
+ simgrid_run();
+
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+! output sort 19
+$ ${bindir:=.}/actor-suspend-c ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+> [ 0.000000] (dream_master@Boivin) Let's create a lazy guy.
+> [ 0.000000] (Lazy@Boivin) Nobody's watching me ? Let's go to sleep.
+> [ 0.000000] (dream_master@Boivin) Let's wait a little bit...
+> [ 10.000000] (dream_master@Boivin) Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!
+> [ 10.000000] (Lazy@Boivin) Uuuh ? Did somebody call me ?
+> [ 10.000000] (Lazy@Boivin) Going to sleep...
+> [ 15.000000] (dream_master@Boivin) Suspend the lazy guy while he's sleeping...
+> [ 15.000000] (dream_master@Boivin) Let him finish his siesta.
+> [ 25.000000] (dream_master@Boivin) Wake up, lazy guy!
+> [ 25.000000] (Lazy@Boivin) Mmm... waking up.
+> [ 25.000000] (Lazy@Boivin) Going to sleep one more time (for 10 sec)...
+> [ 30.000000] (dream_master@Boivin) Suspend again the lazy guy while he's sleeping...
+> [ 30.000000] (dream_master@Boivin) This time, don't let him finish his siesta.
+> [ 32.000000] (dream_master@Boivin) Wake up, lazy guy!
+> [ 35.000000] (Lazy@Boivin) Waking up once for all!
+> [ 35.000000] (Lazy@Boivin) Ok, let's do some work, then (for 10 sec on Boivin).
+> [ 37.000000] (dream_master@Boivin) Give a 2 seconds break to the lazy guy while he's working...
+> [ 39.000000] (dream_master@Boivin) Back to work, lazy guy!
+> [ 39.000000] (dream_master@Boivin) OK, I'm done here.
+> [ 47.000000] (Lazy@Boivin) Mmmh, I'm done now. Goodbye.
/* 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/msg.h"
+#include "simgrid/actor.h"
+#include "simgrid/engine.h"
-#include <stdio.h> /* snprintf */
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+#include "xbt/str.h"
/* This example does not much: It just spans over-polite processes that yield a large amount
* of time before ending.
* It can also be used to benchmark our context-switching mechanism.
*/
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_yield, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(actor_yield, "Messages specific for this example");
/* Main function of the Yielder process */
-static int yielder(int argc, char* argv[])
+static void yielder(int argc, char* argv[])
{
xbt_assert(argc == 2, "The sender function expects 1 arguments from the XML deployment file");
long number_of_yields = xbt_str_parse_int(argv[1], "Invalid amount of yields: %s"); /* - number of yields */
for (int i = 0; i < number_of_yields; i++)
- MSG_process_yield();
+ sg_actor_yield();
XBT_INFO("I yielded %ld times. Goodbye now!", number_of_yields);
- return 0;
}
int main(int argc, char* argv[])
{
- MSG_init(&argc, argv);
- xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
- "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+ simgrid_init(&argc, argv);
+ xbt_assert(argc > 2,
+ "Usage: %s platform_file deployment_file\n"
+ "\tExample: %s msg_platform.xml msg_deployment.xml\n",
argv[0], argv[0]);
- MSG_create_environment(argv[1]); /* - Load the platform description */
-
- MSG_function_register("yielder", yielder);
- MSG_launch_application(argv[2]); /* - Deploy the sender and receiver processes */
+ simgrid_load_platform(argv[1]); /* - Load the platform description */
- msg_error_t res = MSG_main(); /* - Run the simulation */
+ simgrid_register_function("yielder", yielder);
+ simgrid_load_deployment(argv[2]); /* - Deploy the sender and receiver processes */
- return res != MSG_OK;
+ simgrid_run();
+ return 0;
}
#!/usr/bin/env tesh
-$ ${bindir:=.}/process-yield ${platfdir}/small_platform_fatpipe.xml ${srcdir:=.}/process-yield_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/actor-yield-c ${platfdir}/small_platform_fatpipe.xml ${srcdir:=.}/actor-yield_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:yielder@Tremblay) I yielded 10 times. Goodbye now!
> [ 0.000000] (2:yielder@Ruby) I yielded 15 times. Goodbye now!
foreach(x async-wait async-waitall async-waitany
cloud-capping cloud-migration cloud-two-tasks cloud-simple
get_sender host_on_off host_on_off_recv
- process-lifetime process-migration process-suspend process-yield
+ process-lifetime
energy-consumption energy-ptask energy-pstate platform-properties
io-file io-file-remote
task-priority
${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/kill_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/start_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/process-lifetime/start_kill_d.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/process-yield/process-yield_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/task-priority/task-priority_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp1.0-hbp1.0.xml
${CMAKE_CURRENT_SOURCE_DIR}/trace_integration/test-hbp1.0-hbp3.0-hbp4.0.xml
host_on_off host_on_off_processes host_on_off_recv
get_sender
task_destroy_cancel task_listen_from task_progress
- process-lifetime process-migration process-suspend process-yield
+ process-lifetime
energy-consumption energy-ptask
io-file io-file-remote
platform-properties
+++ /dev/null
-/* Copyright (c) 2009-2020. 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/msg.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_process_migration, "Messages specific for this msg example");
-
-msg_bar_t barrier;
-static msg_process_t controlled_process = NULL;
-
-/* The Emigrant process will be moved from host to host. */
-static int emigrant(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- XBT_INFO("I'll look for a new job on another machine ('Boivin') where the grass is greener.");
- MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin")); /* - First, move to another host by myself */
-
- XBT_INFO("Yeah, found something to do");
- msg_task_t task = MSG_task_create("job", 98095000, 0, NULL); /* - Execute some work there */
- MSG_task_execute(task);
- MSG_task_destroy(task);
- MSG_process_sleep(2);
- XBT_INFO("Moving back home after work");
- MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Jacquelin")); /* - Move back to original location */
- MSG_process_migrate(MSG_process_self(), MSG_host_by_name("Boivin")); /* - Go back to the other host to sleep*/
- MSG_process_sleep(4);
- controlled_process = MSG_process_self(); /* - Get controlled at checkpoint */
- MSG_barrier_wait(barrier);
- MSG_process_suspend(MSG_process_self());
- const_sg_host_t h = MSG_process_get_host(MSG_process_self());
- XBT_INFO("I've been moved on this new host: %s", MSG_host_get_name(h));
- XBT_INFO("Uh, nothing to do here. Stopping now");
- return 0;
-}
-
-/* The policeman check for emigrants and move them back to 'Jacquelin' */
-static int policeman(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- XBT_INFO("Wait at the checkpoint."); /* - block on the mutex+condition */
- MSG_barrier_wait(barrier);
- MSG_process_migrate(controlled_process, MSG_host_by_name("Jacquelin")); /* - Move an emigrant to Jacquelin */
- XBT_INFO("I moved the emigrant");
- MSG_process_resume(controlled_process);
-
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
- MSG_init(&argc, argv);
- xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
-
- MSG_create_environment(argv[1]); /* - Load the platform description */
- /* - Create and deploy the emigrant and policeman processes */
- MSG_process_create("emigrant", emigrant, NULL, MSG_get_host_by_name("Jacquelin"));
- MSG_process_create("policeman", policeman, NULL, MSG_get_host_by_name("Boivin"));
-
- barrier = MSG_barrier_init(2);
- msg_error_t res = MSG_main(); /* - Run the simulation */
- XBT_INFO("Simulation time %g", MSG_get_clock());
- MSG_barrier_destroy(barrier);
-
- return res != MSG_OK;
-}
+++ /dev/null
-#!/usr/bin/env tesh
-
-p Testing the migration feature of MSG
-
-! output sort 19
-$ ${bindir:=.}/process-migration ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 0.000000] (1:emigrant@Jacquelin) I'll look for a new job on another machine ('Boivin') where the grass is greener.
-> [ 0.000000] (1:emigrant@Boivin) Yeah, found something to do
-> [ 0.000000] (2:policeman@Boivin) Wait at the checkpoint.
-> [ 3.000000] (1:emigrant@Boivin) Moving back home after work
-> [ 7.000000] (0:maestro@) Simulation time 7
-> [ 7.000000] (1:emigrant@Jacquelin) I've been moved on this new host: Jacquelin
-> [ 7.000000] (1:emigrant@Jacquelin) Uh, nothing to do here. Stopping now
-> [ 7.000000] (2:policeman@Boivin) I moved the emigrant
+++ /dev/null
-/* Copyright (c) 2007-2020. 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/msg.h"
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_process_suspend, "Messages specific for this msg example");
-
-/* The Lazy guy only wants to sleep, but can be awaken by the dream_master process. */
-static int lazy_guy(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- XBT_INFO("Nobody's watching me ? Let's go to sleep.");
- MSG_process_suspend(MSG_process_self()); /* - Start by suspending itself */
- XBT_INFO("Uuuh ? Did somebody call me ?");
-
- XBT_INFO("Going to sleep..."); /* - Then repetitively go to sleep, but got awaken */
- MSG_process_sleep(10.0);
- XBT_INFO("Mmm... waking up.");
-
- XBT_INFO("Going to sleep one more time (for 10 sec)...");
- MSG_process_sleep(10.0);
- XBT_INFO("Waking up once for all!");
-
- XBT_INFO("Ok, let's do some work, then (for 10 sec on Boivin).");
- msg_task_t task = MSG_task_create("easy work", 980.95e6, 0, NULL);
- MSG_task_execute(task);
- MSG_task_destroy(task);
-
- XBT_INFO("Mmmh, I'm done now. Goodbye.");
- return 0;
-}
-
-/* The Dream master: */
-static int dream_master(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */
- msg_process_t lazy = MSG_process_create("Lazy", lazy_guy, NULL, MSG_host_self());
- XBT_INFO("Let's wait a little bit...");
- MSG_process_sleep(10.0); /* - Wait for 10 seconds */
- XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
- MSG_process_resume(lazy); /* - Then wake up the lazy_guy */
-
- MSG_process_sleep(5.0); /* Repeat two times: */
- XBT_INFO("Suspend the lazy guy while he's sleeping...");
- MSG_process_suspend(lazy); /* - Suspend the lazy_guy while he's asleep */
- XBT_INFO("Let him finish his siesta.");
- MSG_process_sleep(10.0); /* - Wait for 10 seconds */
- XBT_INFO("Wake up, lazy guy!");
- MSG_process_resume(lazy); /* - Then wake up the lazy_guy again */
-
- MSG_process_sleep(5.0);
- XBT_INFO("Suspend again the lazy guy while he's sleeping...");
- MSG_process_suspend(lazy);
- XBT_INFO("This time, don't let him finish his siesta.");
- MSG_process_sleep(2.0);
- XBT_INFO("Wake up, lazy guy!");
- MSG_process_resume(lazy);
-
- MSG_process_sleep(5.0);
- XBT_INFO("Give a 2 seconds break to the lazy guy while he's working...");
- MSG_process_suspend(lazy);
- MSG_process_sleep(2.0);
- XBT_INFO("Back to work, lazy guy!");
- MSG_process_resume(lazy);
-
- XBT_INFO("OK, I'm done here.");
- return 0;
-}
-
-int main(int argc, char* argv[])
-{
- MSG_init(&argc, argv);
- xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
-
- MSG_create_environment(argv[1]); /* - Load the platform description */
- MSG_function_register("dream_master", dream_master); /* - Create and deploy the dream_master */
- xbt_dynar_t hosts = MSG_hosts_as_dynar();
- MSG_process_create("dream_master", dream_master, NULL, xbt_dynar_getfirst_as(hosts, msg_host_t));
- xbt_dynar_free(&hosts);
- msg_error_t res = MSG_main(); /* - Run the simulation */
-
- return res != MSG_OK;
-}
+++ /dev/null
-#!/usr/bin/env tesh
-
-p Testing the suspend/resume feature of MSG
-
-! output sort 19
-$ ${bindir:=.}/process-suspend ${platfdir:=.}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
-> [ 0.000000] (1:dream_master@Boivin) Let's create a lazy guy.
-> [ 0.000000] (2:Lazy@Boivin) Nobody's watching me ? Let's go to sleep.
-> [ 0.000000] (1:dream_master@Boivin) Let's wait a little bit...
-> [ 10.000000] (1:dream_master@Boivin) Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!
-> [ 10.000000] (2:Lazy@Boivin) Uuuh ? Did somebody call me ?
-> [ 10.000000] (2:Lazy@Boivin) Going to sleep...
-> [ 15.000000] (1:dream_master@Boivin) Suspend the lazy guy while he's sleeping...
-> [ 15.000000] (1:dream_master@Boivin) Let him finish his siesta.
-> [ 25.000000] (1:dream_master@Boivin) Wake up, lazy guy!
-> [ 25.000000] (2:Lazy@Boivin) Mmm... waking up.
-> [ 25.000000] (2:Lazy@Boivin) Going to sleep one more time (for 10 sec)...
-> [ 30.000000] (1:dream_master@Boivin) Suspend again the lazy guy while he's sleeping...
-> [ 30.000000] (1:dream_master@Boivin) This time, don't let him finish his siesta.
-> [ 32.000000] (1:dream_master@Boivin) Wake up, lazy guy!
-> [ 35.000000] (2:Lazy@Boivin) Waking up once for all!
-> [ 35.000000] (2:Lazy@Boivin) Ok, let's do some work, then (for 10 sec on Boivin).
-> [ 37.000000] (1:dream_master@Boivin) Give a 2 seconds break to the lazy guy while he's working...
-> [ 39.000000] (1:dream_master@Boivin) Back to work, lazy guy!
-> [ 39.000000] (1:dream_master@Boivin) OK, I'm done here.
-> [ 47.000000] (2:Lazy@Boivin) Mmmh, I'm done now. Goodbye.