Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
deport three other MSG examples
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 15 Dec 2017 22:58:25 +0000 (23:58 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 16 Dec 2017 00:45:26 +0000 (01:45 +0100)
22 files changed:
.gitignore
examples/msg/CMakeLists.txt
examples/msg/README.doc
examples/s4u/exec-ptask/s4u-exec-ptask.tesh
teshsuite/msg/CMakeLists.txt
teshsuite/msg/app-chainsend/app-chainsend.tesh [moved from examples/msg/app-chainsend/app-chainsend.tesh with 93% similarity]
teshsuite/msg/app-chainsend/app-chainsend_d.xml [moved from examples/msg/app-chainsend/app-chainsend_d.xml with 100% similarity]
teshsuite/msg/app-chainsend/broadcaster.c [moved from examples/msg/app-chainsend/broadcaster.c with 87% similarity]
teshsuite/msg/app-chainsend/broadcaster.h [moved from examples/msg/app-chainsend/broadcaster.h with 91% similarity]
teshsuite/msg/app-chainsend/chainsend.c [moved from examples/msg/app-chainsend/chainsend.c with 97% similarity]
teshsuite/msg/app-chainsend/common.c [moved from examples/msg/app-chainsend/common.c with 94% similarity]
teshsuite/msg/app-chainsend/common.h [moved from examples/msg/app-chainsend/common.h with 100% similarity]
teshsuite/msg/app-chainsend/iterator.c [moved from examples/msg/app-chainsend/iterator.c with 88% similarity]
teshsuite/msg/app-chainsend/iterator.h [moved from examples/msg/app-chainsend/iterator.h with 93% similarity]
teshsuite/msg/app-chainsend/messages.c [moved from examples/msg/app-chainsend/messages.c with 53% similarity]
teshsuite/msg/app-chainsend/messages.h [moved from examples/msg/app-chainsend/messages.h with 69% similarity]
teshsuite/msg/app-chainsend/peer.c [moved from examples/msg/app-chainsend/peer.c with 85% similarity]
teshsuite/msg/app-chainsend/peer.h [moved from examples/msg/app-chainsend/peer.h with 86% similarity]
teshsuite/msg/app-token-ring/app-token-ring.c [moved from examples/msg/app-token-ring/app-token-ring.c with 58% similarity]
teshsuite/msg/app-token-ring/app-token-ring.tesh [moved from examples/msg/app-token-ring/app-token-ring.tesh with 100% similarity]
teshsuite/msg/plugin-hostload/plugin-hostload.c [moved from examples/msg/plugin-hostload/plugin-hostload.c with 100% similarity]
teshsuite/msg/plugin-hostload/plugin-hostload.tesh [moved from examples/msg/plugin-hostload/plugin-hostload.tesh with 100% similarity]

index 1c84169..9c01b84 100644 (file)
@@ -121,19 +121,14 @@ doc/msg-tuto-src/masterworker1
 doc/msg-tuto-src/masterworker2
 doc/msg-tuto-src/masterworker3
 doc/msg-tuto-src/masterworker4
-examples/msg/app-chainsend/chainsend
 examples/msg/cloud-capping/cloud-capping
 examples/msg/cloud-masterworker/cloud-masterworker
 examples/msg/cloud-migration/cloud-migration
-examples/msg/cloud-simple/cloud-simple
-examples/msg/cloud-two-tasks/cloud-two-tasks
-examples/msg/dht-chord/dht-chord
 examples/msg/dht-kademlia/dht-kademlia
 examples/msg/dht-pastry/dht-pastry
 examples/msg/energy-onoff/energy-onoff
 examples/msg/energy-vm/energy-vm
 examples/msg/platform-failures/platform-failures
-examples/msg/plugin-hostload/plugin-hostload
 examples/msg/process-create/process-create
 examples/msg/app-masterworker/app-masterworker
 examples/msg/mc/bugged1
@@ -153,12 +148,10 @@ examples/msg/mc/test/snapshot_comparison4
 examples/msg/mc/test/snapshot_comparison5
 examples/msg/ms.trace
 examples/msg/network-ns3/network-ns3
-examples/msg/task-priority/task-priority
 examples/msg/procmig.trace
 examples/msg/synchro-semaphore/synchro-semaphore
 examples/msg/maestro-set/maestro-set
 examples/msg/simulation.trace
-examples/msg/app-token-ring/app-token-ring
 examples/msg/trace-categories/trace-categories
 examples/msg/trace-route-user-variables/trace-route-user-variables
 examples/msg/trace-link-user-variables/trace-link-user-variables
@@ -176,6 +169,7 @@ examples/s4u/actor-migration/s4u-actor-migration
 examples/s4u/actor-suspend/s4u-actor-suspend
 examples/s4u/actor-yield/s4u-actor-yield
 examples/s4u/app-bittorrent/s4u-bittorrent
+examples/s4u/app-chainsend/s4u-app-chainsend
 examples/s4u/app-masterworker/s4u-app-masterworker
 examples/s4u/app-pingpong/s4u-app-pingpong
 examples/s4u/app-token-ring/s4u-app-token-ring
@@ -184,13 +178,14 @@ examples/s4u/async-waitall/s4u-async-waitall
 examples/s4u/async-waitany/s4u-async-waitany
 examples/s4u/cloud-simple/s4u-cloud-simple
 examples/s4u/dht-chord/s4u-dht-chord
+examples/s4u/energy-exec/s4u-energy-exec
 examples/s4u/energy-link/s4u-energy-link
-examples/s4u/energy-ptask/s4u-energy-ptask
 examples/s4u/energy-vm/s4u-energy-vm
 examples/s4u/exec-async/s4u-exec-async
 examples/s4u/exec-basic/s4u-exec-basic
 examples/s4u/exec-dvfs/s4u-exec-dvfs
 examples/s4u/exec-monitor/s4u-exec-monitor
+examples/s4u/exec-ptask/s4u-exec-ptask
 examples/s4u/exec-remote/s4u-exec-remote
 examples/s4u/io-file-system/s4u-io-file-system
 examples/s4u/io-file-remote/s4u-io-file-remote
@@ -250,13 +245,18 @@ teshsuite/mc/mutex-handling/mutex-handling
 teshsuite/mc/mutex-handling/without-mutex-handling
 teshsuite/msg/actions-comm/actions-comm
 teshsuite/msg/actions-storage/actions-storage
+teshsuite/msg/app-chainsend/chainsend
 teshsuite/msg/app-bittorrent/bittorrent
 teshsuite/msg/app-pingpong/app-pingpong
+teshsuite/msg/app-token-ring/app-token-ring
 teshsuite/msg/async-wait/async-wait
 teshsuite/msg/async-waitall/async-waitall
 teshsuite/msg/async-waitany/async-waitany
 teshsuite/msg/cloud-sharing/cloud-sharing
+teshsuite/msg/cloud-simple/cloud-simple
+teshsuite/msg/cloud-two-tasks/cloud-two-tasks
 teshsuite/msg/concurrent_rw/concurrent_rw
+teshsuite/msg/dht-chord/dht-chord
 teshsuite/msg/energy-consumption/energy-consumption
 teshsuite/msg/energy-pstate/energy-pstate
 teshsuite/msg/energy-ptask/energy-ptask
@@ -270,6 +270,7 @@ teshsuite/msg/io-file-remote/io-file-remote
 teshsuite/msg/io-raw-storage/io-raw-storage
 teshsuite/msg/pid/pid
 teshsuite/msg/platform-properties/platform-properties
+teshsuite/msg/plugin-hostload/plugin-hostload
 teshsuite/msg/process/process
 teshsuite/msg/process-daemon/process-daemon
 teshsuite/msg/process-kill/process-kill
index 6b15794..afc6d42 100644 (file)
@@ -1,8 +1,7 @@
 # C examples
-foreach(x app-masterworker app-token-ring 
+foreach(x app-masterworker 
           cloud-capping cloud-masterworker cloud-migration
           dht-pastry energy-onoff energy-vm platform-failures 
-          plugin-hostload
           process-create 
           synchro-semaphore trace-categories 
           trace-route-user-variables trace-link-user-variables trace-masterworker
@@ -29,13 +28,6 @@ if(SIMGRID_HAVE_NS3)
   set_target_properties(network-ns3  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/network-ns3)
 endif()
 
-add_executable       (chainsend app-chainsend/chainsend.c app-chainsend/iterator.c app-chainsend/common.c app-chainsend/messages.c app-chainsend/broadcaster.c app-chainsend/peer.c)
-target_link_libraries(chainsend simgrid)
-set_target_properties(chainsend PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-chainsend)
-foreach (file common iterator messages broadcaster peer)
-  set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/${file}.h)
-endforeach()
-
 add_executable       (dht-kademlia dht-kademlia/dht-kademlia.c dht-kademlia/node.c dht-kademlia/routing_table.c dht-kademlia/task.c dht-kademlia/answer.c)
 target_link_libraries(dht-kademlia simgrid)
 set_target_properties(dht-kademlia PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dht-kademlia)
@@ -43,18 +35,16 @@ foreach (file answer dht-kademlia node routing_table task)
   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 dht-kademlia dht-pastry)
+foreach (file app-masterworker dht-kademlia dht-pastry)
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
 endforeach()
 
 set(txt_files    ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/README.doc          PARENT_SCOPE)
 set(bin_files    ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/generate.py
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-pastry/generate.py                       PARENT_SCOPE)
-set(examples_src ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/chainsend.c
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/common.h
+set(examples_src ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/common.h
                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/network-ns3.c                    PARENT_SCOPE)
-set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend.tesh
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/dht-kademlia.tesh
+set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/dht-kademlia.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi.tesh
                                   ${CMAKE_CURRENT_SOURCE_DIR}/network-ns3/network-ns3.tesh                 PARENT_SCOPE)
@@ -70,11 +60,10 @@ set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/a
                                   ${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-token-ring
+foreach(x app-masterworker 
           cloud-capping cloud-masterworker cloud-migration
           dht-pastry dht-kademlia platform-failures
           energy-onoff energy-vm
-          plugin-hostload
           process-create 
           synchro-semaphore)
   ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" 
index 8d1ef09..c738a68 100644 (file)
@@ -15,13 +15,6 @@ documentation, but it should remain readable directly.
 
 @section msg_ex_basics Basic examples and features
 
- - <b>Token Ring</b>.
-   @ref examples/msg/app-token-ring/app-token-ring.c\n
-   Classical communication pattern, where a token is exchanged
-   along a ring to reach every participant. 
-   The tesh file laying in the directory shows how to run the same
-   example on different virtual platforms.
-
  - <b>Master Workers</b>.
    @ref examples/msg/app-masterworker/app-masterworker.c\n
    Another good old example, where one Master process has a bunch of
@@ -126,7 +119,6 @@ top of the example file).
 
 
 /**
-@example examples/msg/app-token-ring/app-token-ring.c
 @example examples/msg/app-masterworker/app-masterworker.c
 
 @example examples/msg/process-create/process-create.c
index 2c9aa6f..a9f86bb 100644 (file)
@@ -1,6 +1,6 @@
 #! ./tesh
 
-$ ${bindir:=.}/s4u-energy-ptask$EXEEXT ${platfdir}/energy_platform.xml --energy --cfg=host/model:ptask_L07 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/s4u-exec-ptask$EXEEXT ${platfdir}/energy_platform.xml --energy --cfg=host/model:ptask_L07 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:maestro@) Configuration change: Set 'host/model' to 'ptask_L07'
 > [  0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
 > [  0.000000] (1:test@MyHost1) First, build a classical parallel task, with 1 Gflop to execute on each node, and 10MB to exchange between each pair
index a505140..10fcf5c 100644 (file)
@@ -1,6 +1,6 @@
 # C examples
 foreach(x actions-comm actions-storage
-          app-pingpong
+          app-pingpong app-token-ring
           async-wait async-waitall async-waitany
           cloud-sharing cloud-two-tasks cloud-simple
          get_sender host_on_off host_on_off_recv host_on_off_processes   
@@ -8,6 +8,7 @@ foreach(x actions-comm actions-storage
           energy-consumption energy-ptask energy-pstate platform-properties
           io-file io-raw-storage io-file-remote
          task-priority
+         plugin-hostload
           trace_integration)
   add_executable       (${x}  ${x}/${x}.c)
   target_link_libraries(${x}  simgrid)
@@ -34,9 +35,18 @@ foreach (file bittorrent connection messages peer tracker)
   set(teshsuite_src  ${teshsuite_src}  ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/${file}.h)
 endforeach()
 
-
+add_executable       (chainsend app-chainsend/chainsend.c app-chainsend/iterator.c app-chainsend/common.c app-chainsend/messages.c app-chainsend/broadcaster.c app-chainsend/peer.c)
+target_link_libraries(chainsend simgrid)
+set_target_properties(chainsend PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/app-chainsend)
+foreach (file common iterator messages broadcaster peer)
+  set(teshsuite_src  ${teshsuite_src}  ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/${file}.h)
+endforeach()
+set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/chainsend.c)
+                                  
 set(teshsuite_src ${teshsuite_src}  PARENT_SCOPE)
-set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent.tesh          PARENT_SCOPE)
+set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/app-bittorrent.tesh          
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend.tesh
+                                   PARENT_SCOPE)
 set(bin_files    ${bin_files}      ${CMAKE_CURRENT_SOURCE_DIR}/app-bittorrent/generate.py                  PARENT_SCOPE)
 set(txt_files     ${txt_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm.txt
                                    ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/actions-comm_split_p0.txt
@@ -46,6 +56,7 @@ set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/acti
                                    ${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-chainsend/app-chainsend_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
@@ -77,7 +88,7 @@ set(xml_files     ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/actions-comm/acti
 foreach(x 
     actions-comm actions-storage
     async-wait async-waitall async-waitany
-    app-bittorrent app-pingpong
+    app-bittorrent app-chainsend app-pingpong app-token-ring
     cloud-two-tasks cloud-simple
     energy-pstate
     host_on_off host_on_off_processes host_on_off_recv
@@ -87,6 +98,7 @@ foreach(x
     energy-consumption energy-ptask
     io-file io-raw-storage io-file-remote
     platform-properties
+    plugin-hostload
     trace_integration)
   ADD_TESH_FACTORIES(tesh-msg-${x} "thread;ucontext;raw;boost" 
                                    --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
@@ -4,7 +4,7 @@ p Testing the chainsend MSG implementation
 
 ! timeout 60
 ! output sort 19
-$ $SG_TEST_EXENV ${bindir:=.}/chainsend ${platfdir}/cluster.xml ${srcdir}/app-chainsend_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV ${bindir:=.}/chainsend ${platfdir}/cluster.xml app-chainsend_d.xml "--log=root.fmt:[%12.6r]%e(%i:%P@%h)%e%m%n"
 > [    2.214423] (2:peer@node-1.acme.org) ### 2.214423 16777216 bytes (Avg 7.225359 MB/s); copy finished (simulated).
 > [    2.222796] (3:peer@node-2.acme.org) ### 2.222796 16777216 bytes (Avg 7.198141 MB/s); copy finished (simulated).
 > [    2.231170] (4:peer@node-3.acme.org) ### 2.231170 16777216 bytes (Avg 7.171126 MB/s); copy finished (simulated).
similarity index 87%
rename from examples/msg/app-chainsend/broadcaster.c
rename to teshsuite/msg/app-chainsend/broadcaster.c
index 23c4484..ff258f2 100644 (file)
@@ -11,7 +11,7 @@ xbt_dynar_t build_hostlist_from_hostcount(int hostcount)
 {
   xbt_dynar_t host_list = xbt_dynar_new(sizeof(char*), xbt_free_ref);
   for (int i = 1; i <= hostcount; i++) {
-    char *hostname = bprintf("host%d", i);
+    charhostname = bprintf("host%d", i);
     XBT_DEBUG("%s", hostname);
     xbt_dynar_push(host_list, &hostname);
   }
@@ -20,7 +20,7 @@ xbt_dynar_t build_hostlist_from_hostcount(int hostcount)
 
 int broadcaster_build_chain(broadcaster_t bc)
 {
-  msg_task_t task = NULL;
+  msg_task_t task          = NULL;
   char** cur               = (char**)xbt_dynar_iterator_next(bc->it);
   const char* me           = MSG_host_get_name(MSG_host_self());
   const char* current_host = NULL;
@@ -31,14 +31,14 @@ int broadcaster_build_chain(broadcaster_t bc)
   /* Build the chain if there's at least one peer */
   if (cur != NULL) {
     /* init: prev=NULL, host=current cur, next=next cur */
-    next = *cur;
+    next      = *cur;
     bc->first = next;
 
     /* This iterator iterates one step ahead: cur is current iterated element, but is actually next in the chain */
     do {
       /* following steps: prev=last, host=next, next=cur */
-      cur = (char**)xbt_dynar_iterator_next(bc->it);
-      prev = last;
+      cur          = (char**)xbt_dynar_iterator_next(bc->it);
+      prev         = last;
       current_host = next;
       if (cur != NULL)
         next = *cur;
@@ -80,12 +80,12 @@ broadcaster_t broadcaster_init(xbt_dynar_t host_list, unsigned int piece_count)
   broadcaster_t bc = xbt_new(s_broadcaster_t, 1);
 
   bc->first             = NULL;
-  bc->piece_count = piece_count;
-  bc->current_piece = 0;
-  bc->host_list = host_list;
-  bc->it = xbt_dynar_iterator_new(bc->host_list, forward_indices_list);
+  bc->piece_count       = piece_count;
+  bc->current_piece     = 0;
+  bc->host_list         = host_list;
+  bc->it                = xbt_dynar_iterator_new(bc->host_list, forward_indices_list);
   bc->max_pending_sends = MAX_PENDING_SENDS;
-  bc->pending_sends = xbt_dynar_new(sizeof(msg_comm_t), NULL);
+  bc->pending_sends     = xbt_dynar_new(sizeof(msg_comm_t), NULL);
 
   status = broadcaster_build_chain(bc);
   xbt_assert(status == MSG_OK, "Chain initialization failed");
@@ -103,7 +103,7 @@ static void broadcaster_destroy(broadcaster_t bc)
 }
 
 /** Emitter function  */
-int broadcaster(int argc, char *argv[])
+int broadcaster(int argc, charargv[])
 {
   unsigned int piece_count = PIECE_COUNT;
 
similarity index 91%
rename from examples/msg/app-chainsend/broadcaster.h
rename to teshsuite/msg/app-chainsend/broadcaster.h
index 116f44f..3987fbc 100644 (file)
@@ -7,10 +7,10 @@
 #ifndef BROADCASTER_H
 #define BROADCASTER_H
 
-#include "xbt/dynar.h"
-#include "messages.h"
-#include "iterator.h"
 #include "common.h"
+#include "iterator.h"
+#include "messages.h"
+#include "xbt/dynar.h"
 
 /* Connection parameters */
 #define MAX_PENDING_SENDS 10
@@ -21,7 +21,7 @@
 
 /* Broadcaster struct */
 typedef struct s_broadcaster {
-  const char *first;
+  const charfirst;
   int piece_count;
   int current_piece;
   xbt_dynar_t host_list;
@@ -30,7 +30,7 @@ typedef struct s_broadcaster {
   xbt_dynar_t pending_sends;
 } s_broadcaster_t;
 
-typedef s_broadcaster_t *broadcaster_t;
+typedef s_broadcaster_tbroadcaster_t;
 
 xbt_dynar_t build_hostlist_from_hostcount(int hostcount);
 
@@ -40,6 +40,6 @@ int broadcaster_build_chain(broadcaster_t bc);
 int broadcaster_send_file(broadcaster_t bc);
 
 /* Tasks */
-int broadcaster(int argc, char *argv[]);
+int broadcaster(int argc, charargv[]);
 
 #endif /* BROADCASTER_H */
similarity index 97%
rename from examples/msg/app-chainsend/chainsend.c
rename to teshsuite/msg/app-chainsend/chainsend.c
index 292abe8..0eced93 100644 (file)
@@ -4,11 +4,11 @@
 /* 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 "broadcaster.h"
 #include "iterator.h"
 #include "messages.h"
-#include "broadcaster.h"
 #include "peer.h"
+#include "simgrid/msg.h"
 
 /** @addtogroup MSG_examples
  *
@@ -17,7 +17,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chainsend, "Messages specific for chainsend");
 
-int main(int argc, char *argv[])
+int main(int argc, charargv[])
 {
   MSG_init(&argc, argv);
 
similarity index 94%
rename from examples/msg/app-chainsend/common.c
rename to teshsuite/msg/app-chainsend/common.c
index 12fc601..399ad47 100644 (file)
@@ -13,7 +13,7 @@ int process_pending_connections(xbt_dynar_t q)
   int empty = 0;
   msg_comm_t comm;
 
-  xbt_dynar_foreach(q, iter, comm) {
+  xbt_dynar_foreach (q, iter, comm) {
     empty = 1;
     if (MSG_comm_test(comm)) {
       status = MSG_comm_get_status(comm);
similarity index 88%
rename from examples/msg/app-chainsend/iterator.c
rename to teshsuite/msg/app-chainsend/iterator.c
index 1bba4d5..8db67b8 100644 (file)
@@ -14,17 +14,17 @@ xbt_dynar_iterator_t xbt_dynar_iterator_new(xbt_dynar_t list, xbt_dynar_t (*crit
 {
   xbt_dynar_iterator_t it = xbt_new(xbt_dynar_iterator_s, 1);
 
-  it->list = list;
-  it->length = xbt_dynar_length(list);
+  it->list         = list;
+  it->length       = xbt_dynar_length(list);
   it->indices_list = criteria_fn(it->length); // Creates and fills a dynar of int
-  it->criteria_fn = criteria_fn;
-  it->current = 0;
+  it->criteria_fn  = criteria_fn;
+  it->current      = 0;
 
   return it;
 }
 
 /* Returns the next element iterated by iterator it, NULL if there are no more elements */
-void *xbt_dynar_iterator_next(xbt_dynar_iterator_t it)
+voidxbt_dynar_iterator_next(xbt_dynar_iterator_t it)
 {
   if (it->current >= it->length) {
     return NULL;
similarity index 93%
rename from examples/msg/app-chainsend/iterator.h
rename to teshsuite/msg/app-chainsend/iterator.h
index c86aff4..76ea952 100644 (file)
@@ -17,14 +17,14 @@ typedef struct xbt_dynar_iterator_struct {
   int current;
   unsigned long length;
   xbt_dynar_t (*criteria_fn)(int size);
-} *xbt_dynar_iterator_t;
+} * xbt_dynar_iterator_t;
 typedef struct xbt_dynar_iterator_struct xbt_dynar_iterator_s;
 
 /* Iterator methods */
 xbt_dynar_iterator_t xbt_dynar_iterator_new(xbt_dynar_t list, xbt_dynar_t (*criteria_fn)(int));
 void xbt_dynar_iterator_reset(xbt_dynar_iterator_t it);
 void xbt_dynar_iterator_seek(xbt_dynar_iterator_t it, int pos);
-void *xbt_dynar_iterator_next(xbt_dynar_iterator_t it);
+voidxbt_dynar_iterator_next(xbt_dynar_iterator_t it);
 void xbt_dynar_iterator_delete(xbt_dynar_iterator_t it);
 
 /* Iterator generators */
similarity index 53%
rename from examples/msg/app-chainsend/messages.c
rename to teshsuite/msg/app-chainsend/messages.c
index 28a92fb..c00d5a8 100644 (file)
@@ -8,37 +8,37 @@
 
 msg_task_t task_message_new(e_message_type type, unsigned int len)
 {
-  message_t msg = xbt_new(s_message_t, 1);
-  msg->type = type;
+  message_t msg      = xbt_new(s_message_t, 1);
+  msg->type          = type;
   msg->prev_hostname = NULL;
   msg->next_hostname = NULL;
-  msg_task_t task = MSG_task_create(NULL, 0, len, msg);
+  msg_task_t task    = MSG_task_create(NULL, 0, len, msg);
 
   return task;
 }
 
-msg_task_t task_message_chain_new(const char* prev, const char *next, const unsigned int num_pieces)
+msg_task_t task_message_chain_new(const char* prev, const charnext, const unsigned int num_pieces)
 {
-  msg_task_t task = task_message_new(MESSAGE_BUILD_CHAIN, MESSAGE_BUILD_CHAIN_SIZE);
-  message_t msg = MSG_task_get_data(task);
+  msg_task_t task    = task_message_new(MESSAGE_BUILD_CHAIN, MESSAGE_BUILD_CHAIN_SIZE);
+  message_t msg      = MSG_task_get_data(task);
   msg->prev_hostname = xbt_strdup(prev);
   msg->next_hostname = xbt_strdup(next);
-  msg->num_pieces = num_pieces;
+  msg->num_pieces    = num_pieces;
 
   return task;
 }
 
-msg_task_t task_message_data_new(const char *block, unsigned int len)
+msg_task_t task_message_data_new(const charblock, unsigned int len)
 {
-  msg_task_t task = task_message_new(MESSAGE_SEND_DATA, MESSAGE_SEND_DATA_HEADER_SIZE + len);
-  message_t msg = MSG_task_get_data(task);
-  msg->data_block = block;
+  msg_task_t task  = task_message_new(MESSAGE_SEND_DATA, MESSAGE_SEND_DATA_HEADER_SIZE + len);
+  message_t msg    = MSG_task_get_data(task);
+  msg->data_block  = block;
   msg->data_length = len;
 
   return task;
 }
 
-void task_message_delete(void *task)
+void task_message_delete(voidtask)
 {
   message_t msg = MSG_task_get_data(task);
   xbt_free(msg);
similarity index 69%
rename from examples/msg/app-chainsend/messages.h
rename to teshsuite/msg/app-chainsend/messages.h
index e6855ea..3f510fa 100644 (file)
 #define MESSAGE_END_DATA_SIZE 1
 
 /* Messages enum */
-typedef enum {
-  MESSAGE_BUILD_CHAIN = 0,
-  MESSAGE_SEND_DATA
-} e_message_type;
+typedef enum { MESSAGE_BUILD_CHAIN = 0, MESSAGE_SEND_DATA } e_message_type;
 
 /* Message struct */
 typedef struct s_message {
   e_message_type type;
-  char *prev_hostname;
-  char *next_hostname;
-  const char *data_block;
+  charprev_hostname;
+  charnext_hostname;
+  const chardata_block;
   unsigned int data_length;
   unsigned int num_pieces;
 } s_message_t;
 
-typedef s_message_t *message_t;
+typedef s_message_tmessage_t;
 
 /* Message methods */
 msg_task_t task_message_new(e_message_type type, unsigned int len);
-msg_task_t task_message_chain_new(const char* prev, const char *next, const unsigned int num_pieces);
-msg_task_t task_message_data_new(const char *block, unsigned int len);
-void task_message_delete(void *);
+msg_task_t task_message_chain_new(const char* prev, const charnext, const unsigned int num_pieces);
+msg_task_t task_message_data_new(const charblock, unsigned int len);
+void task_message_delete(void*);
 
 #endif /* MESSAGES_H */
similarity index 85%
rename from examples/msg/app-chainsend/peer.c
rename to teshsuite/msg/app-chainsend/peer.c
index 1201149..6e3c9f0 100644 (file)
@@ -10,10 +10,10 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_peer, "Messages specific for the peer");
 
 void peer_init_chain(peer_t peer, message_t msg)
 {
-  peer->prev = msg->prev_hostname;
-  peer->next = msg->next_hostname;
+  peer->prev         = msg->prev_hostname;
+  peer->next         = msg->next_hostname;
   peer->total_pieces = msg->num_pieces;
-  peer->init = 1;
+  peer->init         = 1;
 }
 
 static void peer_forward_msg(peer_t peer, message_t msg)
@@ -26,7 +26,7 @@ static void peer_forward_msg(peer_t peer, message_t msg)
 
 int peer_execute_task(peer_t peer, msg_task_t task)
 {
-  int done = 0;
+  int done      = 0;
   message_t msg = MSG_task_get_data(task);
 
   XBT_DEBUG("Peer %s got message of type %u\n", peer->me, msg->type);
@@ -54,14 +54,14 @@ msg_error_t peer_wait_for_message(peer_t peer)
   msg_error_t status;
   msg_comm_t comm = NULL;
   msg_task_t task = NULL;
-  int done = 0;
+  int done        = 0;
 
   while (done == 0) {
     comm = MSG_task_irecv(&task, peer->me);
     queue_pending_connection(comm, peer->pending_recvs);
     int idx = MSG_comm_waitany(peer->pending_recvs);
     if (idx != -1) {
-      comm = xbt_dynar_get_as(peer->pending_recvs, idx, msg_comm_t);
+      comm   = xbt_dynar_get_as(peer->pending_recvs, idx, msg_comm_t);
       status = MSG_comm_get_status(comm);
       XBT_DEBUG("peer_wait_for_message: error code = %u", status);
       xbt_assert(status == MSG_OK, "peer_wait_for_message() failed");
@@ -80,13 +80,13 @@ msg_error_t peer_wait_for_message(peer_t peer)
   return status;
 }
 
-void peer_init(peer_t p, int argc, char *argv[])
+void peer_init(peer_t p, int argc, charargv[])
 {
-  p->init = 0;
-  p->prev = NULL;
-  p->next = NULL;
-  p->pieces = 0;
-  p->bytes = 0;
+  p->init          = 0;
+  p->prev          = NULL;
+  p->next          = NULL;
+  p->pieces        = 0;
+  p->bytes         = 0;
   p->pending_recvs = xbt_dynar_new(sizeof(msg_comm_t), NULL);
   p->pending_sends = xbt_dynar_new(sizeof(msg_comm_t), NULL);
   /* Set mailbox name: use host number from argv or hostname if no argument given */
@@ -101,7 +101,7 @@ void peer_shutdown(peer_t p)
 {
   unsigned int size = xbt_dynar_length(p->pending_sends);
   unsigned int idx;
-  msg_comm_t *comms = xbt_new(msg_comm_t, size);
+  msg_comm_tcomms = xbt_new(msg_comm_t, size);
 
   for (idx = 0; idx < size; idx++) {
     comms[idx] = xbt_dynar_get_as(p->pending_sends, idx, msg_comm_t);
@@ -130,11 +130,12 @@ void peer_delete(peer_t p)
 
 void peer_print_stats(peer_t p, float elapsed_time)
 {
-  XBT_INFO("### %f %llu bytes (Avg %f MB/s); copy finished (simulated).", elapsed_time, p->bytes, p->bytes / 1024.0 / 1024.0 / elapsed_time);
+  XBT_INFO("### %f %llu bytes (Avg %f MB/s); copy finished (simulated).", elapsed_time, p->bytes,
+           p->bytes / 1024.0 / 1024.0 / elapsed_time);
 }
 
 /** Peer function  */
-int peer(int argc, char *argv[])
+int peer(int argc, charargv[])
 {
   peer_t p = xbt_new(s_peer_t, 1);
   msg_error_t status;
@@ -143,7 +144,7 @@ int peer(int argc, char *argv[])
 
   peer_init(p, argc, argv);
   float start_time = MSG_get_clock();
-  status = peer_wait_for_message(p);
+  status           = peer_wait_for_message(p);
   peer_shutdown(p);
   float end_time = MSG_get_clock();
   peer_print_stats(p, end_time - start_time);
similarity index 86%
rename from examples/msg/app-chainsend/peer.h
rename to teshsuite/msg/app-chainsend/peer.h
index 5099d1b..2e8f36a 100644 (file)
 #include "simgrid/msg.h"
 #include "xbt/dynar.h"
 
-#include "messages.h"
 #include "common.h"
+#include "messages.h"
 
 #define PEER_SHUTDOWN_DEADLINE 60000
 
 /* Peer struct */
 typedef struct s_peer {
   int init;
-  char *prev;
-  char *next;
-  char *me;
+  charprev;
+  charnext;
+  charme;
   int pieces;
   unsigned long long bytes;
   xbt_dynar_t pending_recvs;
   xbt_dynar_t pending_sends;
   unsigned int total_pieces;
 } s_peer_t;
-typedef s_peer_t *peer_t;
+typedef s_peer_tpeer_t;
 
 /* Peer: helper functions */
 msg_error_t peer_wait_for_message(peer_t peer);
@@ -35,9 +35,9 @@ int peer_execute_task(peer_t peer, msg_task_t task);
 void peer_init_chain(peer_t peer, message_t msg);
 void peer_delete(peer_t p);
 void peer_shutdown(peer_t p);
-void peer_init(peer_t p, int argc, char *argv[]);
+void peer_init(peer_t p, int argc, charargv[]);
 void peer_print_stats(peer_t p, float elapsed_time);
 
-int peer(int argc, char *argv[]);
+int peer(int argc, charargv[]);
 
 #endif /* PEER_H */
similarity index 58%
rename from examples/msg/app-token-ring/app-token-ring.c
rename to teshsuite/msg/app-token-ring/app-token-ring.c
index 1f046a7..c5d7118 100644 (file)
@@ -8,20 +8,21 @@
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_token_ring, "Messages specific for this msg example");
 
 /* Main function of all processes used in this example */
-static int relay_runner(int argc, char *argv[])
+static int relay_runner(int argc, charargv[])
 {
-  xbt_assert(argc==0, "The relay_runner function does not accept any parameter from the XML deployment file");
-  int rank = xbt_str_parse_int(MSG_process_get_name(MSG_process_self()), "Any process of this example must have a numerical name, not %s");
+  xbt_assert(argc == 0, "The relay_runner function does not accept any parameter from the XML deployment file");
+  int rank = xbt_str_parse_int(MSG_process_get_name(MSG_process_self()),
+                               "Any process of this example must have a numerical name, not %s");
   char mailbox[256];
 
   if (rank == 0) {
     /* The root process (rank 0) first sends the token then waits to receive it back */
-    snprintf(mailbox,255, "%d", rank+1);
+    snprintf(mailbox, 255, "%d", rank + 1);
     unsigned int task_comm_size = 1000000; /* The token is 1MB long*/
-    msg_task_t task = MSG_task_create("Token", 0, task_comm_size, NULL);
-    XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"", rank, task->name,mailbox);
+    msg_task_t task             = MSG_task_create("Token", 0, task_comm_size, NULL);
+    XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"", rank, task->name, mailbox);
     MSG_task_send(task, mailbox);
-    task = NULL;
+    task    = NULL;
     int res = MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
     xbt_assert(res == MSG_OK, "MSG_task_get failed");
     XBT_INFO("Host \"%d\" received \"%s\"", rank, MSG_task_get_name(task));
@@ -30,39 +31,40 @@ static int relay_runner(int argc, char *argv[])
   } else {
     /* The others processes receive from their left neighbor (rank-1) and send to their right neighbor (rank+1) */
     msg_task_t task = NULL;
-    int res = MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
+    int res         = MSG_task_receive(&task, MSG_process_get_name(MSG_process_self()));
     xbt_assert(res == MSG_OK, "MSG_task_get failed");
-    XBT_INFO("Host \"%d\" received \"%s\"",rank, MSG_task_get_name(task));
+    XBT_INFO("Host \"%d\" received \"%s\"", rank, MSG_task_get_name(task));
 
-    if (rank+1 == MSG_get_host_number())
+    if (rank + 1 == MSG_get_host_number())
       /* But the last process, which sends the token back to rank 0 */
-      snprintf(mailbox,255, "0");
+      snprintf(mailbox, 255, "0");
     else
-      snprintf(mailbox,255, "%d", rank+1);
-    XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"",rank,task->name,mailbox);
+      snprintf(mailbox, 255, "%d", rank + 1);
+    XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"", rank, task->name, mailbox);
     MSG_task_send(task, mailbox);
   }
   return 0;
 }
 
-int main(int argc, char *argv[])
+int main(int argc, charargv[])
 {
   MSG_init(&argc, argv);
-  xbt_assert(argc>1, "Usage: %s platform.xml\n",argv[0]);
-  MSG_create_environment(argv[1]);       /* - Load the platform description */
+  xbt_assert(argc > 1, "Usage: %s platform.xml\n", argv[0]);
+  MSG_create_environment(argv[1]); /* - Load the platform description */
   xbt_dynar_t hosts = MSG_hosts_as_dynar();
 
   XBT_INFO("Number of hosts '%d'", MSG_get_host_number());
   unsigned int i;
   msg_host_t h;
-  xbt_dynar_foreach (hosts, i, h) {      /* - Give a unique rank to each host and create a @ref relay_runner process on each */
-    char* name_host = bprintf("%u",i);
+  xbt_dynar_foreach (hosts, i,
+                     h) { /* - Give a unique rank to each host and create a @ref relay_runner process on each */
+    char* name_host = bprintf("%u", i);
     MSG_process_create(name_host, relay_runner, NULL, h);
     free(name_host);
   }
   xbt_dynar_free(&hosts);
 
-  int res = MSG_main();                 /* - Run the simulation */
+  int res = MSG_main(); /* - Run the simulation */
   XBT_INFO("Simulation time %g", MSG_get_clock());
   return res != MSG_OK;
 }