examples/deprecated/msg/mc/centralized_mutex
examples/deprecated/msg/mc/electric_fence
examples/deprecated/msg/synchro-semaphore/synchro-semaphore
-examples/deprecated/msg/trace-process-migration/trace-process-migration
examples/deprecated/msg/*.pcap
examples/deprecated/msg/*.tr
examples/s4u/actor-create/s4u-actor-create
examples/s4u/trace-link-user-variables/s4u-trace-link-user-variables
examples/s4u/trace-masterworkers/s4u-trace-masterworkers
examples/s4u/trace-platform/s4u-trace-platform
+examples/s4u/trace-process-migration/s4u-trace-process-migration
examples/s4u/trace-route-user-variables/s4u-trace-route-user-variables
examples/deprecated/simdag/dag-dotload/sd_dag-dotload
examples/deprecated/simdag/daxload/sd_daxload
include examples/deprecated/msg/mc/deploy_bugged2_liveness.xml
include examples/deprecated/msg/mc/deploy_centralized_mutex.xml
include examples/deprecated/msg/mc/promela_bugged2_liveness
-include examples/deprecated/msg/trace-process-migration/trace-process-migration.c
-include examples/deprecated/msg/trace-process-migration/trace-process-migration.tesh
include examples/deprecated/simdag/dag-dotload/dag.dot
include examples/deprecated/simdag/dag-dotload/dag_with_cycle.dot
include examples/deprecated/simdag/dag-dotload/sd_dag-dotload.c
include examples/s4u/trace-masterworkers/s4u-trace-masterworkers.tesh
include examples/s4u/trace-platform/s4u-trace-platform.cpp
include examples/s4u/trace-platform/s4u-trace-platform.tesh
+include examples/s4u/trace-process-migration/s4u-trace-process-migration.cpp
+include examples/s4u/trace-process-migration/s4u-trace-process-migration.tesh
include examples/s4u/trace-route-user-variables/s4u-trace-route-user-variables.cpp
include examples/s4u/trace-route-user-variables/s4u-trace-route-user-variables.tesh
include examples/smpi/NAS/DGraph.c
-foreach(x trace-process-migration)
- if(enable_msg)
- add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.c)
- target_link_libraries(${x} simgrid)
- set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
- add_dependencies(tests ${x})
- endif()
- set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
- set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
-endforeach()
-
set(examples_src ${examples_src} PARENT_SCOPE)
set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/README.doc PARENT_SCOPE)
set(tesh_files ${tesh_files} PARENT_SCOPE)
-
-if(enable_msg)
- foreach (x trace-process-migration)
- ADD_TESH(msg-${x} --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x}
- --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}
- --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
- --cd ${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x}
- ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh)
- endforeach()
-endif(enable_msg)
+++ /dev/null
-/* Copyright (c) 2010-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"
-
-/* The guy we will move from host to host. It move alone and then is moved by policeman back */
-static int emigrant(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- msg_task_t task = NULL;
- char *destination = NULL;
-
- MSG_process_sleep(2);
-
- while (1){ // I am an eternal emigrant
- MSG_task_receive(&(task), "master_mailbox");
- destination = (char*)MSG_task_get_data (task);
- MSG_task_destroy (task);
- if (destination == NULL)
- break; //there is no destination, die
- MSG_process_migrate(MSG_process_self(), MSG_host_by_name(destination));
- MSG_process_sleep(2); // I am tired, have to sleep for 2 seconds
- free (destination);
- task = NULL;
- }
- return 0;
-}
-
-static int policeman(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
-{
- // I am the master of emigrant process,
- // I tell it where it must emigrate to.
- xbt_dynar_t destinations = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Tremblay"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Jupiter"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Fafard"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Ginette"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Bourassa"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Fafard"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Tremblay"));
- xbt_dynar_push_as (destinations, char*, xbt_strdup ("Ginette"));
- xbt_dynar_push_as (destinations, char*, NULL);
-
- char *destination;
- unsigned int i;
- xbt_dynar_foreach(destinations, i, destination){
- msg_task_t task = MSG_task_create("task", 0, 0, NULL);
- if (destination != NULL){
- MSG_task_set_data(task, xbt_strdup (destination));
- }
- MSG_task_set_category(task, "migration_order");
- MSG_task_send (task, "master_mailbox");
- }
- xbt_dynar_free (&destinations);
- 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]);
-
- TRACE_category ("migration_order");
-
- MSG_process_create("emigrant", emigrant, NULL, MSG_get_host_by_name("Fafard"));
- MSG_process_create("policeman", policeman, NULL, MSG_get_host_by_name("Tremblay"));
-
- MSG_main();
- return 0;
-}
# Examples not accepting factories
##################################
-foreach (example trace-categories trace-platform trace-masterworkers
+foreach (example trace-categories trace-masterworkers trace-platform trace-process-migration
trace-host-user-variables trace-link-user-variables trace-route-user-variables)
add_executable (s4u-${example} EXCLUDE_FROM_ALL ${example}/s4u-${example}.cpp)
target_link_libraries(s4u-${example} simgrid)
--- /dev/null
+/* Copyright (c) 2010-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. */
+
+/* This source code simply loads the platform. This is only useful to play
+ * with the tracing module. See the tesh file to see how to generate the
+ * traces.
+ */
+
+#include "simgrid/instr.h"
+#include "simgrid/s4u.hpp"
+#include <memory>
+
+/* The guy we will move from host to host. It move alone and then is moved by policeman back */
+static void emigrant()
+{
+ auto mailbox = simgrid::s4u::Mailbox::by_name("master_mailbox");
+
+ simgrid::s4u::this_actor::sleep_for(2);
+
+ while (true) { // I am an eternal emigrant
+ auto destination = std::unique_ptr<std::string>(static_cast<std::string*>(mailbox->get()));
+ if (destination->empty())
+ break; // there is no destination, die
+ simgrid::s4u::this_actor::set_host(simgrid::s4u::Host::by_name(*destination));
+ simgrid::s4u::this_actor::sleep_for(2); // I am tired, have to sleep for 2 seconds
+ }
+}
+
+static void policeman()
+{
+ // I am the master of emigrant process,
+ // I tell it where it must emigrate to.
+ auto destinations = {"Tremblay", "Jupiter", "Fafard", "Ginette", "Bourassa", "Fafard", "Tremblay", "Ginette", ""};
+ auto mailbox = simgrid::s4u::Mailbox::by_name("master_mailbox");
+
+ for (auto const& destination : destinations) {
+ mailbox->put_init(new std::string(destination), 0)->set_tracing_category("migration_order")->wait();
+ }
+}
+
+int main(int argc, char* argv[])
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n \tExample: %s small_platform.xml\n", argv[0], argv[0]);
+
+ e.load_platform(argv[1]);
+
+ TRACE_category("migration_order");
+
+ simgrid::s4u::Actor::create("emigrant", simgrid::s4u::Host::by_name("Fafard"), emigrant);
+ simgrid::s4u::Actor::create("policeman", simgrid::s4u::Host::by_name("Tremblay"), policeman);
+
+ e.run();
+ return 0;
+}
#!/usr/bin/env tesh
p Tracing processes
-$ ${bindir:=.}/trace-process-migration --cfg=tracing:yes --cfg=tracing/filename:procmig.trace --cfg=tracing/msg/process:yes ${platfdir}/small_platform.xml
+$ ${bindir:=.}/s4u-trace-process-migration --cfg=tracing:yes --cfg=tracing/filename:procmig.trace --cfg=tracing/actor:yes ${platfdir}/small_platform.xml
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'procmig.trace'
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/msg/process' to 'yes'
-> [0.000000] [xbt_cfg/INFO] Option tracing/msg/process has been renamed to tracing/actor. Consider switching.
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/actor' to 'yes'
$ tail -n +3 procmig.trace
> %EventDef PajeDefineContainerType 0
> 4 13 0 6 6 ACTOR_LINK
> 6 0.000000 33 6 1 "policeman-2"
> 12 0.000000 7 32 9
-> 15 0.000000 13 0 SR 33 p0
> 12 0.000000 7 33 11
> 13 2.000000 7 32
> 12 2.000000 7 32 10
> 13 2.025708 7 33
-> 15 2.025708 13 0 SR 33 p1
> 12 2.025708 7 33 11
> 13 2.025708 7 32
-> 16 2.025708 13 0 SR 32 p0
> 15 2.025708 13 0 M 32 0
> 7 2.025708 6 32
> 6 2.025708 34 6 1 "emigrant-1"
> 13 4.025708 7 34
> 12 4.025708 7 34 10
> 13 4.025903 7 33
-> 15 4.025903 13 0 SR 33 p2
> 12 4.025903 7 33 11
> 13 4.025903 7 34
-> 16 4.025903 13 0 SR 34 p1
> 15 4.025903 13 0 M 34 1
> 7 4.025903 6 34
> 6 4.025903 35 6 2 "emigrant-1"
> 13 6.025903 7 35
> 12 6.025903 7 35 10
> 13 6.044918 7 33
-> 15 6.044918 13 0 SR 33 p3
> 12 6.044918 7 33 11
> 13 6.044918 7 35
-> 16 6.044918 13 0 SR 35 p2
> 15 6.044918 13 0 M 35 2
> 7 6.044918 6 35
> 6 6.044918 36 6 3 "emigrant-1"
> 13 8.044918 7 36
> 12 8.044918 7 36 10
> 13 8.070626 7 33
-> 15 8.070626 13 0 SR 33 p4
> 12 8.070626 7 33 11
> 13 8.070626 7 36
-> 16 8.070626 13 0 SR 36 p3
> 15 8.070626 13 0 M 36 3
> 7 8.070626 6 36
> 6 8.070626 37 6 4 "emigrant-1"
> 13 10.070626 7 37
> 12 10.070626 7 37 10
> 13 10.087178 7 33
-> 15 10.087178 13 0 SR 33 p5
> 12 10.087178 7 33 11
> 13 10.087178 7 37
-> 16 10.087178 13 0 SR 37 p4
> 15 10.087178 13 0 M 37 4
> 7 10.087178 6 37
> 6 10.087178 38 6 5 "emigrant-1"
> 13 12.087178 7 38
> 12 12.087178 7 38 10
> 13 12.112617 7 33
-> 15 12.112617 13 0 SR 33 p6
> 12 12.112617 7 33 11
> 13 12.112617 7 38
-> 16 12.112617 13 0 SR 38 p5
> 15 12.112617 13 0 M 38 5
> 7 12.112617 6 38
> 6 12.112617 39 6 3 "emigrant-1"
> 13 14.112617 7 39
> 12 14.112617 7 39 10
> 13 14.138325 7 33
-> 15 14.138325 13 0 SR 33 p7
> 12 14.138325 7 33 11
> 13 14.138325 7 39
-> 16 14.138325 13 0 SR 39 p6
> 15 14.138325 13 0 M 39 6
> 7 14.138325 6 39
> 6 14.138325 40 6 1 "emigrant-1"
> 13 16.138325 7 40
> 12 16.138325 7 40 10
> 13 16.138521 7 33
-> 15 16.138521 13 0 SR 33 p8
> 12 16.138521 7 33 11
> 13 16.138521 7 40
-> 16 16.138521 13 0 SR 40 p7
> 15 16.138521 13 0 M 40 7
> 7 16.138521 6 40
> 6 16.138521 41 6 4 "emigrant-1"
> 12 18.138521 7 41 10
> 13 18.155073 7 33
> 13 18.155073 7 41
-> 16 18.155073 13 0 SR 41 p8
> 7 18.155073 6 33
> 7 18.155073 6 41
> 7 18.155073 2 16
> 7 18.155073 1 1
> 7 18.155073 2 31
-$ rm -rf procmig.trace
+$ rm -f procmig.trace