Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to define log categories twice.
[simgrid.git] / examples / s4u / io-disk-raw / s4u-io-disk-raw.cpp
index 49c9093..4b36beb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017-2021. The SimGrid Team. All rights reserved.          */
 
 /* 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. */
@@ -7,7 +7,7 @@
 #include <string>
 #include <unordered_map>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(disk, "Messages specific for this simulation");
+XBT_LOG_NEW_DEFAULT_CATEGORY(disk_test, "Messages specific for this simulation");
 
 static void host()
 {
@@ -18,7 +18,7 @@ static void host()
   std::vector<simgrid::s4u::Disk*> const& disk_list = simgrid::s4u::Host::current()->get_disks();
 
   /* - For each disk mounted on host, display disk name and mount point */
-  for (auto disk : disk_list)
+  for (auto const& disk : disk_list)
     XBT_INFO("Disk name: %s (read: %.0f B/s -- write: %.0f B/s ", disk->get_cname(), disk->get_read_bandwidth(),
              disk->get_write_bandwidth());
 
@@ -34,7 +34,7 @@ static void host()
   /* - Attach some user data to disk1 */
   XBT_INFO("*** Get/set data for storage element: Disk1 ***");
 
-  const std::string* data = static_cast<std::string*>(disk->get_data());
+  const auto* data = static_cast<std::string*>(disk->get_data());
 
   XBT_INFO("Get storage data: '%s'", data ? data->c_str() : "No user data");
 
@@ -52,7 +52,7 @@ int main(int argc, char** argv)
   /* - Display Host properties */
   for (auto h : e.get_all_hosts()) {
     XBT_INFO("*** %s properties ****", h->get_cname());
-    for (auto kv : *h->get_properties())
+    for (auto const& kv : *h->get_properties())
       XBT_INFO("  %s -> %s", kv.first.c_str(), kv.second.c_str());
   }