Add better debug log output

This commit is contained in:
Patrick Niklaus 2016-10-07 14:14:06 +02:00 committed by Patrick Niklaus
parent da04563e26
commit 2512cf386d
2 changed files with 8 additions and 2 deletions

View File

@ -93,6 +93,8 @@ class SharedMemory
{ // read_only
shm = boost::interprocess::xsi_shared_memory(boost::interprocess::open_only, key);
util::SimpleLogger().Write(logDEBUG) << "opening " << shm.get_shmid() << " from id "
<< id;
region = boost::interprocess::mapped_region(
shm,
(read_write ? boost::interprocess::read_write : boost::interprocess::read_only));
@ -106,6 +108,8 @@ class SharedMemory
}
shm = boost::interprocess::xsi_shared_memory(
boost::interprocess::open_or_create, key, size);
util::SimpleLogger().Write(logDEBUG) << "opening/creating " << shm.get_shmid()
<< " from id " << id << " with size " << size;
#ifdef __linux__
if (-1 == shmctl(shm.get_shmid(), SHM_LOCK, nullptr))
{
@ -166,8 +170,8 @@ class SharedMemory
bool ret = false;
try
{
util::SimpleLogger().Write(logDEBUG) << "deallocating prev memory";
boost::interprocess::xsi_shared_memory xsi(boost::interprocess::open_only, key);
util::SimpleLogger().Write(logDEBUG) << "deallocating prev memory " << xsi.get_shmid();
ret = boost::interprocess::xsi_shared_memory::remove(xsi.get_shmid());
}
catch (const boost::interprocess::interprocess_exception &e)
@ -306,7 +310,7 @@ class SharedMemory
bool ret = false;
try
{
util::SimpleLogger().Write(logDEBUG) << "deallocating prev memory";
util::SimpleLogger().Write(logDEBUG) << "deallocating prev memory for key " << key;
ret = boost::interprocess::shared_memory_object::remove(key);
}
catch (const boost::interprocess::interprocess_exception &e)

View File

@ -739,7 +739,9 @@ int Storage::Run()
static_cast<SharedDataTimestamp *>(data_type_memory->Ptr());
{
util::SimpleLogger().Write(logDEBUG) << "waiting for all queries to finish";
boost::interprocess::scoped_lock<boost::interprocess::named_sharable_mutex> query_lock(barrier.query_mutex);
util::SimpleLogger().Write(logDEBUG) << "all queries complete, switching over.";
data_timestamp_ptr->layout = layout_region;
data_timestamp_ptr->data = data_region;