examples/msg/task-priority/task-priority
examples/msg/procmig.trace
examples/msg/synchro-semaphore/synchro-semaphore
-examples/msg/app-pingpong/app-pingpong
examples/msg/maestro-set/maestro-set
examples/msg/simulation.trace
examples/msg/app-token-ring/app-token-ring
teshsuite/msg/actions-comm/actions-comm
teshsuite/msg/actions-storage/actions-storage
teshsuite/msg/app-bittorrent/bittorrent
+teshsuite/msg/app-pingpong/app-pingpong
teshsuite/msg/async-wait/async-wait
teshsuite/msg/async-waitall/async-waitall
teshsuite/msg/async-waitany/async-waitany
# C examples
-foreach(x app-masterworker app-pingpong app-token-ring
+foreach(x app-masterworker app-token-ring
cloud-capping cloud-masterworker cloud-migration cloud-simple cloud-two-tasks
dht-pastry energy-consumption energy-onoff energy-vm platform-failures
plugin-hostload
set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.c ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.h)
endforeach()
-foreach (file app-chainsend app-masterworker app-pingpong dht-kademlia dht-pastry)
+foreach (file app-chainsend app-masterworker dht-kademlia dht-pastry)
set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
endforeach()
${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/one_cluster_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/two_clusters_d.xml PARENT_SCOPE)
-foreach(x app-chainsend app-masterworker app-pingpong app-token-ring
+foreach(x app-chainsend app-masterworker app-token-ring
cloud-capping cloud-masterworker cloud-migration cloud-simple
cloud-two-tasks dht-pastry dht-kademlia platform-failures
energy-consumption energy-onoff energy-vm
@section msg_ex_basics Basic examples and features
- - <b>Ping Pong</b>: @ref examples/msg/app-pingpong/app-pingpong.c\n
- It's hard to think of a simpler example: it is just sending one
- message back and forth.
- The tesh file laying in the directory show how to start the
- simulator binary, highlighting how to pass options to the simulators
- (as detailed in Section \ref options).
-
- <b>Token Ring</b>.
@ref examples/msg/app-token-ring/app-token-ring.c\n
Classical communication pattern, where a token is exchanged
/**
-@example examples/msg/app-pingpong/app-pingpong.c
@example examples/msg/app-token-ring/app-token-ring.c
@example examples/msg/app-masterworker/app-masterworker.c
# C examples
foreach(x actions-comm actions-storage
+ app-pingpong
async-wait async-waitall async-waitany
cloud-sharing get_sender host_on_off host_on_off_recv host_on_off_processes
process-daemon process-kill process-join process-lifetime process-migration process-suspend process-yield
${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/actions-storage/actions-storage_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent_d.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait2_d.xml
${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait3_d.xml
foreach(x
actions-comm actions-storage
async-wait async-waitall async-waitany
- app-bittorrent
+ app-bittorrent app-pingpong
energy-pstate
host_on_off host_on_off_processes host_on_off_recv
get_sender
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_pingpong, "Messages specific for this msg example");
-static int pinger(int argc, char *argv[])
+static int pinger(int argc, char* argv[])
{
- xbt_assert(argc==2, "The pinger function one argument from the XML deployment file");
+ xbt_assert(argc == 2, "The pinger function one argument from the XML deployment file");
XBT_INFO("Ping -> %s", argv[1]);
xbt_assert(MSG_host_by_name(argv[1]) != NULL, "Unknown host %s. Stopping Now! ", argv[1]);
/* - Do the ping with a 1-Byte task (latency bound) ... */
- double now = MSG_get_clock();
- msg_task_t ping_task = MSG_task_create("small communication (latency bound)", 0.0, 1, NULL);
- ping_task->data = xbt_new(double, 1);
- *(double *) ping_task->data = now;
+ double now = MSG_get_clock();
+ msg_task_t ping_task = MSG_task_create("small communication (latency bound)", 0.0, 1, NULL);
+ ping_task->data = xbt_new(double, 1);
+ *(double*)ping_task->data = now;
MSG_task_send(ping_task, argv[1]);
/* - ... then wait for the (large) pong */
msg_task_t pong_task = NULL;
- int a = MSG_task_receive(&pong_task,MSG_host_get_name(MSG_host_self()));
+ int a = MSG_task_receive(&pong_task, MSG_host_get_name(MSG_host_self()));
xbt_assert(a == MSG_OK, "Unexpected behavior");
- double sender_time = *((double *) (pong_task->data));
- double communication_time = MSG_get_clock() - sender_time;
+ double sender_time = *((double*)(pong_task->data));
+ double communication_time = MSG_get_clock() - sender_time;
XBT_INFO("Task received : %s", pong_task->name);
xbt_free(pong_task->data);
MSG_task_destroy(pong_task);
return 0;
}
-static int ponger(int argc, char *argv[])
+static int ponger(int argc, char* argv[])
{
- xbt_assert(argc==2, "The ponger function one argument from the XML deployment file");
+ xbt_assert(argc == 2, "The ponger function one argument from the XML deployment file");
XBT_INFO("Pong -> %s", argv[1]);
xbt_assert(MSG_host_by_name(argv[1]) != NULL, "Unknown host %s. Stopping Now! ", argv[1]);
/* - Receive the (small) ping first ....*/
msg_task_t ping_task = NULL;
- int a = MSG_task_receive(&ping_task, MSG_host_get_name(MSG_host_self()));
+ int a = MSG_task_receive(&ping_task, MSG_host_get_name(MSG_host_self()));
xbt_assert(a == MSG_OK, "Unexpected behavior");
- double sender_time = *((double *) (ping_task->data));
+ double sender_time = *((double*)(ping_task->data));
double communication_time = MSG_get_clock() - sender_time;
XBT_INFO("Task received : %s", ping_task->name);
xbt_free(ping_task->data);
XBT_INFO(" Ping time (latency bound) %f", communication_time);
/* - ... Then send a 1GB pong back (bandwidth bound) */
- double now = MSG_get_clock();
- msg_task_t pong_task = MSG_task_create("large communication (bandwidth bound)", 0.0, 1e9, NULL);
- pong_task->data = xbt_new(double, 1);
- *(double *) pong_task->data = now;
+ double now = MSG_get_clock();
+ msg_task_t pong_task = MSG_task_create("large communication (bandwidth bound)", 0.0, 1e9, NULL);
+ pong_task->data = xbt_new(double, 1);
+ *(double*)pong_task->data = now;
XBT_INFO("task_bw->data = %.3f", *((double*)pong_task->data));
MSG_task_send(pong_task, argv[1]);
return 0;
}
-int main(int argc, char *argv[])
+int main(int argc, char* argv[])
{
MSG_init(&argc, argv);
xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
- "\tExample: %s ../../platforms/small_platform.xml app-pingpong_d.xml\n", argv[0], argv[0]);
+ "\tExample: %s ../../platforms/small_platform.xml app-pingpong_d.xml\n",
+ argv[0], argv[0]);
- MSG_create_environment(argv[1]); /* - Load the platform description */
+ MSG_create_environment(argv[1]); /* - Load the platform description */
- MSG_function_register("pinger", pinger); /* - Register the functions to be executed by the processes */
+ MSG_function_register("pinger", pinger); /* - Register the functions to be executed by the processes */
MSG_function_register("ponger", ponger);
- MSG_launch_application(argv[2]); /* - Deploy the application */
+ MSG_launch_application(argv[2]); /* - Deploy the application */
- msg_error_t res = MSG_main(); /* - Run the simulation */
+ msg_error_t res = MSG_main(); /* - Run the simulation */
XBT_INFO("Total simulation time: %.3f", MSG_get_clock());
- return res!=MSG_OK;
+ return res != MSG_OK;
}
p Testing with default compound
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml ${srcdir}/app-pingpong_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml app-pingpong_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (1:pinger@Tremblay) Ping -> Jupiter
> [ 0.000000] (2:ponger@Jupiter) Pong -> Tremblay
> [ 0.019014] (2:ponger@Jupiter) Task received : small communication (latency bound)
p Testing with default compound and Full network optimization
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml ${srcdir}/app-pingpong_d.xml "--cfg=network/optim:Full" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml app-pingpong_d.xml "--cfg=network/optim:Full" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'network/optim' to 'Full'
> [ 0.000000] (1:pinger@Tremblay) Ping -> Jupiter
> [ 0.000000] (2:ponger@Jupiter) Pong -> Tremblay
p Testing the deprecated CM02 network model
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml ${srcdir}/app-pingpong_d.xml --cfg=cpu/model:Cas01 --cfg=network/model:CM02 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml app-pingpong_d.xml --cfg=cpu/model:Cas01 --cfg=network/model:CM02 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
> [ 0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'CM02'
> [ 0.000000] (1:pinger@Tremblay) Ping -> Jupiter
p Testing the surf network Reno fairness model using lagrangian approach
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml ${srcdir}/app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Reno" --log=surf_lagrange.thres=critical "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Reno" --log=surf_lagrange.thres=critical "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'compound'
> [ 0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
> [ 0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Reno'
p Testing the surf network Reno2 fairness model using lagrangian approach
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml ${srcdir}/app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Reno2" --log=surf_lagrange.thres=critical "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Reno2" --log=surf_lagrange.thres=critical "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'compound'
> [ 0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
> [ 0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Reno2'
p Testing the surf network Vegas fairness model using lagrangian approach
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml ${srcdir}/app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Vegas" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform.xml app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Vegas" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'compound'
> [ 0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
> [ 0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Vegas'
p Testing the surf network constant model
-$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform_constant.xml ${srcdir}/app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Constant" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/app-pingpong$EXEEXT ${platfdir}/small_platform_constant.xml app-pingpong_d.xml "--cfg=host/model:compound cpu/model:Cas01 network/model:Constant" "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'compound'
> [ 0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
> [ 0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Constant'