Commit f5186d8b authored by Elvin Sindrilaru's avatar Elvin Sindrilaru

COMMON/MGM: Add mutex interface and prepare for different types of RW mutex implementations

Conflicts:
	namespace/ns_quarkdb/accounting/SetChangeList.hh
parent 14f33b62
......@@ -73,6 +73,7 @@ set(EOSCOMMON_SRCS
StringConversion.cc
CommentLog.cc
RWMutex.cc
PthreadRWMutex.cc
XrdErrorMap.cc
JeMallocHandler.cc
plugin_manager/Plugin.hh
......@@ -212,7 +213,7 @@ endif()
#-------------------------------------------------------------------------------
if(NOT CLIENT AND Linux)
add_executable(dbmaptestburn dbmaptest/DbMapTestBurn.cc)
add_executable(mutextest mutextest/RWMutexTest.cc RWMutex.cc)
add_executable(mutextest mutextest/RWMutexTest.cc RWMutex.cc PthreadRWMutex.cc)
add_executable(dbmaptestfunc
dbmaptest/DbMapTestFunc.cc
${DBMAPTEST_SRCS}
......
//------------------------------------------------------------------------------
// File: IRWMutex.hh
//------------------------------------------------------------------------------
/************************************************************************
* EOS - the CERN Disk Storage System *
* Copyright (C) 2018 CERN/Switzerland *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
************************************************************************/
#pragma once
#include "common/Namespace.hh"
EOSCOMMONNAMESPACE_BEGIN
class IRWMutex
{
public:
//----------------------------------------------------------------------------
//! Constructor
// ---------------------------------------------------------------------------
IRWMutex() = default;
//----------------------------------------------------------------------------
//! Destructor
//----------------------------------------------------------------------------
virtual ~IRWMutex() = default;
//----------------------------------------------------------------------------
//! Set the write lock to blocking or not blocking
//!
//! @param block blocking mode
//----------------------------------------------------------------------------
virtual void SetBlocking(bool block) = 0;
//----------------------------------------------------------------------------
//! Set the time to wait for the acquisition of the write mutex before
//! releasing quicky and retrying.
//!
//! @param nsec nanoseconds
//----------------------------------------------------------------------------
virtual void SetWLockTime(const size_t& nsec) = 0;
//----------------------------------------------------------------------------
//! Lock for read
//----------------------------------------------------------------------------
virtual void LockRead() = 0;
//----------------------------------------------------------------------------
//! Lock for read allowing to be canceled waiting for the lock
//----------------------------------------------------------------------------
virtual void LockReadCancel() = 0;
//----------------------------------------------------------------------------
//! Unlock a read lock
//----------------------------------------------------------------------------
virtual void UnLockRead() = 0;
//----------------------------------------------------------------------------
//! Lock for write
//----------------------------------------------------------------------------
virtual void LockWrite() = 0;
//----------------------------------------------------------------------------
//! Unlock a write lock
//----------------------------------------------------------------------------
virtual void UnLockWrite() = 0;
//----------------------------------------------------------------------------
//! Try to read lock the mutex within the timout value
//!
//! @param timeout_ms time duration in milliseconds we can wait for the lock
//!
//! @return 0 if lock aquired, ETIMEOUT if timeout occured
//----------------------------------------------------------------------------
virtual int TimedRdLock(uint64_t timeout_ms) = 0;
//----------------------------------------------------------------------------
//! Lock for write but give up after wlocktime
//----------------------------------------------------------------------------
virtual int TimeoutLockWrite() = 0;
//----------------------------------------------------------------------------
//! Get Readlock Counter
//----------------------------------------------------------------------------
virtual size_t GetReadLockCounter() = 0;
//----------------------------------------------------------------------------
//! Get Writelock Counter
//----------------------------------------------------------------------------
virtual size_t GetWriteLockCounter() = 0;
};
EOSCOMMONNAMESPACE_END
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -25,6 +25,7 @@
// Program demonstrating the timing facilities of the RWMutex class
//----------------------------------------------------------------------------
#include <iostream>
#include "common/PthreadRWMutex.hh"
#include "common/RWMutex.hh"
using namespace eos::common;
......@@ -32,8 +33,8 @@ const int loopsize = 10e6;
const unsigned long int NNUM_THREADS = 10;
pthread_t threads[NNUM_THREADS];
unsigned long int NUM_THREADS = NNUM_THREADS;
RWMutex globmutex;
RWMutex gm1, gm2, gm3;
PthreadRWMutex globmutex;
PthreadRWMutex gm1, gm2, gm3;
//----------------------------------------------------------------------------
//! Output to stream operator for TimingStats structure
......@@ -44,12 +45,12 @@ RWMutex gm1, gm2, gm3;
//! @return reference to output stream
//----------------------------------------------------------------------------
inline std::ostream& operator << (std::ostream& os,
const RWMutex::TimingStats& stats)
const PthreadRWMutex::TimingStats& stats)
{
os << "\t" << "RWMutex Read Wait (number : min , avg , max)" << " = "
os << "\t" << "PthreadRWMutex Read Wait (number : min , avg , max)" << " = "
<< stats.readLockCounterSample << " : " << stats.minwaitread << " , "
<< stats.averagewaitread << " , " << stats.maxwaitread << std::endl
<< "\t" << "RWMutex Write Wait (number : min , avg , max)" << " = "
<< "\t" << "PthreadRWMutex Write Wait (number : min , avg , max)" << " = "
<< stats.writeLockCounterSample << " : " << stats.minwaitwrite << " , "
<< stats.averagewaitwrite << " , " << stats.maxwaitwrite << std::endl;
return os;
......@@ -141,9 +142,9 @@ TestThread2(void* threadid)
int
main()
{
RWMutex::SetOrderCheckingGlobal(false);
std::cout << " Using Instrumented Version of RWMutex class" << std::endl;
RWMutex::EstimateLatenciesAndCompensation();
PthreadRWMutex::SetOrderCheckingGlobal(false);
std::cout << " Using Instrumented Version of PthreadRWMutex class" << std::endl;
PthreadRWMutex::EstimateLatenciesAndCompensation();
size_t t = Timing::GetNowInNs();
for (int k = 0; k < loopsize; ++k) {
......@@ -159,8 +160,8 @@ main()
1.0e9 << " sec" << " (" << double(loopsize) / (t / 1.0e9) << "Hz" << ")" <<
std::endl;
std::cout << " ------------------------- " << std::endl << std::endl;
RWMutex::SetTimingGlobal(true);
RWMutex mutex, mutex2;
PthreadRWMutex::SetTimingGlobal(true);
PthreadRWMutex mutex, mutex2;
mutex.SetTiming(true);
t = Timing::GetNowInNs();
......@@ -170,7 +171,7 @@ main()
}
t = Timing::GetNowInNs() - t;
RWMutex::TimingStats stats;
PthreadRWMutex::TimingStats stats;
mutex.GetTimingStatistics(stats);
std::cout << " ------------------------- " << std::endl;
std::cout << " Monothreaded Loop of size " << double(loopsize) << " took " <<
......@@ -179,7 +180,7 @@ main()
std::endl;
std::cout << stats;
std::cout << " ------------------------- " << std::endl << std::endl;
float rate = RWMutex::GetSamplingRateFromCPUOverhead(0.033);
float rate = PthreadRWMutex::GetSamplingRateFromCPUOverhead(0.033);
std::cout << " suggested sample rate is " << rate << std::endl << std::endl;
mutex2.SetTiming(true);
mutex2.SetSampling(true);
......@@ -198,9 +199,9 @@ main()
double(loopsize) / (t / 1.0e9) << "Hz" << ")" << std::endl;
std::cout << stats;
std::cout << " ------------------------- " << std::endl << std::endl;
RWMutex mutex3;
PthreadRWMutex mutex3;
// By default no local timing, but global timing with samplerate of 1
RWMutex::SetTimingGlobal(false);
PthreadRWMutex::SetTimingGlobal(false);
t = Timing::GetNowInNs();
for (int k = 0; k < loopsize; ++k) {
......@@ -216,7 +217,7 @@ main()
std::cout << " no stats available" << std::endl;
std::cout << " ------------------------- " << std::endl << std::endl;
globmutex.SetBlocking(true);
RWMutex::SetTimingGlobal(false);
PthreadRWMutex::SetTimingGlobal(false);
t = Timing::GetNowInNs();
RunThreads(&TestThread);
t = Timing::GetNowInNs() - t;
......@@ -231,7 +232,7 @@ main()
sleep(1);
//----------------------------------------------------------------------------
globmutex.SetBlocking(false);
RWMutex::SetTimingGlobal(false);
PthreadRWMutex::SetTimingGlobal(false);
t = Timing::GetNowInNs();
RunThreads(&TestThread);
t = Timing::GetNowInNs() - t;
......@@ -247,7 +248,7 @@ main()
//----------------------------------------------------------------------------
globmutex.SetBlocking(true);
globmutex.SetDeadlockCheck(true);
RWMutex::SetTimingGlobal(false);
PthreadRWMutex::SetTimingGlobal(false);
t = Timing::GetNowInNs();
RunThreads(&TestThread);
t = Timing::GetNowInNs() - t;
......@@ -272,7 +273,7 @@ main()
globmutex.SetTiming(true);
globmutex.SetSampling(true);
globmutex.ResetTimingStatistics();
RWMutex::SetTimingGlobal(true);
PthreadRWMutex::SetTimingGlobal(true);
t = Timing::GetNowInNs();
RunThreads(&TestThread);
t = Timing::GetNowInNs() - t;
......@@ -290,7 +291,7 @@ main()
globmutex.SetTiming(true);
globmutex.SetSampling(true);
globmutex.ResetTimingStatistics();
RWMutex::SetTimingGlobal(true);
PthreadRWMutex::SetTimingGlobal(true);
t = Timing::GetNowInNs();
RunThreads(&TestThread);
t = Timing::GetNowInNs() - t;
......@@ -305,26 +306,26 @@ main()
std::cout << " ------------------------- " << std::endl << std::endl;
std::cout << " ------------------------- " << std::endl;
std::cout << " Global statistics" << std::endl;
RWMutex::GetTimingStatisticsGlobal(stats);
PthreadRWMutex::GetTimingStatisticsGlobal(stats);
std::cout << stats;
std::cout << " ------------------------- " << std::endl << std::endl;
std::cout << "#################################################" << std::endl;
std::cout << "######## MONOTHREADED ORDER CHECKING TESTS ######" << std::endl;
std::cout << "#################################################" << std::endl;
RWMutex::SetTimingGlobal(false);
RWMutex::SetOrderCheckingGlobal(true);
vector<RWMutex*> order;
PthreadRWMutex::SetTimingGlobal(false);
PthreadRWMutex::SetOrderCheckingGlobal(true);
vector<IRWMutex*> order;
order.push_back(&gm1);
gm1.SetDebugName("mutex1");
order.push_back(&gm2);
gm2.SetDebugName("mutex2");
order.push_back(&gm3);
gm3.SetDebugName("mutex3");
RWMutex::AddOrderRule("rule1", order);
PthreadRWMutex::AddOrderRule("rule1", order);
order.clear();
order.push_back(&gm2);
order.push_back(&gm3);
RWMutex::AddOrderRule("rule2", order);
PthreadRWMutex::AddOrderRule("rule2", order);
std::cout << "==== Trying lock/unlock mutex in proper order... ====" <<
std::endl;
std::cout.flush();
......@@ -347,7 +348,7 @@ main()
gm1.UnLockWrite();
std::cout << "======== ... done ========" << std::endl << std::endl;
std::cout.flush();
RWMutex::SetOrderCheckingGlobal(false);
PthreadRWMutex::SetOrderCheckingGlobal(false);
t = Timing::GetNowInNs();
for (int k = 0; k < loopsize; ++k) {
......@@ -366,7 +367,7 @@ main()
<< double(loopsize) / (t / 1.0e9) << "Hz" << ")" << std::endl;
std::cout << " no stats available" << std::endl;
std::cout << " ------------------------- " << std::endl << std::endl;
RWMutex::SetOrderCheckingGlobal(true);
PthreadRWMutex::SetOrderCheckingGlobal(true);
t = Timing::GetNowInNs();
for (int k = 0; k < loopsize; ++k) {
......@@ -396,8 +397,8 @@ main()
int
main()
{
std::cout << " Using NON-Instrumented Version of RWMutex class" << std::endl;
RWMutex mutex3;
std::cout << " Using NON-Instrumented Version of PthreadRWMutex class" << std::endl;
PthreadRWMutex mutex3;
size_t t = Timing::GetNowInNs();
for (int k = 0; k < loopsize; ++k) {
......
......@@ -1172,8 +1172,9 @@ Stat::Circulate()
unsigned long long ns2 = 0;
unsigned long long view1 = 0;
unsigned long long view2 = 0;
eos::common::RWMutex::TimingStats qu12stmp, ns12stmp, view12stmp;
unsigned long long ns1tmp, ns2tmp, view1tmp, view2tmp, qu1tmp, qu2tmp;
eos::common::PthreadRWMutex::TimingStats qu12stmp, ns12stmp, view12stmp;
unsigned long long ns1tmp = 0ull, ns2tmp = 0ull, view1tmp = 0ull,
view2tmp = 0ull, qu1tmp = 0ull, qu2tmp = 0ull;
#endif
// empty the circular buffer and extract some Mq statistic values
......@@ -1186,21 +1187,32 @@ Stat::Circulate()
l2tmp = XrdMqSharedHash::sSetNLCounter.load();
l3tmp = XrdMqSharedHash::sGetCounter.load();
#ifdef EOS_INSTRUMENTED_RWMUTEX
// fsview statistics extraction
view1tmp = FsView::gFsView.ViewMutex.GetReadLockCounter();
view2tmp = FsView::gFsView.ViewMutex.GetWriteLockCounter();
FsView::gFsView.ViewMutex.GetTimingStatistics(view12stmp);
FsView::gFsView.ViewMutex.ResetTimingStatistics();
// namespace lock statistics extraction
ns1tmp = gOFS->eosViewRWMutex.GetReadLockCounter();
ns2tmp = gOFS->eosViewRWMutex.GetWriteLockCounter();
gOFS->eosViewRWMutex.GetTimingStatistics(ns12stmp);
gOFS->eosViewRWMutex.ResetTimingStatistics();
// quota lock statistics extraction
qu1tmp = Quota::pMapMutex.GetReadLockCounter();
qu2tmp = Quota::pMapMutex.GetWriteLockCounter();
Quota::pMapMutex.GetTimingStatistics(qu12stmp);
Quota::pMapMutex.ResetTimingStatistics();
eos::common::PthreadRWMutex* fs_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>
(FsView::gFsView.ViewMutex.GetRawPtr());
eos::common::PthreadRWMutex* quota_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>(Quota::pMapMutex.GetRawPtr());
eos::common::PthreadRWMutex* ns_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>(gOFS->eosViewRWMutex.GetRawPtr());
if (fs_mtx && quota_mtx && ns_mtx) {
// fsview statistics extraction
view1tmp = fs_mtx->GetReadLockCounter();
view2tmp = fs_mtx->GetWriteLockCounter();
fs_mtx->GetTimingStatistics(view12stmp);
fs_mtx->ResetTimingStatistics();
// namespace lock statistics extraction
ns1tmp = ns_mtx->GetReadLockCounter();
ns2tmp = ns_mtx->GetWriteLockCounter();
ns_mtx->GetTimingStatistics(ns12stmp);
ns_mtx->ResetTimingStatistics();
// quota lock statistics extraction
qu1tmp = quota_mtx->GetReadLockCounter();
qu2tmp = quota_mtx->GetWriteLockCounter();
quota_mtx->GetTimingStatistics(qu12stmp);
quota_mtx->ResetTimingStatistics();
}
#endif
Add("HashSet", 0, 0, l1tmp - l1);
Add("HashSetNoLock", 0, 0, l2tmp - l2);
......
......@@ -1839,21 +1839,32 @@ XrdMgmOfs::Configure(XrdSysError& Eroute)
// default.eoscf in which it only holds a few entries.
FsView::gFsView.SetConfigEngine(ConfEngine);
#ifdef EOS_INSTRUMENTED_RWMUTEX
eos::common::RWMutex::EstimateLatenciesAndCompensation();
FsView::gFsView.ViewMutex.SetDebugName("FsView");
FsView::gFsView.ViewMutex.SetTiming(false);
FsView::gFsView.ViewMutex.SetSampling(true, 0.01);
Quota::pMapMutex.SetDebugName("QuotaView");
Quota::pMapMutex.SetTiming(false);
Quota::pMapMutex.SetSampling(true, 0.01);
eosViewRWMutex.SetDebugName("eosView");
eosViewRWMutex.SetTiming(false);
eosViewRWMutex.SetSampling(true, 0.01);
std::vector<eos::common::RWMutex*> order;
order.push_back(&FsView::gFsView.ViewMutex);
order.push_back(&eosViewRWMutex);
order.push_back(&Quota::pMapMutex);
eos::common::RWMutex::AddOrderRule("Eos Mgm Mutexes", order);
eos::common::PthreadRWMutex* fs_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>
(FsView::gFsView.ViewMutex.GetRawPtr());
eos::common::PthreadRWMutex* quota_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>(Quota::pMapMutex.GetRawPtr());
eos::common::PthreadRWMutex* ns_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>(eosViewRWMutex.GetRawPtr());
if (fs_mtx && quota_mtx && ns_mtx) {
eos::common::PthreadRWMutex::EstimateLatenciesAndCompensation();
fs_mtx->SetDebugName("FsView");
fs_mtx->SetTiming(false);
fs_mtx->SetSampling(true, 0.01);
quota_mtx->SetDebugName("QuotaView");
quota_mtx->SetTiming(false);
quota_mtx->SetSampling(true, 0.01);
ns_mtx->SetDebugName("eosView");
ns_mtx->SetTiming(false);
ns_mtx->SetSampling(true, 0.01);
std::vector<eos::common::IRWMutex*> order;
order.push_back(FsView::gFsView.ViewMutex.GetRawPtr());
order.push_back(eosViewRWMutex.GetRawPtr());
order.push_back(Quota::pMapMutex.GetRawPtr());
eos::common::PthreadRWMutex::AddOrderRule("Eos Mgm Mutexes", order);
}
#endif
eos_info("starting statistics thread");
......
......@@ -83,32 +83,46 @@ NsCmd::MutexSubcmd(const eos::console::NsProto_MutexProto& mutex,
no_option = false;
}
eos::common::PthreadRWMutex* fs_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>
(FsView::gFsView.ViewMutex.GetRawPtr());
eos::common::PthreadRWMutex* quota_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>(Quota::pMapMutex.GetRawPtr());
eos::common::PthreadRWMutex* ns_mtx =
dynamic_cast<eos::common::PthreadRWMutex*>(gOFS->eosViewRWMutex.GetRawPtr());
if ((fs_mtx == nullptr) || (quota_mtx == nullptr) || (ns_mtx == nullptr)) {
reply.set_std_err("error: mutex type does not support such options");
reply.set_retc(EINVAL);
return;
}
if (no_option) {
size_t cycleperiod = eos::common::RWMutex::GetLockUnlockDuration();
size_t cycleperiod = eos::common::PthreadRWMutex::GetLockUnlockDuration();
std::string line = "# ------------------------------------------------------"
"------------------------------";
oss << line << std::endl
<< "# Mutex Monitoring Management" << std::endl
<< line << std::endl
<< "order checking is : "
<< (eos::common::RWMutex::GetOrderCheckingGlobal() ? "on " : "off")
<< (eos::common::PthreadRWMutex::GetOrderCheckingGlobal() ? "on " : "off")
<< " (estimated order checking latency for 1 rule ";
size_t orderlatency = eos::common::RWMutex::GetOrderCheckingLatency();
size_t orderlatency = eos::common::PthreadRWMutex::GetOrderCheckingLatency();
oss << orderlatency << " nsec / "
<< int(double(orderlatency) / cycleperiod * 100)
<< "% of the mutex lock/unlock cycle duration)" << std::endl
<< "deadlock checking is : "
<< (eos::common::RWMutex::GetDeadlockCheckingGlobal() ? "on" : "off")
<< (eos::common::PthreadRWMutex::GetDeadlockCheckingGlobal() ? "on" : "off")
<< std::endl
<< "timing is : "
<< (FsView::gFsView.ViewMutex.GetTiming() ? "on " : "off")
<< (fs_mtx->GetTiming() ? "on " : "off")
<< " (estimated timing latency for 1 lock ";
size_t timinglatency = eos::common::RWMutex::GetTimingLatency();
size_t timinglatency = eos::common::PthreadRWMutex::GetTimingLatency();
oss << timinglatency << " nsec / "
<< int(double(timinglatency) / cycleperiod * 100)
<< "% of the mutex lock/unlock cycle duration)" << std::endl
<< "sampling rate is : ";
float sr = FsView::gFsView.ViewMutex.GetSampling();
float sr = fs_mtx->GetSampling();
char ssr[32];
sprintf(ssr, "%f", sr);
oss << (sr < 0 ? "NA" : ssr);
......@@ -124,35 +138,35 @@ NsCmd::MutexSubcmd(const eos::console::NsProto_MutexProto& mutex,
}
if (mutex.toggle_timing()) {
if (FsView::gFsView.ViewMutex.GetTiming()) {
FsView::gFsView.ViewMutex.SetTiming(false);
Quota::pMapMutex.SetTiming(false);
gOFS->eosViewRWMutex.SetTiming(false);
if (fs_mtx->GetTiming()) {
fs_mtx->SetTiming(false);
quota_mtx->SetTiming(false);
ns_mtx->SetTiming(false);
oss << "mutex timing is off" << std::endl;
} else {
FsView::gFsView.ViewMutex.SetTiming(true);
Quota::pMapMutex.SetTiming(true);
gOFS->eosViewRWMutex.SetTiming(true);
fs_mtx->SetTiming(true);
quota_mtx->SetTiming(true);
ns_mtx->SetTiming(true);
oss << "mutex timing is on" << std::endl;
}
}
if (mutex.toggle_order()) {
if (eos::common::RWMutex::GetOrderCheckingGlobal()) {
eos::common::RWMutex::SetOrderCheckingGlobal(false);
if (eos::common::PthreadRWMutex::GetOrderCheckingGlobal()) {
eos::common::PthreadRWMutex::SetOrderCheckingGlobal(false);
oss << "mutex order checking is off" << std::endl;
} else {
eos::common::RWMutex::SetOrderCheckingGlobal(true);
eos::common::PthreadRWMutex::SetOrderCheckingGlobal(true);
oss << "mutex order checking is on" << std::endl;
}
}
if (mutex.toggle_deadlock()) {
if (eos::common::RWMutex::GetDeadlockCheckingGlobal()) {
eos::common::RWMutex::SetDeadlockCheckingGlobal(false);
if (eos::common::PthreadRWMutex::GetDeadlockCheckingGlobal()) {
eos::common::PthreadRWMutex::SetDeadlockCheckingGlobal(false);
oss << "mutex deadlock checking is off" << std::endl;
} else {
eos::common::RWMutex::SetDeadlockCheckingGlobal(true);
eos::common::PthreadRWMutex::SetDeadlockCheckingGlobal(true);
oss << "mutex deadlock checking is on" << std::endl;
}
}
......@@ -169,9 +183,9 @@ NsCmd::MutexSubcmd(const eos::console::NsProto_MutexProto& mutex,
rate = 1.0;
}
FsView::gFsView.ViewMutex.SetSampling(true, rate);
Quota::pMapMutex.SetSampling(true, rate);
gOFS->eosViewRWMutex.SetSampling(true, rate);
fs_mtx->SetSampling(true, rate);
quota_mtx->SetSampling(true, rate);
ns_mtx->SetSampling(true, rate);
}
reply.set_std_out(oss.str());
......@@ -350,15 +364,19 @@ NsCmd::StatSubcmd(const eos::console::NsProto_StatProto& stat)
<< "ALL current container id " << cid_now
<< std::endl
<< line << std::endl;
CacheStatistics fileCacheStats = gOFS->eosFileService->getCacheStatistics();
CacheStatistics containerCacheStats = gOFS->eosDirectoryService->getCacheStatistics();
if(fileCacheStats.enabled || containerCacheStats.enabled) {
oss << "ALL File cache max size " << fileCacheStats.maxSize << std::endl
<< "ALL File cache occupancy " << fileCacheStats.occupancy << std::endl
<< "ALL Container cache max size " << containerCacheStats.maxSize << std::endl
<< "ALL Container cache occupancy " << containerCacheStats.occupancy << std::endl
CacheStatistics containerCacheStats =
gOFS->eosDirectoryService->getCacheStatistics();
if (fileCacheStats.enabled || containerCacheStats.enabled) {
oss << "ALL File cache max size " << fileCacheStats.maxSize <<
std::endl
<< "ALL File cache occupancy " << fileCacheStats.occupancy <<
std::endl
<< "ALL Container cache max size " << containerCacheStats.maxSize
<< std::endl
<< "ALL Container cache occupancy " << containerCacheStats.occupancy
<< std::endl
<< line << std::endl;
}
......@@ -648,7 +666,7 @@ NsCmd::BreadthFirstSearchContainers(eos::IContainerMD* cont,
}
for (auto subcont_it = ContainerMapIterator(tmp_cont); subcont_it.valid();
subcont_it.next()) {
subcont_it.next()) {
it_next_lvl->push_back(subcont_it.value());
}
}
......
......@@ -23,13 +23,14 @@
#include "gtest/gtest.h"
#include "common/RWMutex.hh"
#include "common/PthreadRWMutex.hh"
//------------------------------------------------------------------------------
// Double write lock
//------------------------------------------------------------------------------
TEST(RWMutex, WriteDeadlockTest)
{
eos::common::RWMutex mutex;
eos::common::PthreadRWMutex mutex;
mutex.SetBlocking(true);
mutex.SetDeadlockCheck(true);
mutex.LockWrite();
......@@ -42,7 +43,7 @@ TEST(RWMutex, WriteDeadlockTest)
//------------------------------------------------------------------------------
TEST(RWMutex, RdWrRdDeadlockTest)
{
eos::common::RWMutex mutex(false);
eos::common::PthreadRWMutex mutex(false);
mutex.SetBlocking(true);
mutex.SetDeadlockCheck(true);
mutex.LockRead();
......@@ -63,7 +64,7 @@ TEST(RWMutex, RdWrRdDeadlockTest)
//------------------------------------------------------------------------------
TEST(RWMutex, RdWrRdNoDeadlockTest)
{
eos::common::RWMutex mutex(true);
eos::common::PthreadRWMutex mutex(true);
mutex.SetBlocking(true);
mutex.SetDeadlockCheck(true);
mutex.LockRead();
......@@ -85,7 +86,7 @@ TEST(RWMutex, RdWrRdNoDeadlockTest)
//------------------------------------------------------------------------------
TEST(RWMutex, MultiRdLockTest)
{
eos::common::RWMutex mutex(true);
eos::common::PthreadRWMutex mutex(true);
mutex.SetBlocking(true);
mutex.SetDeadlockCheck(true);
mutex.LockRead();
......@@ -107,7 +108,7 @@ TEST(RWMutex, MultiRdLockTest)
//------------------------------------------------------------------------------
TEST(RWMutex, MultiWrLockTest)
{
eos::common::RWMutex mutex(true);
eos::common::PthreadRWMutex mutex(true);
mutex.SetBlocking(true);
mutex.SetDeadlockCheck(true);
mutex.LockWrite();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment