Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarex committed Apr 5, 2018
1 parent 1b987fe commit 13e44fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
2 changes: 0 additions & 2 deletions include/storage/shared_datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]; }
Expand Down
6 changes: 3 additions & 3 deletions src/storage/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(shm_key);

// Populate a memory layout into stack memory
DataLayout layout;
Expand Down Expand Up @@ -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<int>(shm_key)
<< " with timestamp " << next_timestamp;
monitor.notify_all();

Expand 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<int>(in_use_key)
<< " for removal... ";

// aquire a handle for the old shared memory region before we mark it for deletion
Expand Down
22 changes: 13 additions & 9 deletions src/tools/store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(key);
}
}

Expand All @@ -32,12 +32,14 @@ void listRegions()
std::vector<std::string> 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<int>(region.shm_key) << "\t"
<< region.timestamp << "\t" << shm->Size();
}
}

Expand Down Expand Up @@ -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<std::string>(&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<std::string>(&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
Expand Down

0 comments on commit 13e44fe

Please sign in to comment.