Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better integration of this example
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 9 Dec 2017 19:23:21 +0000 (20:23 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 9 Dec 2017 19:23:21 +0000 (20:23 +0100)
examples/s4u/CMakeLists.txt
examples/s4u/README.doc
examples/s4u/exec-monitor/s4u-exec-monitor.cpp [moved from examples/s4u/cloud-progress-monitor/s4u-cloud-progress-monitor.cpp with 88% similarity]
examples/s4u/exec-monitor/s4u-exec-monitor.tesh [moved from examples/s4u/cloud-progress-monitor/s4u-cloud-progress-monitor.tesh with 98% similarity]

index 7e8d1b3..b485d80 100644 (file)
@@ -2,9 +2,8 @@ foreach (example actions-comm actions-storage
                  actor-create actor-daemon actor-join actor-kill actor-lifetime actor-migration actor-suspend actor-yield
                  app-masterworker app-pingpong app-token-ring
                  async-wait async-waitany async-waitall
-                 cloud-progress-monitor
                  energy-link energy-pstate energy-ptask energy-vm
-                 exec-async exec-basic
+                 exec-async exec-basic exec-monitor
                  io-file-system io-file-remote io-storage-raw
                  platform-properties plugin-hostload mutex)
   add_executable       (s4u-${example}  ${example}/s4u-${example}.cpp)
@@ -69,10 +68,9 @@ foreach(example actions-comm actions-storage
                 actor-create actor-daemon actor-join actor-kill actor-lifetime actor-migration actor-suspend actor-yield
                 app-bittorrent app-masterworker app-pingpong app-token-ring 
                 async-wait async-waitall async-waitany
-                cloud-progress-monitor
                 dht-chord 
                 energy-link energy-pstate energy-ptask energy-vm
-                exec-async exec-basic
+                exec-async exec-basic exec-monitor
                 platform-properties plugin-hostload mutex
                 io-file-system io-file-remote io-storage-raw)
   ADD_TESH_FACTORIES(s4u-${example} "thread;ucontext;raw;boost" 
index 17cc43f..6897131 100644 (file)
@@ -81,6 +81,11 @@ TODO: document here the examples about plugins
     You can start asynchronous executions, in a way that is very
     similar to asynchronous communications.
     
+  - <b>Monitoring asynchronous executions</b>.
+    @ref examples/s4u/exec-monitor/s4u-exec-monitor.cpp \n
+    This example shows how to start an asynchronous execution, and
+    monitor its status.
+    
     TODO: add an example about parallel executions.
 
 @section s4u_ex_actors Acting on Actors
@@ -230,13 +235,15 @@ respective advantages, depending on what you want to model.
 @example examples/s4u/async-waitall/s4u-async-waitall.cpp
 @example examples/s4u/async-waitany/s4u-async-waitany.cpp
 @example examples/s4u/exec-basic/s4u-exec-basic.cpp
+@example examples/s4u/exec-async/s4u-exec-async.cpp
+@example examples/s4u/exec-monitor/s4u-exec-monitor.cpp
 @example examples/s4u/app-token-ring/s4u-app-token-ring.cpp
 @example examples/s4u/app-masterworker/s4u-app-masterworker.cpp
 @example examples/s4u/app-pingpong/s4u-app-pingpong.cpp
 @example examples/s4u/energy-pstate/s4u-energy-pstate.cpp
 @example examples/s4u/io-file-system/s4u-io-file-system.cpp
 @example examples/s4u/io-file-remote/s4u-io-file-remote.cpp
-@example examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp \n
+@example examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp
 @example examples/s4u/mutex/s4u-mutex.cpp
 @example examples/s4u/platform-properties/s4u-platform-properties.cpp
 @example examples/s4u/platform-properties/s4u-platform-properties_d.xml
@@ -41,11 +41,7 @@ static void executor()
 
 static void monitor()
 {
-  simgrid::s4u::Host* pm0           = simgrid::s4u::Host::by_name("Fafard");
-  simgrid::s4u::VirtualMachine* vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
-  vm0->start();
-
-  simgrid::s4u::Actor::createActor("compute", vm0, executor);
+  simgrid::s4u::Actor::createActor("compute", simgrid::s4u::Host::by_name("Fafard"), executor);
 
   while (simgrid::s4u::Engine::getClock() < 100) {
     if (activity)
@@ -54,7 +50,6 @@ static void monitor()
   }
 
   simgrid::s4u::this_actor::sleep_for(10000);
-  vm0->destroy();
 }
 
 int main(int argc, char* argv[])
@@ -2,7 +2,7 @@
 
 p Testing a vm with two successive tasks
 
-$ $SG_TEST_EXENV ${bindir:=.}/s4u-cloud-progress-monitor$EXEEXT ${platfdir}/small_platform.xml
+$ $SG_TEST_EXENV ${bindir:=.}/s4u-exec-monitor$EXEEXT ${platfdir}/small_platform.xml
 > [VM0:compute:(2) 0.000000] [s4u_test/INFO] VM0:compute task 1 created 0
 > [Fafard:master_:(1) 1.000000] [s4u_test/INFO] activity remaining duration: 9.23704e+08
 > [Fafard:master_:(1) 2.000000] [s4u_test/INFO] activity remaining duration: 8.47408e+08