From 13e44fec6a4b0798a37334c206178fdd609ae94c Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Thu, 5 Apr 2018 11:24:52 +0000 Subject: [PATCH] Address PR comments --- include/storage/shared_datatype.hpp | 2 -- src/storage/storage.cpp | 6 +++--- src/tools/store.cpp | 22 +++++++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/storage/shared_datatype.hpp b/include/storage/shared_datatype.hpp index 6968d42222e..720a37d464c 100644 --- a/include/storage/shared_datatype.hpp +++ b/include/storage/shared_datatype.hpp @@ -232,8 +232,6 @@ struct SharedRegionRegister } } - void Deregister(const RegionID key) { regions[key] = SharedRegion{}; } - const auto &GetRegion(const RegionID key) const { return regions[key]; } auto &GetRegion(const RegionID key) { return regions[key]; } diff --git a/src/storage/storage.cpp b/src/storage/storage.cpp index f21c7f266c9..c785edf5f07 100644 --- a/src/storage/storage.cpp +++ b/src/storage/storage.cpp @@ -117,7 +117,7 @@ int Storage::Run(int max_wait, const std::string &dataset_name) util::UnbufferedLog() << "ok."; } - util::Log() << "Loading data into " << shm_key; + util::Log() << "Loading data into " << static_cast(shm_key); // Populate a memory layout into stack memory DataLayout layout; @@ -176,7 +176,7 @@ int Storage::Run(int max_wait, const std::string &dataset_name) } } - util::Log() << "All data loaded. Notify all client about new data in " << shm_key + util::Log() << "All data loaded. Notify all client about new data in " << static_cast(shm_key) << " with timestamp " << next_timestamp; monitor.notify_all(); @@ -185,7 +185,7 @@ int Storage::Run(int max_wait, const std::string &dataset_name) if (in_use_key != SharedRegionRegister::MAX_SHM_KEYS && storage::SharedMemory::RegionExists(in_use_key)) { - util::UnbufferedLog() << "Marking old shared memory region " << in_use_key + util::UnbufferedLog() << "Marking old shared memory region " << static_cast(in_use_key) << " for removal... "; // aquire a handle for the old shared memory region before we mark it for deletion diff --git a/src/tools/store.cpp b/src/tools/store.cpp index ad4d73066cb..9342a10e7c0 100644 --- a/src/tools/store.cpp +++ b/src/tools/store.cpp @@ -21,7 +21,7 @@ void deleteRegion(const storage::SharedRegionRegister::ShmKey key) { if (storage::SharedMemory::RegionExists(key) && !storage::SharedMemory::Remove(key)) { - util::Log(logWARNING) << "could not delete shared memory region " << key; + util::Log(logWARNING) << "could not delete shared memory region " << static_cast(key); } } @@ -32,12 +32,14 @@ void listRegions() std::vector names; const auto &shared_register = monitor.data(); shared_register.List(std::back_inserter(names)); - osrm::util::Log() << "name\tshm key\ttimestamp"; + osrm::util::Log() << "name\tshm key\ttimestamp\tsize"; for (const auto &name : names) { auto id = shared_register.Find(name); auto region = shared_register.GetRegion(id); - osrm::util::Log() << name << "\t" << (int)region.shm_key << "\t" << region.timestamp; + auto shm = osrm::storage::makeSharedMemory(region.shm_key); + osrm::util::Log() << name << "\t" << static_cast(region.shm_key) << "\t" + << region.timestamp << "\t" << shm->Size(); } } @@ -77,12 +79,14 @@ bool generateDataStoreOptions(const int argc, { // declare a group of options that will be allowed only on command line boost::program_options::options_description generic_options("Options"); - generic_options.add_options()("version,v", "Show version")("help,h", "Show this help message")( - "verbosity,l", - boost::program_options::value(&verbosity)->default_value("INFO"), - std::string("Log verbosity level: " + util::LogPolicy::GetLevels()).c_str())( - "remove-locks,r", "Remove locks")("spring-clean,s", - "Spring-cleaning all shared memory regions"); + generic_options.add_options() // + ("version,v", "Show version") // + ("help,h", "Show this help message") // + ("verbosity,l", + boost::program_options::value(&verbosity)->default_value("INFO"), + std::string("Log verbosity level: " + util::LogPolicy::GetLevels()).c_str()) // + ("remove-locks,r", "Remove locks") // + ("spring-clean,s", "Spring-cleaning all shared memory regions"); // declare a group of options that will be allowed both on command line // as well as in a config file