Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
revise this test to access storage directly
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 23 Nov 2017 15:18:16 +0000 (16:18 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 23 Nov 2017 15:18:16 +0000 (16:18 +0100)
teshsuite/s4u/concurrent_rw/concurrent_rw.cpp
teshsuite/s4u/concurrent_rw/concurrent_rw.tesh

index d079d3d..0c1db3c 100644 (file)
@@ -4,44 +4,32 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/s4u.hpp"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "simgrid/s4u.hpp"
-#include <unistd.h>
-
-#define FILENAME1 "/home/doc/simgrid/examples/platforms/g5k.xml"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test");
 
 static void host()
 {
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u test");
 
 static void host()
 {
-  char name[2048];
+  simgrid::s4u::Storage* storage = simgrid::s4u::Storage::byName("Disk1");
   int id = simgrid::s4u::this_actor::getPid();
   int id = simgrid::s4u::this_actor::getPid();
-  snprintf(name, 2048, "%s%i", FILENAME1, id);
-  simgrid::s4u::File* file = new simgrid::s4u::File(name, NULL);
   XBT_INFO("process %d is writing!", id);
   XBT_INFO("process %d is writing!", id);
-  file->write(3000000);
+  storage->write(3000000);
   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);
   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);
-  file->write(3000000);
+  storage->write(3000000);
   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);
   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);
-  file->seek(0);
-  file->read(3000000);
+  storage->read(3000000);
   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);
   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);
-  file->seek(0);
-  file->read(3000000);
-
-  XBT_INFO("process %d => Size of %s: %llu", id, name, file->size());
-  // Close the file
-  delete file;
+  storage->read(3000000);
 }
 
 int main(int argc, char** argv)
 {
   simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
 }
 
 int main(int argc, char** argv)
 {
   simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
-  sg_storage_file_system_init();
   e->loadPlatform(argv[1]);
 
   for (int i = 0; i < 5; i++)
   e->loadPlatform(argv[1]);
 
   for (int i = 0; i < 5; i++)
index 6e2576a..1d46abe 100644 (file)
@@ -30,13 +30,8 @@ $ ./concurrent_rw$EXEEXT ${srcdir:=.}/../../../examples/platforms/storage/storag
 > [  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!
 > [  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!
-> [  7.780000] (host@bob) process 1 => Size of /home/doc/simgrid/examples/platforms/g5k.xml1: 6000000
 > [  8.750000] (host@bob) process 2 is reading again!
 > [  8.750000] (host@bob) process 2 is reading again!
-> [  8.780000] (host@bob) process 2 => Size of /home/doc/simgrid/examples/platforms/g5k.xml2: 6000000
 > [  9.750000] (host@bob) process 3 is reading again!
 > [  9.750000] (host@bob) process 3 is reading again!
-> [  9.780000] (host@bob) process 3 => Size of /home/doc/simgrid/examples/platforms/g5k.xml3: 6000000
 > [ 10.750000] (host@bob) process 4 is reading again!
 > [ 10.750000] (host@bob) process 4 is reading again!
-> [ 10.780000] (host@bob) process 4 => Size of /home/doc/simgrid/examples/platforms/g5k.xml4: 6000000
 > [ 11.750000] (host@bob) process 5 is reading again!
 > [ 11.750000] (host@bob) process 5 is reading again!
-> [ 11.780000] (host@bob) process 5 => Size of /home/doc/simgrid/examples/platforms/g5k.xml5: 6000000
 > [ 11.780000] (maestro@) Simulation time 11.78
 > [ 11.780000] (maestro@) Simulation time 11.78