Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
extend example with another disk
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 26 Feb 2021 15:00:18 +0000 (16:00 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 26 Feb 2021 15:00:28 +0000 (16:00 +0100)
examples/cpp/io-disk-raw/s4u-io-disk-raw.cpp
examples/cpp/io-disk-raw/s4u-io-disk-raw.tesh

index 4b36beb..5498513 100644 (file)
@@ -11,6 +11,13 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(disk_test, "Messages specific for this simulation")
 
 static void host()
 {
+  /* -Add an extra disk in a programmatic way */
+  simgrid::s4u::Host::current()->create_disk()
+       ->set_name("Disk3")
+       ->set_read_bandwidth(9.6e7)
+       ->set_write_bandwidth(6.4e7)
+       ->seal();
+
   /* - Display information on the disks mounted by the current host */
   XBT_INFO("*** Storage info on %s ***", simgrid::s4u::Host::current()->get_cname());
 
@@ -31,6 +38,11 @@ static void host()
   sg_size_t read = disk->read(200000);
   XBT_INFO("Read %llu bytes on '%s'", read, disk->get_cname());
 
+  /* - Write 800,000 bytes on Disk3 */
+  simgrid::s4u::Disk* disk3 = disk_list.back();
+  sg_size_t write_on_disk3  = disk3->write(800000);
+  XBT_INFO("Wrote %llu bytes on '%s'", write_on_disk3, disk3->get_cname());
+
   /* - Attach some user data to disk1 */
   XBT_INFO("*** Get/set data for storage element: Disk1 ***");
 
@@ -56,6 +68,7 @@ int main(int argc, char** argv)
       XBT_INFO("  %s -> %s", kv.first.c_str(), kv.second.c_str());
   }
 
+
   simgrid::s4u::Actor::create("", simgrid::s4u::Host::by_name("bob"), host);
 
   e.run();
index 024aba7..2c8b5c3 100644 (file)
@@ -10,9 +10,11 @@ $ ${bindir}/s4u-io-disk-raw ${platfdir}/hosts_with_disks.xml "--log=root.fmt:[%1
 > [  0.000000] (1:@bob) *** Storage info on bob ***
 > [  0.000000] (1:@bob) Disk name: Disk1 (read: 100000000 B/s -- write: 40000000 B/s 
 > [  0.000000] (1:@bob) Disk name: Disk2 (read: 200000000 B/s -- write: 80000000 B/s 
+> [  0.000000] (1:@bob) Disk name: Disk3 (read: 96000000 B/s -- write: 64000000 B/s 
 > [  0.010000] (1:@bob) Wrote 400000 bytes on 'Disk1'
 > [  0.012000] (1:@bob) Read 200000 bytes on 'Disk1'
-> [  0.012000] (1:@bob) *** Get/set data for storage element: Disk1 ***
-> [  0.012000] (1:@bob) Get storage data: 'No user data'
-> [  0.012000] (1:@bob) Set and get data: 'Some user data'
-> [  0.012000] (0:maestro@) Simulated time: 0.012
+> [  0.024500] (1:@bob) Wrote 800000 bytes on 'Disk3'
+> [  0.024500] (1:@bob) *** Get/set data for storage element: Disk1 ***
+> [  0.024500] (1:@bob) Get storage data: 'No user data'
+> [  0.024500] (1:@bob) Set and get data: 'Some user data'
+> [  0.024500] (0:maestro@) Simulated time: 0.0245