Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another test conversion to disks
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 17 Sep 2019 07:34:49 +0000 (09:34 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 17 Sep 2019 07:34:49 +0000 (09:34 +0200)
teshsuite/s4u/concurrent_rw/concurrent_rw.cpp
teshsuite/s4u/concurrent_rw/concurrent_rw.tesh

index 9cb7c06..1261137 100644 (file)
@@ -9,22 +9,22 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test");
 
 static void host()
 {
-  simgrid::s4u::Storage* storage = simgrid::s4u::Storage::by_name("Disk1");
-  int id                         = simgrid::s4u::this_actor::get_pid();
+  simgrid::s4u::Disk* disk = simgrid::s4u::this_actor::get_host()->get_disks().front(); // Disk1
+  int id                   = simgrid::s4u::this_actor::get_pid();
   XBT_INFO("process %d is writing!", id);
-  storage->write(3000000);
+  disk->write(4000000);
   XBT_INFO("process %d goes to sleep for %d seconds", id, id);
   simgrid::s4u::this_actor::sleep_for(id);
   XBT_INFO("process %d is writing again!", id);
-  storage->write(3000000);
+  disk->write(4000000);
   XBT_INFO("process %d goes to sleep for %d seconds", id, 6 - id);
   simgrid::s4u::this_actor::sleep_for(6 - id);
   XBT_INFO("process %d is reading!", id);
-  storage->read(3000000);
+  disk->read(4000000);
   XBT_INFO("process %d goes to sleep for %d seconds", id, id);
   simgrid::s4u::this_actor::sleep_for(id);
   XBT_INFO("process %d is reading again!", id);
-  storage->read(3000000);
+  disk->read(4000000);
 }
 
 int main(int argc, char** argv)
index 89994b3..89e43ce 100644 (file)
@@ -1,4 +1,4 @@
-$ ./concurrent_rw ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
+$ ./concurrent_rw ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%10.6r]%e(%P@%h)%e%m%n"
 > [  0.000000] (host@bob) process 1 is writing!
 > [  0.000000] (host@bob) process 2 is writing!
 > [  0.000000] (host@bob) process 3 is writing!
@@ -24,14 +24,14 @@ $ ./concurrent_rw ${platfdir}/storage/storage.xml "--log=root.fmt:[%10.6r]%e(%P@
 > [  6.600000] (host@bob) process 3 is reading!
 > [  6.600000] (host@bob) process 4 is reading!
 > [  6.600000] (host@bob) process 5 is reading!
-> [  6.750000] (host@bob) process 1 goes to sleep for 1 seconds
-> [  6.750000] (host@bob) process 2 goes to sleep for 2 seconds
-> [  6.750000] (host@bob) process 3 goes to sleep for 3 seconds
-> [  6.750000] (host@bob) process 4 goes to sleep for 4 seconds
-> [  6.750000] (host@bob) process 5 goes to sleep for 5 seconds
-> [  7.750000] (host@bob) process 1 is reading again!
-> [  8.750000] (host@bob) process 2 is reading again!
-> [  9.750000] (host@bob) process 3 is reading again!
-> [ 10.750000] (host@bob) process 4 is reading again!
-> [ 11.750000] (host@bob) process 5 is reading again!
-> [ 11.780000] (maestro@) Simulation time 11.78
+> [  6.800000] (host@bob) process 1 goes to sleep for 1 seconds
+> [  6.800000] (host@bob) process 2 goes to sleep for 2 seconds
+> [  6.800000] (host@bob) process 3 goes to sleep for 3 seconds
+> [  6.800000] (host@bob) process 4 goes to sleep for 4 seconds
+> [  6.800000] (host@bob) process 5 goes to sleep for 5 seconds
+> [  7.800000] (host@bob) process 1 is reading again!
+> [  8.800000] (host@bob) process 2 is reading again!
+> [  9.800000] (host@bob) process 3 is reading again!
+> [ 10.800000] (host@bob) process 4 is reading again!
+> [ 11.800000] (host@bob) process 5 is reading again!
+> [ 11.840000] (maestro@) Simulation time 11.84